cloudy cloudy

Author Topic: Problems with Saratoga mesomaps  (Read 527 times)

0 Members and 1 Guest are viewing this topic.

Offline Ralph1

  • Posts: 122
  • Auchterhouse, Angus, Scotland, UK
  • OS/Browser:
  • (Linux Mint)
  • Firefox 52.0
    • Auchterhouse Weather
Problems with Saratoga mesomaps
« on: September 25, 2017, 09:37:56 AM »
I have recently tried to upgrade my website to include mesomaps, specifically the Scottish Weather Network version. I have asked for help from the SCWN forum, but nothing has happened. I use the Saratoga scripts with some mods. I have used the instructions supplied from the Saratoga website.
Basically, there are three main problems I have with the mesomaps on my website. The first is that I can't get the zoom and initial centre of the map to start to my selected figures, the system ignores all inputs of zoom or initial latitude and longitude. I have set $SITE['rmMapUseDefaults'] to false as specified in the set up instructions as well as $SITE['rmMapZoom'] and $SITE['rmMapCenter'] (all in Settings.php) 
Secondly, when the system starts up, it is supposed to rotate from one quantity to another.  But on my website, it misses out many of the parameters. If you look at my website you will see what I mean; it shows dewpoint wind and barometer but not temperature, humidity or rainfall.  Pressing "Pause" and then "run" causes all parameters to be shown, but surely they should all show from the start?
The third problem (I think) is that the system gets the clientraw.txt file directly from the website instead of the position given in Settings.php which shows the correct place to find clientraw.txt is from./live/ on my website.

If you try looking at my website which is http://sidlawweather.co.uk and click on the flyoutmenu option for SCWN you will see what I mean.
Clicking on the SCWN logo (further down below the flyoutmenu) the second problem doesn't exist but the others do. Naturally, I want the mesomap to start up correctly from the flyoutmenu.

I hope someone can point out the error of my ways.
John

Offline saratogaWX

  • Global Moderator
  • Posts: 5,664
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 55.0
    • Saratoga Weather
Re: Problems with Saratoga mesomaps
« Reply #1 on: September 25, 2017, 04:34:12 PM »
Hi John,
Perhaps, I can assist :)

I note that the JavaScript console shows one error that may be impacting your site.  In ajaxWDwx-settings.js you have a line
Code: [Select]
moonImg.src   = ./cloudbase/moon/+"moon/{BG}/{NS}-moon{AGE}.gif"; // replacements: {BG}=[w=white|b=black], {NS}=[NH|SH], {AGE}=[00..27]
and that is missing a set of quotes -- it should read
Code: [Select]
moonImg.src   = "./cloudbase/moon/"+"moon/{BG}/{NS}-moon{AGE}.gif"; // replacements: {BG}=[w=white|b=black], {NS}=[NH|SH], {AGE}=[00..27]

I've noticed that any syntax erratum in any JavaScript on a page can stop execution of all the JavaScript, so try fixing that one first.

Looking at mesonet-map-check-versions.php shows you have a current set of scripts (albeit missing some of the language support files, but since you're using English only, that's not an issue).

Running check-fetch-times.php?show=versions shows you have a really old version of that tool (it doesn't display versions).  I suggest you download https://saratoga-weather.org/wxtemplates/Test/check-fetch-times.php?sce=view , install on your site, then run check-fetch-times.php?show=versions to see what other support scripts may need updating.

I hope this helps...

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline Ralph1

  • Posts: 122
  • Auchterhouse, Angus, Scotland, UK
  • OS/Browser:
  • (Linux Mint)
  • Firefox 52.0
    • Auchterhouse Weather
Re: Problems with Saratoga mesomaps
« Reply #2 on: September 25, 2017, 07:33:58 PM »
Hi there Ken,

Many thanks for your rapid reply. I made the correction you spotted in the ajaxWDwx-settings.js file but it didn't seem to make any difference.
However running the latest version of check-fetch-times.php?show=view indicates that my website needs an enormous amount doing to it mainly in updating out of date files but also quite a few were missing.  In my current system there are quite a few changes from the original Saratoga system to allow data from unusual hardware to be displayed.

Presumably you can run "check-fetch-times.php?show=view" on my website and you will see what I have seen. Not sure if I have the energy to make all the changes and I'd be worried that some self made changes might no longer work. So I'm not quite sure where this leaves me. Perhaps I should just update one file at a time until we find the culprit but it looks as though the system has changed vastly since the time of my original set-up. I guess I knew that but didn't realise it was so critical for this particular application.

Many thanks again,

John

Offline saratogaWX

  • Global Moderator
  • Posts: 5,664
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 55.0
    • Saratoga Weather
Re: Problems with Saratoga mesomaps
« Reply #3 on: September 25, 2017, 09:59:03 PM »
Hi John,
It looks like you have an original V2 of the AJAX-WD-World template set, so unless you update to a V3 Base-World/WD-plugin set, the check-fetch-times.php?show=versions may not be very helpful. You can get a complete set of the needed files to convert V2 to V3 by using the V2->V3 conversion tool -- it's a fairly exacting process to merge your mods into the new files, but afterwards, you'll be able to easily use the update tool to keep the common scripts fresh and tidy. 

But.. more to your issues cited in the first post:
1) The Settings.php entries are being ignored
Code: [Select]
   143: $SITE['rmMapUseDefaults'] = 'false';
   144: $SITE['rmNETID'] = 'SCWN';
   145: $SITE['rmMapZoom'] = '6';
   146: $SITE['rmMapCenter'] = '56.0, -4.0';
