Author Topic: The wxnwswinter.php  (Read 9532 times)

0 Members and 1 Guest are viewing this topic.

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
The wxnwswinter.php
« on: January 18, 2018, 05:13:42 PM »
Right you are!

This version includes the 'Storm Total Ice Forecast'.  The links are main script and the includes script.  I haven't checked all of the WFO's to see if the graphic is there, but you guys can do that.  :-)

Oh, and here's the Stand Alone Version  download link. ('$standAlone = true;' in the main script, is all).

This was buried in 2016-2017 winter thread so a new thread. Rapid City and North Platte are included this year and can be turned on.
Randy

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: The wxnwswinter.php
« Reply #1 on: January 18, 2018, 06:15:12 PM »
Thanks, Randy, for helping organize my 'helter-skelter' script 'droppings'. :-)

Remember, this is still labeled as 'Experimental' by the NWS.

Edit 2018 Jan 18 5:30pm CST:  I've turned on North Platte and Rapid City in the script on my site so others won't have to manually do so.
« Last Edit: January 18, 2018, 06:26:36 PM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
Re: The wxnwswinter.php
« Reply #2 on: January 18, 2018, 06:55:24 PM »
Thanks Jerry. Love the script.
Randy

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: The wxnwswinter.php
« Reply #3 on: January 18, 2018, 07:10:10 PM »
Thanks Jerry. Love the script.
Thank you, Randy.  I look at it every day, sometimes more than once.

If anyone knows of other WFO's that are using this graphic besides those already listed, please comment in this thread and I'll turn it on as well.
« Last Edit: January 18, 2018, 07:11:59 PM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline tmabell

  • Forecaster
  • *****
  • Posts: 394
    • Mishawaka Weather
Re: The wxnwswinter.php
« Reply #4 on: January 18, 2018, 08:07:33 PM »
Most, if not all Central Region offices are using this graphics set.  KGRR, KDTX, KILX, etc.

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
Re: The wxnwswinter.php
« Reply #5 on: January 18, 2018, 08:40:20 PM »
Colorado
GJT
BOU
PUB

Wyoming
RIW

Montana
MSO

Nebraska
gid

North Dakota
FGF

New Mexico
ABQ

Wisconsin   
ARX

Utah
slc

Nevada
No new


Arizona
None

Idaho
None
« Last Edit: January 18, 2018, 10:33:27 PM by ValentineWeather »
Randy

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: The wxnwswinter.php
« Reply #6 on: January 18, 2018, 11:58:55 PM »
Thanks, guys, for all the new sites!  They've been opened up in the latest includes script.  (If your version is missing some of the CRH sites, redownload.  Initially I didn't open them all up like Tom suggested.)
« Last Edit: January 19, 2018, 12:09:22 AM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: The wxnwswinter.php
« Reply #7 on: April 05, 2018, 09:10:25 AM »
During initial development of these Winter Precipitation Forecasts the NWS used an asterisk in their graphics to refer to the link to the host WFO.  At some point the asterisk was dropped, but it remained in this script.  Hence today's update where the pesky asterisk is dropped from this script.  Also, the NWS has dropped 'Experimental' from the graphics, so I've done so in the script as well.

Those are the only changes aside from the version dates on all three scripts in the zip.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: The wxnwswinter.php
« Reply #8 on: April 05, 2018, 10:01:15 AM »
I didn't know this script existed - I'm going to look into incorporating it as I refer to the Boston winter page for every storm.

