Author Topic: Wind Rose  (Read 1555 times)

0 Members and 1 Guest are viewing this topic.

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: Wind Rose
« Reply #25 on: May 22, 2020, 10:05:27 AM »
The next time this condition occurs (I'll try to remember to check every once in a while), go to this url:

   https://www.kstwx.net/CUtags.php?sce=view

and search for these lines:

Code: [Select]
currentwdir|NE|// Current wind bearing as a compass point - e.g. ESE:|:
wspeed|5|// The 10-minute average, if you have Cumulus set to calculate a 10-minute average. Otherwise, it's the latest 'wind' value from the console:|:
avgbearing|266|// Average wind bearing in degrees over last 10 minutes. Range 1-360, 0=Calm:|:
wdir|W|// Average wind bearing over last 10 minutes as a compass point - e.g. ESE:|:
wgust|19|// The highest wind reading in the last 10 minutes. Corresponds to 'gust' on the Cumulus main screen.:|:

The actual values should be different. Copy them and post.

It looks like under certain conditions, when ajax-dashboard does not ignore the direction label ($dirlabel) to use the calm windrose, the $dirlabel value (set from either "wdir" or "currentwdir" in CUtags.php) has a bad value which results in an image name for something that doesn't exist. Dumping that info (via the URL) should reveal the data we need to figure it out.
 
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Wind Rose
« Reply #26 on: May 23, 2020, 11:52:07 PM »
Much Improved Keith  =D> =D> =D>
... but why is gizmo trying to update 10x faster than ajax and your realtime file ?

In case you haven't fixed the dashboard glitch.
A quick and dirty work around is to make a copy of wr-calm graphic and call it wr--

The logic doesn't actually cope with a gust value but currently calm, It has already done a default direction graphic based on current direction cardinal value (N. S.etc), but when calm Cumulus gives "-".

Imagine what you will KNOW tomorrow !

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: Wind Rose
« Reply #27 on: May 24, 2020, 10:36:47 AM »
So I caught the problem. You won't actually see the symptom anymore because your javascript is running and that replaces the non-existent image reference with a good one. But it's a bug that should be fixed anyway.

Here's what's in the tags file:

Code: [Select]
currentwdir|-|// Current wind bearing as a compass point - e.g. ESE:|:
wspeed|0|// The 10-minute average, if you have Cumulus set to calculate a 10-minute average. Otherwise, it's the latest 'wind' value from the console:|:
avgbearing|0|// Average wind bearing in degrees over last 10 minutes. Range 1-360, 0=Calm:|:
wdir|-|// Average wind bearing over last 10 minutes as a compass point - e.g. ESE:|:
wgust|2|// The highest wind reading in the last 10 minutes. Corresponds to 'gust' on the Cumulus main screen.:|:

When the speed is zero but the gust is non-zero, both wind direction values are "-". And that's what gets used to form the file name.

The code where $dirlabel is set is in CU-defs.php.

Code: [Select]
$dirlabel = $WX['wdir'];

There is a check for an edge condition, but that isn't happening here and the repair doesn't fix the problem (currentwindir is also "-").

Code: [Select]
if($dirlabel == '---'){$dirlabel = $WX['currentwdir'];} // use current winddir when wdir='---' for avg=0.0 wind
Where this goes sideways is in ajax-dashboard.php.

Code: [Select]
$wr = $imagesDir . $wrName . $dirlabel . $wrType; // normal wind rose
$wrtext = langtransstr('Wind from') ." " . langtransstr($dirlabel);
if ( ((float)strip_units($avgspd) + (float)  strip_units($gstspd) < 0.1 ) and
    ($wrCalm <> '') ) { // use calm instead
$wr = $imagesDir . $wrCalm;
$wrtext = $bftspeedtext;
}

Because $gstspd is >= 0.1, the default file name using $dirlabel ("-") is generated.

I'll defer to Ken for a real fix, but what beteljuice suggested is a workaround. Or maybe it doesn't bother you anymore now that it gets corrected when the javascript code runs. Anyway, I'm not sure why the data doesn't match the behavior expected by the CU code and I'm totally out of my wheelhouse with Cumulus.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline griffo42

  • Contributor
  • ***
  • Posts: 101
    • Carina Weather
Re: Wind Rose
« Reply #28 on: May 24, 2020, 10:24:56 PM »
... but why is gizmo trying to update 10x faster than ajax and your realtime file ?

I have substituted my existing gizmo with the latest downloaded from Ken True's site and the word "Updated" blinks green fairly rapidly when using either the latest or my old version.  I don't know enough about the finer points of programming to identify the problem and then to fix it.

I have implemented your suggestion regarding the wr-calm graphic.  Thanks also for the claps at the heading of your reply by the way.

best wishes

Keith
https://www.kstwx.net/index.php
Davis Vantage Pro2 Model #6152AU
Cumulus latest version
Saratoga Weather World template Cumulus plugin
Carina Weather, Brisbane.

Offline griffo42

  • Contributor
  • ***
  • Posts: 101
    • Carina Weather
Re: Wind Rose
« Reply #29 on: May 24, 2020, 10:30:49 PM »
So I caught the problem. You won't actually see the symptom anymore because your javascript is running and that replaces the non-existent image reference with a good one. But it's a bug that should be fixed anyway.


Thanks for all your work Jasiu.  I appreciate that your have spent a deal of time on my problem.  As you will note in my reply to the beteljuice I have implemented his suggested workaround.  I like the Saratoga scripts so over to Ken to alter the coding if he thinks it would be a good move to make.

best wishes

Keith
https://www.kstwx.net/index.php
Davis Vantage Pro2 Model #6152AU
Cumulus latest version
Saratoga Weather World template Cumulus plugin
Carina Weather, Brisbane.

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Wind Rose
« Reply #30 on: May 25, 2020, 07:11:38 AM »
Ahh .. It isn't gizmo that's updating so quickly, it's your new copy of ajaxCU
gizmo doesn't do any update look-up, just displays what's already there in chunks - I forgot  :roll:

Code: [Select]
// -- 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 = 5000;       // reload AJAX conditions every 5 seconds (= 5000 ms)
You upload realtime.txt every 60s so you can set reloadTime  = 30000; (30s)
Imagine what you will KNOW tomorrow !

Offline griffo42

  • Contributor
  • ***
  • Posts: 101
    • Carina Weather
Re: Wind Rose
« Reply #31 on: May 26, 2020, 07:12:12 AM »
Ahh .. It isn't gizmo that's updating so quickly, it's your new copy of ajaxCU
gizmo doesn't do any update look-up, just displays what's already there in chunks - I forgot  :roll:

You upload realtime.txt every 60s so you can set reloadTime  = 30000; (30s)


Implemented and all good!  [tup]

Thanks tbj  :grin:

best wishes

Keith
https://www.kstwx.net/index.php
Davis Vantage Pro2 Model #6152AU
Cumulus latest version
Saratoga Weather World template Cumulus plugin
Carina Weather, Brisbane.