should be
Code: [Select]
   143: $SITE['rmMapUseDefaults'] = false;
   144: $SITE['rmNETID'] = 'SCWN';
   145: $SITE['rmMapZoom'] = '6';
   146: $SITE['rmMapCenter'] = '56.0,-4.0';
note that 'false' is not the same as false in PHP.  The former is a string and in a logical compare evaluates as true (that is non-zero), while the latter is a logical constant and evaluates as false (a zero).  That's likely the reason why your override settings were ignored.


2) the rotating conditions seem to skip values.  This strange behavior is caused by two instances of
Code: [Select]
setTimeout("RMNET_rotate_content()",RMNETrotatedelay); being run with slightly different start times.  That routine should run once after the page is loaded to begin the rotations of the display (and on your page it seems to be running two instances).
I noticed that a 'Pause' and then a 'Run' gets it back to doing an orderly transit of the rotating conditions with no 'skips'.  I'll have to dig into your code a bit more to isolate the cause.

3) regarding the clientraw.txt location, that's not something that the mesonet-map scripts use directly -- the data for the mesonet-map comes directly from the selected regional network (SCWN in your case), and the SCWN is doing the 'pull' of your clientraw.txt every 5 minutes.  If the location of the conditions file is incorrect on the SCWN, that's something that Martin at SCWN to correct.  Currently, the SCWN is showing
Quote
Details for Angus Auchterhouse (SCWN-stations-cc.txt record 27):

