I am using the Saratoga Canada template, which has run perfectly for years. Recently, I’ve had emails from a couple of users that the real-time wind data sometimes displays in km/hr, rather than knots as configured. Today I noticed the same thing.
I confirmed that Settings.php wind units were set to knots, and that WD units were also set correctly. What am I missing??
This one are the first values (from testtags.php) to appear on your website
The ajax script ajaxWDwx.js which use clientraw to more frequently update the website
Lines 61-64 tell the script to use km/h
var useunits = 'M'; // 'E'=USA(English) or 'M'=Metric
var decimalComma = false; // =false for '.' as decimal point, =true for ',' (comma) as decimal point
var useKnots = false; // set to true to use wind speed in Knots (otherwise
// wind in km/hr for Metric or mph for English will be used.
Change the settings in ajaxWDwx.js to use knots and both the 5 minute uploads from testtags.php and the ajax updates will use the same units.
I think that WD, when it is generating the testtags.php => specifies the units used inside the testtags file itself.
It does not know what the user needs and all different units are acceptable.
The PHP scripts knows
=> from the Settings what the units are the website needs
=> and the scripts convert the testtags data using the testtags units => to values for the screen using Settings units
example the yesterday values are in knots as set by Settings.php
The javascript knows
=> from its settings in the script what the units are the website needs
=> it also knows the standard clientraw units
=> and convert the clientraw values accordingly
example all real-time values are in km/h, it is correct for the javascript, but it is not what @jelliott and its visitors want.
Yes directly at the source of http://www.tenmilepoint.com/ajaxWDwx.js
When you click on the link you can check yourself these are the settings starting at line 51:
// -- begin settings --------------------------------------------------------------------------
var flashcolor = '#00CC00'; // color to flash for changed observations RGB
var flashtime = 2000; // miliseconds to keep flash color on (2000 = 2 seconds);
var reloadTime = 10000; // reload AJAX conditions every 5 seconds (= 5000 ms)
var maxupdates = 12; // Maxium Number of updates allowed (set to zero for unlimited)
// maxupdates * reloadTime / 1000 = number of seconds to update
var clientrawFile = 'clientraw.txt'; // location of clientraw.txt relative to this page on website
var ajaxLoaderInBody = false; // set to true if you have <body onload="ajaxLoader(..."
var imagedir = './ajax-images'; // place for wind arrows, rising/falling arrows, etc.
var condIconType = '.jpg'; // ='.jpg' default, ='.gif' for animated meteotreviglio condition icons
var useunits = 'M'; // 'E'=USA(English) or 'M'=Metric
var decimalComma = false; // =false for '.' as decimal point, =true for ',' (comma) as decimal point
var useKnots = false; // set to true to use wind speed in Knots (otherwise
// wind in km/hr for Metric or mph for English will be used.
var useMPS = false; // set to true for meters/second for metric wind speeds, false= km/h
var useMPH = false; // set to true to force MPH for both English and Metric units
var useFeet = false; // set to true to force Feet for height in both English and Metric
var usehPa = false; // =true to force hPa for baro in both English and Metric
var useinHg = false; // =true to force baro to inHg for both English and Metric
var showUnits = true; // set to false if no units are to be displayed
var thermometer = './thermometer.php'; // script for dynamic thermometer PNG image (optional)
// optional settings for the Wind Rose graphic in ajaxwindiconwr as wrName + winddir + wrType
var wrName = 'wr-'; // first part of the graphic filename (followed by winddir to complete it)
var wrType = '.png'; // extension of the graphic filename
var wrHeight = '58'; // windrose graphic height=
var wrWidth = '58'; // windrose graphic width=
var wrCalm = 'wr-calm.png'; // set to full name of graphic for calm display ('wr-calm.gif')
And I read: var useKnots = false;
===
When you start your page, the knots from testtags are displayed. This code is from the SOURCE of your script (richt click and choose “show source” or similar).
A big thank you for the help. Back to normal. This changed after years of reliable operation, so it’s still a mystery to me. Maybe one of the prior updates modified something.