They're free, but use at your own risk
The scripts 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 weather station website.
A RSS Feed is available to help keep you informed on updates to the scripts.
Many of these scripts are now available on GitHub at https://github.com/ktrue
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 and
Weather-Watch forums
and saratogaWXPHP Twitter account as they become available.
Note: Twitter widget has been disabled 3-Jul-2023 since it no longer displays the recent update Tweets.
This page was updated
Wednesday, 06-Apr-2022 12:28 PM
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 = 'America/Los_Angeles'; // 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;"';
//
$cacheFileDir = './'; // default cache file directory
$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.
If used in the AJAX/PHP template, the setting will be replaced by the contents of $SITE['GR3radar'].
- $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.
If used in the AJAX/PHP template, the setting will be replaced by the contents of $SITE['showradarstatus']
- $ourTZ
- Set to your current timezone (PST8PDT, MST7MDT, CST6CDT, EST5EDT or appropriate TZ for your locale)
If used in the AJAX/PHP template, the setting will be replaced by the contents of $SITE['tz']
- $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'
If used in the AJAX/PHP template, the setting will be replaced by the contents of $SITE['timeFormat']
- $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;"'
- $cacheFileDir
- This is the relative file path to the directory used to store the $cacheName file.
The default is './' for the current directory. If used in the AJAX/PHP template, this setting will be replaced by the contents of $SITE['cacheFileDir']
- $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: )
Download radar-status.php script (V1.19- 06-Apr-2022) [see version history]
Version History
- Version 1.21 - 08-Jul-2024 - fixes for bad data from https://radar3pub.ncep.noaa.gov/
- Version 1.20 - 27-Dec-2022 - fixes for PHP 8.2
- Version 1.19 - 06-Apr-2022 - more fixes for errata with PHP 8.1
- Version 1.18 - 18-Jan-2022 - fixes for Deprecated errata with PHP 8.1
- Version 1.17 - 22-May-2020 - update to support wxnwsradar*.php scripts in Base-USA template
- Version 1.16 - 04-Feb-2018 - use https to radar3pub.ncep.noaa.gov site
- Version 1.15 - 22-Feb-2017 - use cURL for URL fetch+improved debugging info
- Version 1.14 - 24-Sep-2016 - fixes for NWS page design changes
- Version 1.13 - 03-Aug-2016 - fixes for NWS URL/page design changes
- Version 1.12 - 06-Jul-2015 - changes for updated radar status report page
- Version 1.11 - 04-Jun-2015 - changes for new radar status report page and separate ftm.txt detailed status messages fetch
- Version 1.10 - 04-Jun-2015 - changed to new URL for radar status report
- Version 1.09 - 09-May-2014 - fixes for NWS website changes
- Version 1.08 - 22-Jan-2013 - fixed deprecated split() function call
- Version 1.07 - 31-Aug-2012 - removed excess \n characters in messages and handling for chunked response
- Version 1.06 - 26-Jan-2011 - added support for $cacheFileDir global cache directory
- Version 1.05 - 03-Jul-2009 - added support for PHP5 timezone setting
- Version 1.04 - 04-Feb-2009 - fixed to handle change to NWS website
- Version 1.03 - 07-Apr-2008 - fixed $SITE['showradarstatus'] actions for true=show, false=suppress
- Version 1.02 - 25-Feb-2008 - integrate with carterlake/WD/PHP template settings control