<!-- type='CR' RawDataURL = 'http://sidlawweather.co.uk/clientraw.txt' -->
<!-- curl fetching 'http://sidlawweather.co.uk/clientraw.txt' -->
<!-- HTTP stats: RC=200 dest=77.72.0.162 port=80 (from sce=10.0.18.197)
Times: dns=0.000 conn=0.006 pxfer=0.006 get=0.007 total=0.013 secs -->
<!-- headers:
HTTP/1.1 200 OK
Last-Modified: Mon, 25 Sep 2017 21:30:23 GMT
Content-Type: text/plain
Content-Length: 751
Date: Mon, 25 Sep 2017 21:51:55 GMT
Accept-Ranges: bytes
Server: LiteSpeed
Connection: Keep-Alive
-->
<!-- CR time to fetch: 0.013 sec (200 OK) -->
<!-- webserver timesync=7 sec 'Mon, 25 Sep 2017 21:51:55 GMT' -->
<!-- age=1292 sec 'Mon, 25 Sep 2017 21:30:23 GMT' -->
<!-- metric='12345 7.7 7.7 61 11.6 98 1022.0 9.0 67.0 602.0 0.00 0.38 21.6 58 100.0 1 0.0 0 0 6.0 -100.0 -100.0 -100.0 -100.0 -100.0 -100.0 -10 -10 -10 22 30 29 Auchterhouse-22:30:29 0 0 25 9 100 100 100 100 100 100 12 11.6 13.5 14.2 11.3 1 Night_time/Scattered_clouds_ 1.0 8 9 9 9 8 7 7 8 9 9 9 8 9 9 9 9 8 9 9 9 22.3 11.3 738.6 25/9/2017 17.4 13.1 14.2 11.3 0.0 6 6 7 8 7 8 7 8 8 7 11.5 11.4 11.4 11.6 11.6 11.7 11.7 11.7 11.7 11.6 9.0 9.0 9.0 9.0 9.0 9.0 9.0 9.0 9.0 9.0 14.2 11.3 11.6 18.0 0 --- --- 60 0 0 0.0 0.0 -100 0 0 0 0 0.0 23.4 19.8 9.5 1022.0 1017.6 14 21:49 05:00 16.6 6.2 13.8 10.9 10 2017 -17.8 1 0 1 62 52 73 66 56 59 60 73 66 69 0.0 255.0 7.7 11.4 56.53194 3.06917 5.0 100 96 9.3 00:01 0.0 0.0 0.0 0.0 0.0 0.0 365.3 16:40 00:01 69 !!C10.37S55!!' -->
<!-- station using CR units C,kts,hPa,mm by default -->
<!-- convertWind(7.7) kts [7.7 kts] to '9' MPH -->
<!-- convertWind(7.7) kts [7.7 kts] to '9' MPH -->
<!-- CR[48]=1 .. trying METAR EGPN for conditions -->
<!-- METAR='EGPN' -->
<!-- curl fetching 'http://tgftp.nws.noaa.gov/data/observations/metar/stations/EGPN.TXT' -->
<!-- HTTP stats: RC=200 dest=140.172.138.79 port=80 (from sce=10.0.18.197)
Times: dns=0.000 conn=0.129 pxfer=0.129 get=0.131 total=0.261 secs -->
<!-- headers:
HTTP/1.1 200 OK
Date: Mon, 25 Sep 2017 21:52:02 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Last-Modified: Mon, 25 Sep 2017 19:24:15 GMT
ETag: "46b8b00-41-55a0881134be6"
Accept-Ranges: bytes
Content-Length: 65
Vary: Accept-Encoding
Content-Type: text/plain; charset=UTF-8
-->
<!-- EGPN time to fetch: 0.261 sec -->
<!-- EGPN='2017/09/25 19:20 EGPN 251920Z VRB02KT 3000 BR SCT004 14/14 Q1023' -->
<!-- age=9122 sec '2017-09-25 19:20:00 GMT' -->
<!-- metar 'EGPN' saved in local cache -->
<!-- metar too old.. ignored -->
<!-- condition begin: '','','','' -->
<!-- fixupTime in='6:00a' tfixed='6:00a' out='06:00' -->
<!-- fixupTime in='7:00p' tfixed='7:00p' out='19:00' -->
<!-- fixupTime in='22:52' tfixed='22:52' out='22:52' -->
<!-- condition using: time2='22:52' as night for sunrise2='06:00',sunset2='19:00' -->
<!-- Angus Auchterhouse 27 data='11.6,98,ENE,9,9.0,1022.0,Rising Slowly,,,11.3,9,1506375023,0.013' -->
so it is pulling from ./clientraw.txt and not ./live/clientraw.txt so contact Martin to make that change.

Hope this helps...

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline Ralph1

  • Posts: 122
  • Auchterhouse, Angus, Scotland, UK
  • OS/Browser:
  • (Linux Mint)
  • Firefox 52.0
    • Auchterhouse Weather
Re: Problems with Saratoga mesomaps
« Reply #4 on: September 26, 2017, 10:27:13 AM »
Hi Ken,

