Author Topic: nwswinter script by gwwilkins  (Read 4204 times)

0 Members and 1 Guest are viewing this topic.

Offline NorCal_Dan

  • Member
  • *
  • Posts: 47
    • Traveling RV Wx
nwswinter script by gwwilkins
« on: November 29, 2024, 06:14:32 AM »
Now that winter has begun here in WNY I was looking forward to using this script.  But, as of early Nov2024, it is no longer updating.  I assume because the Buffalo NY office is not updating the graphic that the script is fetching.  Expecting a few feet of snow here this weekend from lake effect snow storms and was hoping to see this script shine.  Bummed... 

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #1 on: November 29, 2024, 09:18:37 AM »
Until Jerry has a chance to chime in I will try to help.

The images used in Jerry's script are considered by the NWS to be "Experimental", even though they reflect the "official" snowfall forecast.  The problem is that there is no requirement that the NWS follow strict formatting with experimental products.  I anticipate issues when trying to keep this script working everywhere because changes seem to occur at random and vary by location, Buffalo being one (there are others). 

As a temporary fix you can replace inc-nwswinter.php with the script attached.  Also, in the parent script you'll need to change

Code: [Select]
$prediction = 'StormTotalSnowWeb';to
Code: [Select]
$prediction = 'StormTotalSnow';



Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #2 on: November 29, 2024, 09:54:43 AM »
Looks like they might be migrating to "generate on the fly" images instead of using fixed image URLs.

Compare the Boston office: https://www.weather.gov/box/winter

Click on the Probabilistic Snowfall Forecasts tab, then right-click on the image and choose "open image in new tab" (exact wording / choices will differ depending on the browser) and you get a direct URL to the image.

https://www.weather.gov/images/box/winter/StormTotalSnowWeb.jpg

However, with Buffalo: https://www.weather.gov/buf/winter

Choose the same tab and do the same thing and you get this:

https://www.wpc.ncep.noaa.gov/Prob_Precip/idss-map/mapgen.php?office=BUF&pointpreferences=BUF&ptype=prob_sn&summary=true&product=expected&1732891602417

Jerry, if I have more time today I'll poke around a bit to see how prevalent this is, but I suspect it's a change being rolled out, which of course makes it a PITA to keep the script correct for all WFOs.  Grrr.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #3 on: November 29, 2024, 10:02:03 AM »
JJ,

I found a bunch that have migrated over from "StormTotalSnowWeb" to StormTotalSnow".  Many of them use both for now.  Even the one you mentioned (BUF) is using both "on the fly" images and the static image https://www.weather.gov/images/buf/winter/StormTotalSnow.jpg  We might be chasing our tail for a while  ](*,)
« Last Edit: November 29, 2024, 10:54:46 AM by tmabell »

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #4 on: November 29, 2024, 10:37:07 AM »
There have been issues with inconsistent image file names for a while. Maybe the on-the-fly solution (which works with BOX!) will give us a consistent way to get them. More investigation needed....
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #5 on: November 29, 2024, 10:43:05 AM »
For reference for anyone who wants to play around with this. Or maybe find a reference??

Base URL:

https://www.wpc.ncep.noaa.gov/Prob_Precip/idss-map/mapgen.php

Parameters:

