Local Radar - KMUX - GRLevel3

Saratoga-Weather.org

Weather station scripts

They're free, but use at your own risk

The scripts in PHP and Perl referenced here are used in the operation of this weather station, and may be freely copied and used to support your station. Please note that you use these scripts at your own risk. No warranty is expressed or implied. I accept no liability for any damages that may ensue from their use.
You will need to configure them for your own particular station website.
RSS feed for Scripts Updates A RSS Feed is available to help keep you informed on updates to the scripts.

If you find one or more of the scripts useful to you, please consider making a small donation to help offset the routine expenses of operation of this website. Thanks for your kind support!

A Version History is available -- check back from time to time to see if there are updates to scripts you have downloaded earlier. Announcements of version updates and new scripts are made on WXForum.net , Weather-Watch, Ambient and Weather-Matrix forums as they become available.

This page was updated Monday, 07-Apr-2008 6:36 PM

PHP Scripts (run on webserver)

These scripts have run on PHP 4.1.2, and PHP 4.4.1. I don't have access to PHP 3.x, so it is not known if they will work on versions below PHP 4.1.2. If you try them and they work (or not) on earlier versions of PHP, please send me a message at webmaster[at]saratoga-weather.org and let me know the results.

PHP for current NEXRAD Radar station status display

This script will read (and cache for 60 seconds) the NWS WSR-88D Transmit/Receive Status page, extract the current status for a selected NEXRAD Station name, and format and display any Free Text messages associated with that station. The default for the script is to not display anything if the selected station is currently 'Green'(Active), and return a message if the station data is 'old' or has 'no data'. I'm using this on my radar page above the GRLevel3 heading to report status on Station KMUX.

Settings:

// settings:  
//  change myRadar to your local NEXRAD radar site ID.
//    other settings are optional
// 
  $myRadar = 'KMUX';   // San Francisco
//
  $noMsgIfActive = true; // set to true to suppress message when radar is active
//
  $ourTZ   = 'PST8PDT'; // timezone
  $timeFormat = 'D, d-M-Y g:ia T';
//
// boxStyle is used for <div> surrounding the output of the script .. change styling to suit.
  $boxStyle = 'style="border: dashed 1px black; background-color:#FFFFCC; margin: 5px; padding: 0 5px;"';  
//
  $cacheName = "radar-status.txt";  // used to store the file so we don't have to
//                          fetch it each time
  $refetchSeconds = 60;     // refetch every nnnn seconds
// end of settings
$myRadar
This is the 4-character NEXRAD Radar station name.
$noMsgIfActive
If set = false, then status and messages will be displayed in a box of style $boxStyle.
If set = true, then status of active will not display, and only 'problem' messages will be displayed in a box of $boxStyle.
$ourTZ
Set to your current timezone (PST8PDT, MST7MDT, CST6CDT, EST5EDT or appropriate TZ for your locale)
$timeFormat
This is the template used to format the dates displayed.
Default is 'D, d-M-Y g:ia T' which produces dates like 'Mon, 21-Jan-2008 12:29pm PST'
$boxStyle
This is the style specification for the box surrounding the output of the script. It will not be used if the $noMsgIfActive = true; and the selected NEXRAD station is 'active'.
Default is 'style="border: dashed 1px black; background-color:#FFFFCC; margin: 5px; padding: 0 5px;"'
$cacheName
This is the name of the cache file used to store the HTML page from the NWS Radar Status website. Make sure this file is writable by the PHP script.
$refetchSeconds
This specifies the lifetime for the cached page. After this number of seconds, a new page will be fetched and cached.

Usage

Include the following code in the page where you'd like the output to appear:

<?php include("radar-status.php"); ?>

Samples of the output ( With $noMsgIfActive = false: )

Active display
No Recent data
No Data

 

Download radar-status.php script (V1.03 - 07-Apr-2008) [see version history]

Version History

Weather Station Finder USA Weather Finder  ©2006-2007 Saratoga Weather.org   Privacy Statement
Radar/maps © Weather Underground. Used with permission.    Valid XHTML 1.0     Valid CSS
Never base important decisions on this or any weather information obtained from the Internet.