Author Topic: PHP RSS for top NOAA warning display  (Read 3330 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 4256
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
PHP RSS for top NOAA warning display
« on: November 07, 2007, 08:33:28 PM »
This script is thanks to Jim at jcweather.us who combined a bit of my rss-advisory-test-c.php and Tom's of 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
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline capeweather

  • Administrator
  • Forecaster
  • *****
  • Posts: 999
    • http://www.capeweather.com
Re: PHP RSS for top NOAA warning display
« Reply #1 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.

Chris
Cape Coral, Florida
Website: http://www.capeweather.com
Website: http://www.fortmyersweather.net

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 4256
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: PHP RSS for top NOAA warning display
« Reply #2 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
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 315
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: PHP RSS for top NOAA warning display
« Reply #3 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

Offline anchorageweather

  • Forecaster
  • *****
  • Posts: 445
    • http://eetee.us/station/station.php
Re: PHP RSS for top NOAA warning display
« Reply #4 on: November 12, 2007, 06:03:29 AM »
Thank to all who had a hand in this!!!!!!!
South of the Tracks, Anchorage, KY

Offline anvana

  • Senior Member
  • **
  • Posts: 98
    • http://www.topsailweather.com
Re: PHP RSS for top NOAA warning display
« Reply #5 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.

Offline Harryca

  • Forecaster
  • *****
  • Posts: 408
    • Union City, CA Weather
Re: PHP RSS for top NOAA warning display
« Reply #6 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.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 4256
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: PHP RSS for top NOAA warning display
« Reply #7 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
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Curly

  • Forecaster
  • *****
  • Posts: 586
    • Michiana Weather
Re: PHP RSS for top NOAA warning display
« Reply #8 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

 

anything