Besides the graphics, I also frequently use the "Snowfall Totals by Location" table feature on the Boston page (https://www.weather.gov/box/winter). This allows me to drill down to city/town level.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: The wxnwswinter.php
« Reply #9 on: April 05, 2018, 12:08:37 PM »
Very nice script. I am testing it at http://www.rogerscityweather.com/wxnwswinter.php

There is one thing that I noticed when it is running on my site. If I land on the page and select a different wfo, it will switch just once. Subsequent attempts will not change from that 2nd area. If I reload the page, I once again get my default wfo, then the same thing happens.

Interestingly if I go to gwwilk's page, it behaves as expected and I can arbitrarily change to other wfo sites as much as I want.

I flushed my Cloudflare cache and it didn't make any difference.

Any ideas?

Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 724
    • Lake Huron Weather
Re: The wxnwswinter.php
« Reply #10 on: April 05, 2018, 12:46:56 PM »
Interesting Greg, mine has been working the way it is supposed to with no problems.
http://lakehuronweather.org/wxnwswinter.php
I did you at yours and as it behaves as you described, strange.  Maybe Jerry can provide some insight.

CW3699

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: The wxnwswinter.php
« Reply #11 on: April 05, 2018, 01:06:12 PM »
Very nice script. I am testing it at http://www.rogerscityweather.com/wxnwswinter.php

There is one thing that I noticed when it is running on my site. If I land on the page and select a different wfo, it will switch just once. Subsequent attempts will not change from that 2nd area. If I reload the page, I once again get my default wfo, then the same thing happens.

Interestingly if I go to gwwilk's page, it behaves as expected and I can arbitrarily change to other wfo sites as much as I want.

I flushed my Cloudflare cache and it didn't make any difference.

Any ideas?

Greg H.
I would start at the JavaScript Console which shows two 'revolvermaps' loads which are 'Failed to load resource: net::ERR_BLOCKED_BY_CLIENT'.  At least one of them must contain some JavaScript code or references which when not loaded kills any further JavaScript execution.  Once this happens neither dropdown menu on this script is working.

Your site has the same problem with this script.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: The wxnwswinter.php
« Reply #12 on: April 05, 2018, 04:52:07 PM »
I tried commenting out the revolvermaps code, which resides in the footer.php file. Didn't change the behavior.

Hmmm....

Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: The wxnwswinter.php
« Reply #13 on: April 05, 2018, 09:46:40 PM »
Greg,

One difference in your setup is the use of cloudflare / rocketscript with the javascript. I'm not familiar with that so I can't be much help.

The essential problem is that after the first selection of a forecast office there is no longer a javascript "change" event assigned to the <select> structure (at least that's what the Firefox element inspector shows me).  Normally, the code that executes upon a change of that selector is at line 503 of inc-nwswinter.php.

https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: The wxnwswinter.php
« Reply #14 on: April 06, 2018, 08:44:05 AM »
I just put Cloudflare into "development mode" which bypasses their caching and everything should be served directly from my site. I also flushed the Cloudflare cache again, and I have left off the revolvermaps entry in the footer. Still the same. I might try this on one of my other webhosts and see what happens.

Thanks for the suggestions, but still no joy. This is perplexing...  :?

Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: The wxnwswinter.php
« Reply #15 on: April 06, 2018, 10:06:28 AM »
Greg,

This is what I'm seeing:

Within inc-nwswinter.php, the <select> tag for the NWS office has an ID of "wfo". Further down in that file is the jQuery that triggers when a change is made for that selection:

Code: [Select]
<script type="text/javascript">
  $("#wfo").change(function () {
    var wfo = $(this).val();
var divWidth = "<?php echo $divWidth?>";
var prediction = "<?php echo $prediction?>";
var standAlone = "<?php echo $standAlone?>";
    showPredictionjs(wfo,divWidth,prediction,standAlone);
  });
</script>

This all works on the initial page load. However, in your case, the cloudflare stuff modifies some of the code (e.g., "text/javascript" is changed to "text/rocketscript").

When showPredictionjs() runs (this code is in wxnwswinter.php), it executes the following jQuery:

Code: [Select]
<script type="text/javascript"> {
function showPredictionjs(wfo,divWidth,prediction,standAlone) {
$('#showPrediction').load('inc-nwswinter.php',{wfo:wfo,divWidth:divWidth,prediction:prediction,standAlone:standAlone});
}
}
</script>

What this does is replace the previous code that was in the <div> with the ID "showPrediction" (essentially all of first include of inc-nwswinter.php) with a new copy, modified according to the parameters passed. This includes reloading the jQuery code I first quoted above. In a normal environment, the browser will execute that jQuery upon the load of the new code and attach change events to the two <select> menus again. THAT is what isn't happening in your environment. It looks like the code loads fine (with the cloudflare mods) but the jQuery/javascript doesn't execute.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: The wxnwswinter.php
« Reply #16 on: April 06, 2018, 11:01:29 AM »
Thanks, Jasiu.

I went ahead and tried my other domain miraculon.net and the stand-alone version works fine. I do not have Cloudflare on that site. I am puzzled as to why putting CF into "development mode" didn't stop this behavior. I have had issues in the past with Cloudflare and the code modifications on other pages.

With a lot of "twisting of the size knobs" I put the SA version into miraculon.net and call it into rogerscityweather.com via an iframe. Yet another kludgy solution, but it seems to have worked. I'll be the first to admit that I am not much of a programmer, I kind of hack it 'til it works...  :lol: (or I break it  ](*,))

Here is the new page: http://www.rogerscityweather.com/NWS-winter.php
The SA page that is fed into this page originates from http://www.miraculon.net/gwwilk/wxnwswinter-SA.php

I also changed the Forecast Maps page: http://www.rogerscityweather.com/NWS-ushourly24.php
The SA page that is fed into this page originates from http://www.miraculon.net/gwwilk/wxushourly24hfc-SA.php

Both SA pages were tweaked for size to fit the iframe.

Greg H.


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: The wxnwswinter.php
« Reply #17 on: April 08, 2018, 10:51:27 AM »
As an FYI, if anyone out there is interested in adding any of the data from the "Snowfall Totals by Location" table, it can be found in XML format at:

  https://www.weather.gov/source/xxx/winter/snow_range.xml

where "xxx" is the NWS office code in lower case.

Unfortunately, all of the data is in one big text chunk and one has to parse that to get the results.

This and more info is in the following javascript that is used on the winter page:

  https://www.weather.gov/source/erh/probSnow/probSnow_2017-18.js

https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: The wxnwswinter.php
« Reply #18 on: May 09, 2018, 10:26:38 AM »
I tried these unmodified scripts using the "UC" browser on my Windows Phone and Firefox and Konquerer on my Linux box and they didn't have this problem. All other browsers, Firefox, Edge, Chrome acted the same way as my Ice Dragon (FF based) browsers running on Windows 10. Not sure why the phone and Linux didn't exhibit a problem.

I finally found the resolution to this issue. It was indeed Cloudflare rewriting some of the javascript entries.

I found this online:  https://stackoverflow.com/questions/9681032/why-is-wordpress-placing-text-rocketscript-instead-of-text-javascript-when-u?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Although it was for Wordpress, the issue seemed to be similar to what I was seeing.

The gist of it is this:

Quote
It is easy to fix.

You must change the following tag: <script type="text/javascript"></script>

add: data-cfasync="false"

example:

<script data-cfasync="false" type="text/javascript"></script>

Once I added the data-cfasync="false" it resolved this for all of the gwwilk scripts that I was having. I searched for any instance for javascript, I might have overdone it and added where it wasn't strictly necessary, but no problems in doing so.

My initial "fix" below only worked for those two scripts mentioned previously. I had no success with wxGOES16-HAniSLoops.php and wxusradars-hanis3.php running on my other site. There must have been some dependency on the saratoga scripts that I just couldn't figure out.

I applied this 'data-cfasync="false"' fix to all four scripts.


Greg H


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: The wxnwswinter.php
« Reply #19 on: May 09, 2018, 10:44:10 AM »
Great work, Greg.  Thanks for posting this fix!
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: The wxnwswinter.php
« Reply #20 on: November 13, 2018, 10:40:38 AM »
It seems that the NWS has changed these snow pages. I noticed that the "Most Likely Snowfall" was zero, but "At least this much" and "Potential for this much" were still showing forecasted amounts.

The "Potential for This Much" agrees with the new map showing "High End Amount".

The "Expect at least This Much" agrees with the new map showing "Low End Amount".

But, the "Most Likely Snowfall" doesn't agree with the new "Expected Snowfall" amount. The date was from 10/29-30.

See my snow page at http://rogerscityweather.com/wxnwswinter.php versus the APX snow page at https://www.weather.gov/apx/winter

Indeed this new page has a different URL of https://www.weather.gov/images/apx/winter/StormTotalSnowWeb.png



Versus the old one at https://www.weather.gov/images/apx/winter/StormTotalSnowWeb1.png. Note the "1" was dropped.



There are a lot of new probability images shown on the NWS page.

I modified my inc-nwswinter.php to eliminate the "1" in all instances of StormTotalSnowWeb1 to StormTotalSnowWeb. It seems to have worked. The above links to my pages will no longer show the problem and were corrected by the modification. The image inserted into the thread seems to have been from the time with the issue.

Greg H.






Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: The wxnwswinter.php
« Reply #21 on: November 13, 2018, 11:17:55 AM »
Thanks for picking up on this!  I noticed the overlaid text some time ago but I never put two and two together. #-o

There's a new nwswinter.zip in the downloads on my site that fixes the problem.

Thanks again for your help! :-)
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline miraculon

  • Sunrise Side Weather
  • Forecaster
  • *****
  • Posts: 4107
  • KE8DAF
    • Sunrise Side Weather in Rogers City MI USA
