cloudy

Author Topic: NOAA RSS Top Warning 2.0 PHP Script  (Read 12354 times)

0 Members and 1 Guest are viewing this topic.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
NOAA RSS Top Warning 2.0 PHP Script
« on: June 07, 2009, 11:31:28 PM »
NOAA RSS Top Warning 2.0 PHP Script

The script is back to being maintained by Ken True
NOAA ATOM/CAP Top Advisory Warning PHP script
http://saratoga-weather.org/scripts-atom.php#atomtopwarn

No longer BETA

Renamed to atom-advisory.php to avoid confusion and allow coexistence with
rss-advisory.php which used the RSS feeds instead of the ATOM/CAP feeds.

New in this version: - If you have one of the rss-asvisory.php or rss-top-warning.php script that is pre version 2.00  
the cache file could conflict with the other script.
If this condition is detected, the script will output: "Advisory Information Unavailable, cache file conflict, view source for details."
If you view the source you will see more details about the cause and how you can fix it (upgrade your other scripts to 2.00 or higher, or rename the $cacheName setting to something other than rss-advisory.txt).

I have modified Ken True's RSS Top Warning PHP script to a new version 2.0 that is specific to the new beta NWS Atom feeds.

What's New:
  • Modified to use the Experimental XML/CAP 1.1 Feeds (these alerts are available now and are going to be the standard rss alerts beginning in Dec. 2009. The old alerts are to be phased put.)
  • If you install this, one new thing you might notice is that when there is no active warning, it will tell you.
    "There are no active watches, warnings or advisories for zone WAZ021."
  • Three new alerts added in the sorting of the top warning: "Hazardous Weather Outlook(possible future use)", "Evacuation Immediate" and "Extreme Fire Danger".
  • New setting: $doLongTitles = true; // adds the zone name to the Alert Title for each alert.
  • New setting: $doSilentNoActive = false; // change to true to suppress "There are no active watches, warnings or advisories ...".
  • Cache file improvements - cache files are now only written to the server when there is a valid zone selected
  • Fixes for handling invalid zones - now checks both input and default zone configuration for both syntax and actual existence of the NOAA zone. If a bogus zone is offered, it does not write any cache files and then displays "Top Warning Information Unavailable, invalid advisory zone selected."
  • Better error handling for when the NOAA servers are having problems. View the HTML source for debugging comments.
  • Misc. fixes and improvements

Note:
This version requires PHP5 and is not backwards compatible with the non-beta feeds.
Your NOAA RSS Advisory PHP and RSS Top Warning scripts will require an upgrade by December of 2009 (you can start using it now if you want).

Try a demo of it on my web site:

Included style page:
http://www.642weather.com/weather/top-warning.php?zone=AKZ224 (change the zone as needed to test)

Look here to find zones that have active warnings (hint: Alaska might some active ones now, or look on a national map for an area with warnings.)
http://www.weather.gov/alerts-beta/

Download the 2.0 version:
http://saratoga-weather.org/atom-top-warning.php?sce=view

PHP carterlake template users need to update to the latest css files here:              
http://www.642weather.com/weather/scripts/css-theme-switcher.zip

Those with home brewed web sites should update the CSS located in the end of the script

--------------

If you install this, one new thing you might notice is that when there is no active warning, it will tell you.
"There are no active watches, warnings or advisories for zone WAZ021."
This is to be consistent with the way the RSS Advisory script works.

If for some reason you think it should not print that,there is a setting to turn it off.
$doSilentNoActive = false; // change to true to suppress "There are no active watches, warnings or advisories ..."


« Last Edit: September 25, 2009, 01:23:09 AM by MCHALLIS »

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #1 on: June 07, 2009, 11:44:58 PM »
This is the current order of the top warning selection as of Version 2.01 - 01-Sep-2009

1 evacuation
2 tornado
3 warning
4 watch
5 advisory
6 fire
7 statement
8 emergency
9 hazard
10 alert
11 outage
12 outlook
13 air
14 forecast

There are about 127 possible messages, so if you have multiple alerts, it may not always appear to select your best choice.
This is why I do not use the top warning script, instead I use the rss-advisory.php (if there are 4 alerts, I want all of them to be linked on my front page)
« Last Edit: September 02, 2009, 01:58:10 AM by MCHALLIS »

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #2 on: June 08, 2009, 01:24:04 AM »
If you want to be able to pass different zones on the URL to test, include it in your page like this:

Code: [Select]
if ( isset($_GET['zone']) ) {
   $DefaultZone = $_GET['zone'];
} else {
     $DefaultZone = 'WAZ021'; // set to your zone
}

 include 'rss-top-warning.php';

-----------
Look here to find zones that have active warnings
(hint: Alaska might some active ones now, or look on a national map for an area with warnings.)
http://www.weather.gov/alerts-beta/
Test changing the zone like this: index.php?zone=COZ090
« Last Edit: August 05, 2009, 06:29:52 AM by MCHALLIS »

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #3 on: June 08, 2009, 02:20:24 AM »
rss-top-warning-2009.php - V2.00 07-Jun-2008 BETA .003