office (three character WFO)
pointpreferences (three character WFO, not sure what this does)
ptype (string, the one I see if "prob_sn" but need to figure out all the enumerations)
summary (appears to take true or false)
product (string, seeing "expected")
a big integer... (unsure of what it does. when I try removing it with BOX it doesn't seem to make a difference)


« Last Edit: November 29, 2024, 11:32:19 AM by Jasiu / JJ »
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #6 on: November 29, 2024, 10:48:12 AM »
I did a cursory check of a handful of offices and various products using the on-the-fly solution and it worked for every one.  I believe you are onto a more reliable & permanent solution.   =D>   

PS I think the "prob_sn" is what used to be StormTotalSnow. Not sure yet, still investigating.

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #7 on: November 29, 2024, 10:53:11 AM »
I think I found the base URL from where this is all put together (just a shortening of the image generation URL). Looks like the SPC coordinates all of this now.

https://www.wpc.ncep.noaa.gov/Prob_Precip/

You can scroll the left column and pick a WFO and click to get a "sharable" image. URL is similar to the previous one. I have to take a break from this so hopefully someone figures it all out before I come back!  :grin:
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #8 on: November 29, 2024, 11:40:35 AM »
Maybe this will help.  I played a bit with the link you provided to the WPC.  I found a correlation between the "product" in the URL and what the script now uses. 

expected = Most likely snowfall
high_end = Potential for this much
low_end = Expect at least this much
0p10 = Chance >= 0.1 Inch Snowfall
1p00 = Chance >= 1 Inch Snowfall
2p00 = Chance >= 2 Inch Snowfall
4p00 = Chance >= 4 Inch Snowfall
6p00 = Chance >= 6 Inch Snowfall
8p00 = Chance >= 8 Inch Snowfall
12p00 = Chance >= 12 Inch Snowfall
18p00 = Chance >= 18 Inch Snowfall

It seems that we need to populate all of the fields in the URL which include:

office (three letter ID)
pointpreferences (should match the office)
product (see above)
ptype (prob_sn = snow amount, pqpf = liquid amount)
accum_period (72 for the entire forecast period ending in the fhour value, 24 for the previous 24 hours from the fhour value)
fhour (forecast hour & date)  We apparently can leave the date off and it still works!)

« Last Edit: November 29, 2024, 11:48:25 AM by tmabell »

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #9 on: November 29, 2024, 11:49:02 AM »

fhour (forecast hour & date)

Playing a bit, I think fhour is the final hour of the accumulation period. E.g. if I look at the 72 hour forecast ending at 12Z Monday, I get 68, which is number of hours (rounded down) until that time.

There also seem to be default for parameters if they aren't included.

When Jerry sees this maybe we'll have it all figured out!

Edit: note that the fhour and the integer after it (a timestamp in this case) are separate URL parameters given the ampersand.

Code: [Select]
&fhour=68&2024112916
« Last Edit: November 29, 2024, 11:53:14 AM by Jasiu / JJ »
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #10 on: November 29, 2024, 11:51:25 AM »
I wonder if that 68-hour value might change a little, depending on the time of day the forecast was released.  Hopefully that isn't a problem  :roll:

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #11 on: November 29, 2024, 11:57:27 AM »
If you add in the summary parameter (true) and leave off accum_period and fhour, you get the same 72 hour info. At least that's what I'm seeing.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #12 on: November 29, 2024, 01:48:57 PM »
It looks like, for example, we can include "&accum_period=24&fhour=42" and then we get the 24-hour forecast ending at hour 42.  This allows us to include forecasts for 24-hour periods should we want to go that way.  I'm not sure we want to though because it will complicate things more than just a little bit.  I feel like just sticking to the images and parameters the script contains now would be the best way to go.  Any thoughts as we await Jerry's take on it?

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #13 on: November 29, 2024, 02:03:06 PM »
It looks like, for example, we can include "&accum_period=24&fhour=42" and then we get the 24-hour forecast ending at hour 42.  This allows us to include forecasts for 24-hour periods should we want to go that way.  I'm not sure we want to though because it will complicate things more than just a little bit.  I feel like just sticking to the images and parameters the script contains now would be the best way to go.  Any thoughts as we await Jerry's take on it?

100% agree. Get it back to stable state before adding anything.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #14 on: November 29, 2024, 03:13:43 PM »
A few more clues:

Set product to expected_range to get the map with snowfall ranges instead of single values.

If point_preference is set to another WFO that is on the map generated for the office parameter, you get more locations on the map that are near point_preference (and fewer near office).

I'm glad I'm not currently on the Lake Erie coast of Pennsylvania or in Watertown, NY.
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #15 on: November 29, 2024, 03:49:19 PM »
This will be a work in progress with experimentation likely!  Thanks for the tip on expected range.  I think that's a little more realistic.  With this change, we probably lose both estimated time of arrival and end time of winter precipitation but I'm not sure many people had a version with that included.  I have also not found Storm Total Ice as yet.

