Wind units swtch from knots to km/hr intermittently

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??

Thanks.

A URL for the page would surely help anyone trying to diagnose this problem for you…

You’re right.

www.tenmilepoint.com

it’s displaying km/hr for me at the moment
that is set in the template settings normally

I see km/h too except for gust, but jelliot is correct, the settings.php does have:

$SITE['uomWind'] = ' kts';   // =' km/h', =' kts', =' m/s', =' mph'

Odd :?

maybe the best thing is to update the template version (and WD version too?)

Template looks up to date: http://www.tenmilepoint.com/check-fetch-times.php?show=versions

Thanks. Template is up to date, but WD is not. Will update this afternoon.

I updated WD to the current 10.37S Build 73. Plus have Saratoga/Canada up to date. Still exhibits the anomaly. Very confusing…

might need the help of the template author

There are always two sets of settings

  1. Settings.php which are set to knots at line 146
$SITE['uomWind'] = ' kts';   // =' km/h', =' kts', =' m/s', =' mph'

This one are the first values (from testtags.php) to appear on your website

  1. 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.

Wim

Thanks Wim :slight_smile:

While I was looking at this I saw there is a set of unit of measure settings in testtags.php, so that makes three.

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.

Wim

My point was that there is a (possibly redundant) set of uom settings included in testtags.php which adds some confusion for us amateur detectives.

Thanks, guys. Settings.php, ajaxWDwx.js, and testtags.txt are all set to knots. No change.

Wim, are you viewing my code directly? ajaxWDwx.js was correctly set to knots ("true’). Your copy shows “false”.

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).

<td colspan="2" class="data1" align="center">
				  Today: 
				  <span class="ajax" id="ajaxwindmaxgust">9.0  kts</span> 
				  <span class="ajax" id="ajaxwindmaxgusttime">8:21am</span>
				</td>

and then on the window itself the javascript = the green values replace the knots values with the km/h values from clientraw.

But you solved it as now ( 10 min after your post), the green values are in knots also.

Wim

it’s showing kts for me now,so he must have corrected it

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.

Anyway, all ok for now. And I learned something.

Case closed.