WXforum.net
Web Weather => Weather Website PHP/AJAX scripting => Topic started 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):
- Tornado Warning
- Other Warning
- Watch
- Advisory
- Special Statement
- Short Term Forecast
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
-
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.
-
Thanks Chris, and thanks to Jim at jcweather.us for the script mashup in the first place :grin:
Best regards,
Ken
-
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
-
Thank to all who had a hand in this!!!!!!!
-
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.
-
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.
-
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
-
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