Re: The wxnwswinter.php
« Reply #22 on: November 13, 2018, 01:11:32 PM »
Thanks for picking up on this!  I noticed the overlaid text some time ago but I never put two and two together. #-o

There's a new nwswinter.zip in the downloads on my site that fixes the problem.

Thanks again for your help! :-)

I too had noticed the overlaid text but today was pondering why the amount that should have been somewhere between the others was still zero...  :-k

Greg


Blitzortung Stations #706 and #1682
CoCoRaHS: MI-PI-1
CWOP: CW4114 and KE8DAF-13
WU: KMIROGER7
Amateur Radio Callsign: KE8DAF

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: The wxnwswinter.php
« Reply #23 on: November 13, 2018, 10:26:03 PM »
As an FYI, if anyone out there is interested in adding any of the data from the "Snowfall Totals by Location" table, it can be found in XML format at:

  https://www.weather.gov/source/xxx/winter/snow_range.xml

where "xxx" is the NWS office code in lower case.

Unfortunately, all of the data is in one big text chunk and one has to parse that to get the results.

This and more info is in the following javascript that is used on the winter page:

  https://www.weather.gov/source/erh/probSnow/probSnow_2017-18.js

If anyone happened to use this info last season, a couple of updates:

1) The javascript file to dig into for details is now appropriately named:

  https://www.weather.gov/source/erh/probSnow/probSnow_2018-19.js

2) The XML file is now called:

  https://www.weather.gov/source/xxx/winter/snow_prob.xml

i.e., "prob" instead of "range".

Also Jerry, a very very very small nit: Next time you are in the code, you can change the description of "BOX" to Boston/Norton. They moved from Taunton earlier this year. Thanks as always for the hard work!
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: The wxnwswinter.php
« Reply #24 on: November 14, 2018, 12:12:34 AM »
A revised 'nwswinter.zip' with a 'Boston/Norton' entry and the correct revision date is now up on my site.
Regards, Jerry Wilkins
gwwilk@gmail.com