Curly suggested that these two alerts would be of a value to include in the sorting of the top warning  "Evacuation Immediate" and "Extreme Fire Danger".

OK I added those, hopefully in the correct order.

abaldish

  • Guest
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #4 on: June 08, 2009, 02:39:26 AM »
Up and running here with it. No problems, Have to wait till something is issued for our area.

Offline Objector

  • Posts: 357
  • Dalton, Georgia, USA
    • Dalton Georgia Weather
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #5 on: June 08, 2009, 09:11:19 AM »
I also have it running without any known issues but also don't have anything happening in my area right now either.

Offline Zalmor

  • Posts: 550
  • Erin, NY
    • Zalmors' corner of the Web
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #6 on: June 08, 2009, 01:32:40 PM »
NOAA RSS Top Warning 2009 PHP Script (Beta)

If you install this, one new thing you might notice is that when there is no active warning, it will tell you.
"There are no active watches, warnings or advisories for zone WAZ021."
This is to be consistent with the way the RSS Advisory script works.

If for some reason you think it should not print that, let me know and I will add a setting to turn it off.

Would be nice to only show up when there are active watches, warnings or advisories.  :roll:
Michael A

Windows XP Pro SP3, Pentium D 2.80GHz 3GB RAM, Quickcam Pro 4000, and APC

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #7 on: June 08, 2009, 02:06:45 PM »
OK Zalmor

rss-top-warning.php - V2.00 08-Jun-2008 BETA .005

added feature
$doSilentNoActive = false; // change to true to suppress "There are no active watches, warnings or advisories ..." (new in ver. 2.00)                                
« Last Edit: August 05, 2009, 06:30:19 AM by MCHALLIS »

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #8 on: June 08, 2009, 03:33:24 PM »
rss-top-warning-2009.php - V2.00 08-Jun-2008 BETA .007

critical CSS fixes and HTML validation fixes

PHP carterlake template users need to update to the latest css files Version: 1.21  08-Jun-2009 here:             
http://www.642weather.com/weather/scripts/css-theme-switcher.zip

Those with home brewed web sites should update the CSS located in the end of the script

Offline Zalmor

  • Posts: 550
  • Erin, NY
    • Zalmors' corner of the Web
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #9 on: June 08, 2009, 03:55:33 PM »
rss-top-warning-2009.php - V2.00 08-Jun-2008 BETA .005

added feature
$doSilentNoActive = false; // change to true to suppress "There are no active watches, warnings or advisories ..." (new in ver. 2.00)                
Thanks  8)
Michael A

Windows XP Pro SP3, Pentium D 2.80GHz 3GB RAM, Quickcam Pro 4000, and APC

Offline BfdWx

  • Posts: 1,511
  • Branford Connecticut
    • Branford Weather
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #10 on: June 08, 2009, 10:31:52 PM »
Quote
rss-top-warning-2009.php - V2.00 08-Jun-2008 BETA .005

added feature
$doSilentNoActive = false; // change to true to suppress "There are no active watches, warnings or advisories ..." (new in ver. 2.00)               
Thanks

Me too!

Nice script Mike, thank you.

Jack

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #11 on: June 08, 2009, 10:48:54 PM »
Hey did you notice that if you have $doSilentNoActive = true;
... it will print the "There are no active ..." message in the HTML comments, that way you can look to see if it is working.


<!-- rss-top-warning.php - V2.00 08-Jun-2008 BETA .007 -->
<!-- using cached version from rss-advisory-CTZ010.txt - age=529 secs. Next fetch in 71 secs. -->
<!-- There are no active watches, warnings or advisories for zone CTZ010. -->
<!-- zone=CTZ010 -->
« Last Edit: August 05, 2009, 06:30:40 AM by MCHALLIS »

Offline BfdWx

  • Posts: 1,511
  • Branford Connecticut
    • Branford Weather
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #12 on: June 08, 2009, 10:55:30 PM »
Quote
Hey did you notice that if you have $doSilentNoActive = true;
... it will print the "There are no active ..." message in the HTML comments, that way you can look to see if it is working.

Nope didn't notice but you are right! Pretty cool!

abaldish

  • Guest
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #13 on: June 09, 2009, 02:56:10 AM »
Have just a short term forecast and everything is working great.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA RSS Top Warning 2009 PHP Script (Beta)
« Reply #14 on: June 09, 2009, 02:38:10 PM »
rss-top-warning.php - V2.00 09-Jun-2009 BETA .008

New alert added in the sorting of the top warning: "Hazardous Weather Outlook".
Thanks to Tony at cnyweather for the suggestion.


Edit: "Hazardous Weather Outlook" is not currently in the RSS feeds (OK to leave in for possible future use)
« Last Edit: August 05, 2009, 06:30:51 AM by MCHALLIS »

 

cumulus