Author Topic: Unified Script to Display Select NOAA-NWS Forecast Office Text Products  (Read 7272 times)

0 Members and 1 Guest are viewing this topic.

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
With Tom at My Mishawaka Weather's assistance I've combined a number of selected NOAA-NWS Forecast Office Text Products into one script.  The script includes Forecast Discussions, Public Information Statements, Hazardous Weather Outlooks, etc.

No attempt has been made to include more than the latest of any of these text products because the link at the bottom of each page will display the relevant page where old products are available.

The settings are few:
Code: [Select]
/******************************* Settings *********************************/
$divWidth = 656; // Narrow style width
// Enter Default Station
$wfo = "OAX";
$product = 'HWO'; // Default NWS Product to display
/* These are the products available in this script
    "AFD" - Forecast Discussion
    "CF6" - WFO Monthly Preliminary Report
    "FFS" - Flash Flood Statement
    "FLW" - Flood Warning
    "HWO" - Hazardous Weather Outlook
    "HYD" - Daily Hydrometeorology
    "LSR" - Local Storm Report
    "MAP" - Mean Areal Precipitation
    "NOW" - Short Term Forecast
    "NPW" - Non-Precip. Wrn./Wtch./Adv.
    "PNS" - Public Information Statement
    "REC" - Recreational Forecast
    "RWS" - Regional Weather Summary
    "WSW" - Winter Storm Wrn./Wtch./Adv."
*/
// Enter the path to the map file. Un-comment only 1 line out of the 2 lines below.
// $mappath = './';            // map is in the same folder as this file
$mapPath = './images/';  // map is in the images folder. Change images  to the folder where the map is located
$leftMargin = 60; // Set left margin of text output here
/***************************** End Settings *******************************/

The '$leftMargin' parameter affects only the text product appearance, and enables fine-tuning the display to your taste.  I just didn't like the text crowded up on the left with no margin, so this solves that problem.

The map and the option list are both functional, and the option list defaults to the current selection.  This makes it easier to use the option list to select nearby WFO's rather than always scrolling from the top of the list.

Version 1, while functional, omitted the $mapPath and $leftMargin Settings.

Naturally, product availability varies with seasons, forecast office, and weather.

I should warn you that the products are cached, each product seen for each site visited.  Once in a while a cleanup of old cache files in your cache directory (set to './cache/' if not in a template - see line 580 in 'inc-show-wfo-products.php' V2c) would be advisable.

Edit 2016 March 16 & 17:  Tulsa, OK was omitted in versions prior to Version 2d.  Version 2c contained a couple more bugs.  If you use this script please update to Version 2d.
« Last Edit: March 17, 2016, 01:42:46 PM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 153
    • MikeyM's Thornhurst PA Weather
Another nice script Jerry Thanks

For some reason not all the weather offices will show up on the clickable map - ie Binghamton NY and State College PA aren't clickable, but Pittsburgh PA is - any ideas?

Thanks

Cheers

MikeyM

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Another nice script Jerry Thanks

For some reason not all the weather offices will show up on the clickable map - ie Binghamton NY and State College PA aren't clickable, but Pittsburgh PA is - any ideas?

Thanks

Cheers

MikeyM
The map coordinate polygons loaded from your site's 'inc-wfo-show-products.php' are incomplete when compared with mine, i.e. many, many are missing.  Try saving mine (CTRL-s) without the '.txt' and then re-upload 'inc-show-wfo-products.php' again.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 153
    • MikeyM's Thornhurst PA Weather
Jerry

Thanks that was a quick fix. I'm not sure why the "inc" didn't have all the map coordinates  :?


Thanks again for another very nice script.   =D>

Cheers

 :grin:

MikeyM

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Jerry, thanks for yet another good script. But... mine's not happy with PSR as the default wfo setting. Always displays Omaha (but I can select Phoenix from the dropdown).

Thanks.
John
W7JKG

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Very fine script, easy to integrate. Two small changes for the next version:

Line 45/46 in wxnoaaproductsV2.php are not needed and should be commented / removed.
For stand-alone use = non-Saratoga environments, they result in a 500 error.
For Saratoga the same lines are also at 64/65.

The $mapPath setting in line 100/101 in wxnoaaproductsV2.php has no effect as it is replaced by line 24 in inc-show-wfo-products.php.
So stand-alone users should comment that line also.
===
I added the script inside an iframe and looks fine to me. http://weather-template.nl/weather28/?p=ws_wfo&lang=en&wp=WS 
Do not look at colors and backgrounds , it is a demo site.

Wim

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
John, I think your problem may have been caused by the debugging code at the start of the includes script.  If the revisions to the attached V2b doesn't solve the problem, I've included instructions to comment out this debugging code in 'inc-show-wfo-products.php' by removing one slash.  This debugging code may also have caused some confusion for you, Wim.

I must confess I never tested the Stand Alone code, Wim. :oops:  You're absolutely right about those two lines at 45/46.  They have been removed in Version 2a attached.  There was also a problem with the centering of the NWS link at the bottom of the Stand Alone page, and this has been corrected as well. 

I've omitted the display of previous versions of these NWS products because of frequent redundant entries that differ only by time posted.  These are easily accessed by using the NWS link at the bottom of the page.  I've also included a hint about the best way to view these past versions.

Edit 2016 March 16:  Tulsa, OK was omitted in versions prior to Version 2c which still contained a couple of bugs.  Version 2d fixes those bugs as well.
« Last Edit: March 17, 2016, 01:44:48 PM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 153
    • MikeyM's Thornhurst PA Weather
Jerry

Thanks for the update (V2b)!

Great script!

Cheers

 :grin:

MikeyM

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
And we have another error in the script.  I somehow omitted Tulsa, OK from the list of WFO's.  Version 2c corrected this problem, but Version 2d corrects a couple of other bugs.

If you use this script, I would urge you to update to Version 2d.
« Last Edit: March 17, 2016, 01:46:28 PM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 724
    • Lake Huron Weather
Nice job on this Jerry, I like this comprehensive approach.
Thanks for your continued efforts and contributions.

CW3699

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #10 on: March 16, 2016, 05:14:07 PM »
2c up and working.

Thanks, Jerry.
John
W7JKG

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 325
    • Indian Trail Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #11 on: March 17, 2016, 10:30:15 AM »
Hi Jerry,

Another very nice script. One problem that I have is the WFO keeps defaulting to Omaha. I've set mine to "ALY". It must be a Peyton Manning thing.

http://indiantrailweather.com/wxnoaaproducts.php

Great job ...  =D>

Jeff
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 153
    • MikeyM's Thornhurst PA Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #12 on: March 17, 2016, 10:35:27 AM »
HI Jeff

You have to set "ALY" both in the wxnoaaproducts.php" and the "inc" script. Found that the hard why myself hee hee

Cheers

 :grin:

MikeyM

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 325
    • Indian Trail Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #13 on: March 17, 2016, 10:42:55 AM »
Duh ............ Good morning Mike ! I missed that one.  :oops:    Thanks.  \:D/    It's a sunny day in Hessville ...

Have a nice day.

Jeff
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #14 on: March 17, 2016, 10:45:32 AM »
You really only need to set it on line 79 in 'Settings' in 'wxnoaaproducts.php' because the '$wfo' setting in 'inc-show-wfo-products.php' line 23 is only used for debugging when 'inc-show-wfo-products.php' is run alone in which case neither '$wfo' nor '$product' will be set by '$_POST...' or on 'wxnoaaproducts.php' script startup.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 325
    • Indian Trail Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #15 on: March 17, 2016, 10:52:47 AM »
Jerry, thanks for the clarification and explanation ... 

 :-)

Jeff
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 153
    • MikeyM's Thornhurst PA Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #16 on: March 17, 2016, 10:57:53 AM »
Thanks Jerry

MikeyM

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #17 on: March 17, 2016, 11:24:34 AM »
Jerry any idea why map doesn't show? http://www.valentinenebraska.net/wxnoaaproducts.php
Randy

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #18 on: March 17, 2016, 11:29:25 AM »
Jerry any idea why map doesn't show? http://www.valentinenebraska.net/wxnoaaproducts.php
It is looking for the map in   http://www.valentinenebraska.net/images/cwa2.png
But the response is: Failed to load resource: the server responded with a status of 404 (Not Found)
The map is in http://www.valentinenebraska.net/cwa2.png
So either move the map to that folder are adept the setting in wxnoaaproducts.php
Code: [Select]
$mapPath = './';  // map is in the images folder. Change  images  to the folder where the map is locatedWim

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #19 on: March 17, 2016, 11:32:28 AM »
Thank you.
Randy

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #20 on: March 17, 2016, 11:47:57 AM »
Jerry thanks for the script.
Randy

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #21 on: March 17, 2016, 12:19:09 PM »
You really only need to set it on line 79 in 'Settings' in 'wxnoaaproducts.php' because the '$wfo' setting in 'inc-show-wfo-products.php' line 23 is only used for debugging when 'inc-show-wfo-products.php' is run alone in which case neither '$wfo' nor '$product' will be set by '$_POST...' or on 'wxnoaaproducts.php' script startup.
Jerry, with all due respect (honest!), I have found if it's not set in both scripts it (at least mine) will not show what I want as the default, in my case PSR.
John
W7JKG

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #22 on: March 17, 2016, 12:32:01 PM »
I had to set mine in both places also. No biggie, easy enough it wanted to use Omaha otherwise.
Randy

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 724
    • Lake Huron Weather
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #23 on: March 17, 2016, 12:42:38 PM »
Me too, had to set in both places - no big deal.

CW3699

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Unified Script to Display Select NOAA-NWS Forecast Office Text Products
« Reply #24 on: March 17, 2016, 12:46:24 PM »
Agreed, no big deal. Just had to get my 2¢ in...   :grin:
John
W7JKG

 

anything