They always get lambasted with snow over there  :!:

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #16 on: November 29, 2024, 06:00:52 PM »
I'm running a beta version with changes that should make everything consistent from WFO to WFO. Hopefully, this is the answer but please test the heck out of it and report anything that doesn't seem right.  NOTE:  Images may load quite a bit slower than they did before.  We can't do anything about that so just be patient when you make a change.

https://mymishawakaweather.com/expsnowfalltest.php

Offline NorCal_Dan

  • Member
  • *
  • Posts: 47
    • Traveling RV Wx
Re: nwswinter script by gwwilkins
« Reply #17 on: November 30, 2024, 06:18:36 AM »
As a temporary fix you can replace inc-nwswinter.php with the script attached.

Glad I asked the question beofre making any attempt...installed the code and it appears to be working.  Thanks.  I just started running this script so I'm not familiar enough with it to be making changes so I really appreciate the help.


I'm glad I'm not currently on the Lake Erie coast of Pennsylvania or in Watertown, NY.

I'm near Jamestown at around 1350' altitude, far enough from Erie to not take a direct hit off the lake.  But yea, you better like snow to live here ;)




Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #18 on: December 01, 2024, 11:09:43 AM »
If anyone is interested, here is a new twist on this project.  This version allows you to switch between Snowfall and the Water Equivalent of the snow.  Ultimately I'd like to add back Ice Accumulation and Precipitation Onset & End timing but I haven't figured out exactly how to do that yet.

https://mymishawakaweather.com/ExpWinter1.php

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1398
  • BismarckWeather.net
    • BismarckWeather.net
Re: nwswinter script by gwwilkins
« Reply #19 on: December 01, 2024, 11:42:15 AM »
I've put the experimental one up.  On the previous version, I didn't have any pictures for the Chance sections.  But the top three were there and dated Dec 1.

After putting up the experimental one, I'm only seeing Nov 30th dates.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #20 on: December 01, 2024, 11:47:22 AM »
The newest version that corrects all that has not been released as yet. I have been waiting for Jerry to jump in as he is the one that needs to release it.

Regarding the version I just mentioned in my previous post, JJ could do this a lot more elegantly than I, should he choose to  8-)

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 998
    • LexMAWeather
Re: nwswinter script by gwwilkins
« Reply #21 on: December 01, 2024, 12:04:05 PM »
After putting up the experimental one, I'm only seeing Nov 30th dates.

I was having issues with getting new images until I added "&[large integer] to the end of the URL. It appears to work as a cache buster.

The integer I'm using is what is returned from the time() function in PHP.

E.g...

Code: [Select]
https://www.wpc.ncep.noaa.gov/Prob_Precip/idss-map/mapgen.php?office=BOX&pointpreferences=BOX&ptype=prob_sn&summary=true&product=expected_range&1733072596
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #22 on: December 01, 2024, 12:59:53 PM »
Thanks JJ.  I made that change to my testing scripts.

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2610
    • SouthEast Lincoln, NE Weather
Re: nwswinter script by gwwilkins
« Reply #23 on: December 02, 2024, 01:05:54 PM »
If anyone is interested, here is a new twist on this project.  This version allows you to switch between Snowfall and the Water Equivalent of the snow.  Ultimately I'd like to add back Ice Accumulation and Precipitation Onset & End timing but I haven't figured out exactly how to do that yet.

https://mymishawakaweather.com/ExpWinter1.php
Sorry that I've been out of the loop here since Thanksgiving.

It looks like you have solved the problem and then some, Tom and JJ!  =D> \:D/ =D>

Once you have finalized your code and have sent it to me I will be happy to put it up on my site!
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline tmabell

  • Forecaster
  • *****
  • Posts: 428
    • Mishawaka Weather
Re: nwswinter script by gwwilkins
« Reply #24 on: December 02, 2024, 01:22:51 PM »
I will leave it to Jasiu. JJ, if you would prefer to send him what you have I'm good with that.  The only thing I don't like about mine is the lack of a spinner while the images are being generated. That blank space bothers me but I don't know how to remedy it.

Edit... And there is also the missing ice accumulation chart as well as the winter precipitation onset timing and end timing images.

Another edit... Those graphics are still there but not through the precipitation potential portal that we have to use now.
« Last Edit: December 02, 2024, 03:16:41 PM by tmabell »