OK the initial conditions (zoom and position)problem (my stupidity) and the clientraw.txt source problem have been solved. I will try to contact Martin in due course. But the other one persists. I notice that the line
setTimeout("RMNET_rotate_content()",RMNETrotatedelay);
exists in mesonet-map.js.  Now when I try to look at that file with my editor, it comes up with some errors (doesn't specify what they are) so perhaps I have a corrupted file there?
I couldn't find another instance of that line in other code but that doesn't prove anything as there are many files to choose from! I don't know if that information is of any help.

Thank you again for being so helpful.

Regards,
John

Offline Ralph1

  • Posts: 122
  • Auchterhouse, Angus, Scotland, UK
  • OS/Browser:
  • (Linux Mint)
  • Firefox 52.0
    • Auchterhouse Weather
Re: Problems with Saratoga mesomaps
« Reply #5 on: September 30, 2017, 01:13:04 PM »
Hi Ken,

I'm not clear whether you are still working on my problem of the parameters not rotating correctly on my SCWN weather page?  It is possible that it is causing you some difficulty, in which case disregard this message. I would be grateful for an update on whether you can see your way to fix it.
Martin says he will be back tomorrow and hopefully, he will change the directory from which the clientraw.txt is read to the correct one.
I'm afraid fixing the parameter rotation problem is one for an expert!

John

Offline saratogaWX

  • Global Moderator
  • Posts: 5,664
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 56.0
    • Saratoga Weather
Re: Problems with Saratoga mesomaps
« Reply #6 on: September 30, 2017, 03:03:27 PM »
Hi John,

Sorry for the delay in reply.

I think I have located the problem -- there are two 'initialize()' JavaScript functions in the page.  One in ajaxwdwx.js and one generated by the mesonet-map.

I suggest you change the ajaxwdwx.js script in two places:
Code: [Select]
function initialize() {
to
Code: [Select]
function initializeAJAX() {
and
Code: [Select]
   initialize();
to
Code: [Select]
   initializeAJAX();
then there won't be interference, and the conditions rotation on the map will work one step at a time as intended.
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline Ralph1

  • Posts: 122
  • Auchterhouse, Angus, Scotland, UK
  • OS/Browser:
  • (Linux Mint)
  • Firefox 52.0
    • Auchterhouse Weather
Re: Problems with Saratoga mesomaps
« Reply #7 on: October 01, 2017, 08:55:56 AM »
Hi Ken,

I'm afraid that I couldn't find any 'function initialize()' in my copy of ajaxwdwx.js.  I couldn't even find the word "initialize". This suggests that it is an older copy? Perhaps that function was initiated in a different way then.  On looking at my files, I found under a directory labelled Ajax another copy of ajaxwdwx.js which does contain the 'function initialize()'. A friend of mine who lives in London is responsible for some changes and I think he found the latest version (several years ago) did not work with what he was trying to do.

So I suspect the version I am using is older (2009) than the one you thought I was using.  I guess this all points to the requirement that I bring my system up to date. Not sure what to do now.
John

Offline saratogaWX

  • Global Moderator
  • Posts: 5,664
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 56.0
    • Saratoga Weather
Re: Problems with Saratoga mesomaps
« Reply #8 on: October 01, 2017, 08:23:42 PM »
Hi John,
The file is at http://sidlawweather.co.uk/ajaxwdwx.js -- and it has the two instances of initialize(  in it.  That's the one to edit to change it to initializeAJAX( for both occurrences.
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline Ralph1

  • Posts: 122
  • Auchterhouse, Angus, Scotland, UK
  • OS/Browser:
  • (Linux Mint)
  • Firefox 52.0
    • Auchterhouse Weather
Re: Problems with Saratoga mesomaps
« Reply #9 on: October 02, 2017, 09:58:01 AM »
Hi Ken,

When I looked for the problem, I stupidly assumed that the copy of ajaxwdwx.js I had in a certain location on my system was the same as the one on my website. But of course it wasn't, sorry about that. So I found out which one it was, found the 'function initialize()' , edited it precisely as you described and posted it to my website, but, I regret to say that it hasn't made any difference. What a pity!

John

Offline saratogaWX

  • Global Moderator
  • Posts: 5,664
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 56.0
    • Saratoga Weather
Re: Problems with Saratoga mesomaps
« Reply #10 on: October 02, 2017, 04:01:31 PM »
Hi John,
I just checked, and you have successfully modified the ajaxwdwx.js file to replace the two instances of 'initialize(' with 'initializeAJAX('.
Looking at your SCWN map, it is now working correctly for me -- no skipping ahead with the rotating conditions display as had been previously happening.

Please try viewing the http://sidlawweather.co.uk/wxmesonetmap.php page again, and do a shift-reload to refresh the browser cache -- then it should display correctly for you.

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline Ralph1

  • Posts: 122
  • Auchterhouse, Angus, Scotland, UK
  • OS/Browser:
  • (Linux Mint)
  • Firefox 52.0
    • Auchterhouse Weather
Re: Problems with Saratoga mesomaps
« Reply #11 on: October 02, 2017, 06:44:01 PM »
Hi Ken,

Yes, we have a fix!!! Thank you very much!  It works fine now.

Kind regards,

John   

Offline saratogaWX

  • Global Moderator
  • Posts: 5,664
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 56.0
    • Saratoga Weather
Re: Problems with Saratoga mesomaps
« Reply #12 on: October 02, 2017, 07:37:14 PM »
You're welcome, John.  Glad it was an easy fix once isolated -- JavaScript errors can be a real pain to diagnose sometimes.

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates