WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: saratogaWX on November 07, 2007, 08:33:28 PM

Title: PHP RSS for top NOAA warning display
Post by: saratogaWX on November 07, 2007, 08:33:28 PM
This script is thanks to Jim at jcweather.us (http://www.jcweather.us/) who combined a bit of my rss-advisory-test-c.php and Tom's of Carterlake.org (http://www.carterlake.org/) advisory.php script to create a new script that reads the RSS feed for Zone warnings from NOAA, caches the XML, and sorts through the output to display the most severe warning for the area (based on the following list with most intense condition at top):
 
The script works with the rss-advisory-test-c.php script to display either nothing (for no active advisories), or a color-coded box/text (styled by CSS) to display the message and a link to the page to display the details.

Thanks for the design work Jim!  I've added a few things to his script (and at his recommendation), posted the new script in the hope you might find it useful for your website too.

http://saratoga-weather.org/scripts-rss.php#topwarn

Best regards,
Ken
Title: Re: PHP RSS for top NOAA warning display
Post by: capeweather on November 10, 2007, 10:53:49 PM
Thank you sir! I installed it last night and did a little tweaking to show an image next to the output. Very cool and easy to install! You da' man Ken.
Title: Re: PHP RSS for top NOAA warning display
Post by: saratogaWX on November 10, 2007, 11:02:58 PM
Thanks Chris, and thanks to Jim at jcweather.us for the script mashup in the first place  :grin:

Best regards,
Ken
Title: Re: PHP RSS for top NOAA warning display
Post by: jmcmurry on November 11, 2007, 06:49:31 AM
Thank you sir! I installed it last night and did a little tweaking to show an image next to the output. Very cool and easy to install! You da' man Ken.

Now that's a good idea!  - Jim
Title: Re: PHP RSS for top NOAA warning display
Post by: anchorageweather on November 12, 2007, 06:03:29 AM
Thank to all who had a hand in this!!!!!!!
Title: Re: PHP RSS for top NOAA warning display
Post by: anvana on November 12, 2007, 04:18:00 PM
Thanks for the handy script, Ken.

I've also discovered that this comes in handy for those of us who are along the coast where off-shore warnings and advisories are just as important as they land-based advisories. In our area of the southeast coast, the off-shore warnings and advisories are included with the regular, land-based zone advisories (Small Craft Advisory, Gale Warning, etc.). Some areas may or may not be including these together with the land-based advisories.

Your warning script also works for marine advisories with a slight modification.

First, you'll need to get your marine zone from the NWS. Marine zones are not normally listed with the land-based zones, so you'll need to do some investigative work. I found mine several weeks ago when marine warnings were being posted for Hurricane NOEL.

If you live in a coastal area, you'll need to monitor the raw RSS feed for your land-based zone. Look for any marine advisories or warnings that might be contained in the RSS feed and make note of the marine zone. For example, mine is AMZ252

In the original warning script, simply replace the land-based zone with the marine zone you just found. Rename the script to something different than the original - say rss-maring-warning.php - and upload to your server. Include the newly-named file in the page you want the marine warnings to appear and you're good to go.

You'll also need to change the zone parameter in the rss-advisory-test-c.php XML Parser script if you're using that script in conjunction with the warning script.

There is one little gotcha: If you modify this script for marine advisories and warnings and use the original land-based script on the same page, you will get a php error. To use both on the same page you will need to make one more change to the marine version before uploading.

There are two instances where forecastfetchURLWithoutHanging is stated in the original script. You will find them on lines 118 and 224. Append this function in the marine version of your script to "forecastfetchURLWithoutHanging2" (without the quotes, of course) in both places. You can now call both scripts on the same page without getting an error.

This all depends of course whether or not your local NWS includes marine warnings and advisories in the RSS feed. Not all do, but the NWS states that they are eventually going to include them in all their RSS feeds for advisories and warnings. If yours isn't available yet, just be patient.
Title: Re: PHP RSS for top NOAA warning display
Post by: Harryca on November 12, 2007, 04:54:58 PM
This all depends of course whether or not your local NWS includes marine warnings and advisories in the RSS feed. Not all do, but the NWS states that they are eventually going to include them in all their RSS feeds for advisories and warnings. If yours isn't available yet, just be patient.

That is good news.  Thanks for the info.  I have been wondering for a long time if the marine warnings and advisories were ever going to be added to the RSS feeds.
Title: Re: PHP RSS for top NOAA warning display
Post by: saratogaWX on November 12, 2007, 05:33:20 PM
Thanks Joe for the tip on marine advisories!  I'm sure the folks along coasts (inland and marine) will find it very helpful.

Best regards,
Ken
Title: Re: PHP RSS for top NOAA warning display
Post by: Curly on November 13, 2007, 06:53:54 PM
I found this map that will zoom in on the coastal waters and show the zone number.
http://www.nws.noaa.gov/om/marine/zone/usamz.htm