deformed-offering

Weather station scripts

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.
RSS feed for Scripts Updates 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

Buy Me A Coffee If you find one or more of the scripts useful to you, please consider making a 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 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 Friday, 04-Mar-2016 5:18 PM

GRLevel3 Radar Image Display PHP/JavaScript animation

GRLevel3 is a Windows® viewer for live NEXRAD Level III data from the USA NOAA NWS Radar Product Central Collection Dissemination Service. It will upload a series of radar images to your weather website.
This script allows viewers to see all the current images published by your GRLevel3 software as either single images or as JavaScript animations.

Radar Type

  [10/10
GRLevel3 radar from NWS station KMUX

The above image was produced by GRLevel3 software using NEXRAD Radar data from station KMUX.

 

Settings in the GR3-radar-inc.php script

// settings ----------------------------- 
###########################################################################
# GRLevel3 Radar image settings
$GR3radar	= 'kmux';	// set to lower-case full name of NEXRAD radar site (ICAO)
$GR3DIR		= '/GR3'; 	// set to directory for GRLevel3 images (or '/' for root directory
$GR3type	= 'cr';		// default radar image type 'cr','br','cr248','br1' etc.
$GR3img		= 'jpg';	// GR3 image type 'jpg' or 'png'
$GR3cnt		= 10;		// number of images in series 10=(_0 ... _9 in name of file)
$GR3width	= 512;		// width of GR3 images
$GR3height  = 512;		// height of GR3 images
$GR3maxAge =  1200;  // image_0 has to be less than 20 minutes old for consideration
$GR3notAvailMsg = 'GRLevel3 radar images are not available at this time.';
$GR3notCurrentMsg = 'GRLevel3 radar image is not current - more than %s seconds old.';  
###########################################################################
// end of settings
$GR3radar
This setting must be the lower-case full name (ICAO) of the NEXRAD radar site. It is used as the first parameter in the GRLevel3 file name [GR3radar]_[type]_[number].[GR3img]
$GR3DIR
This specifies the location of your GRLevel3 image directory starting from the webserver's document root directory. If you have GRLevel3 upload to your document root directory, then set $GR3DIR = '/';
$GR3type
This specifies your prefered starting radar image type to display when the script is first launched. If a current image of this type is not found, then the first available image will be loaded instead.
$GR3img
This specifies the extension for the image file uploaded by GRLevel3. Valid settings are:
PNG: $GR3img = 'png';
JPG: $GR3img = 'jpg';
$GR3cnt
This specifies the number of image files in the sequence uploaded for each radar image type.
$GR3cnt = 10; means there are images from
[GR3radar]_[type]_0.[GR3img] (most recent) to
[GR3radar]_[type]_9.[GR3img] (oldest) available.
$GR3width
This specifies the width in pixels of the image files uploaded by GRLevel3.
$GR3height
This specifies the height in pixels of the image files uploaded by GRLevel3.
$GR3maxAge
This specifies the maximum 'age' of the most recent file for each radar image type. The default is 1200 seconds (20 minutes) -- files older than this value will not be offered for display.
$GR3notAvailMsg
This message will be presented if no current GRLevel3 images are found.
$GR3notCurrentMsg
This message will be displayed in HTML comments on the page when the image file is more than [GR3maxAge] seconds old.

Properly configured, the script will locate all the [GR3radar]_[*]_0.[GR3img] files in the [GR3DIR] and dynamically build a selection list based on availability of the radar type and on whether the file is current or older than [GR3maxAge] seconds. The radar types remaining are placed in the dropdown selection list, and if your [GR3type] default image is available, it will be displayed on the page.

The script is also JavaScript aware, and if the JavaScript is disabled on the browser, then the animation controls are replaced by a single "Display" button and a small note saying "[Enable JavaScript to display animation.]. The selection control still works without JavaScript, but the user will have to click on the Display button to make a change.

If no current images are found, then the message in [GR3notAvailMsg] is displayed on the browser.

Installation of GR3-radar-inc.php

Download GR3-radar-inc.php from the link below.

Change settings in GR3-radar-inc.php as instructed in the settings area above.

Make sure your GRLevel3 V1.x is publishing a sequence of images and including the radar site ID in the filename as shown in this screenshot of the File, Web Publishing, Start dialog box.

GRLevel3 Setup

For GRLevel3 V2.x, the dialog is a bit different, but the Include Site Id and Create Sequence should both be ticked. The File, Publishing, Start dialog box looks like this:

GRLevel3 V2 Web Publishing

The FTP upload is now specified as an URL of the format ftp://username:password@yourwebsite.com/path. Replace "username", "password", "yourwebsite.com", and "path" with the specifics for your weather website. Be sure to tick the products you wish to publish to your website. The BR 0.5 and CR products would be uploaded in the example above.

Add the following code to a PHP page on your website where you'd like the GR3 Radar images and controls to appear:

    <div align="center">
<?php include("GR3-radar-inc.php"); ?>
</div>

Download: GR3-radar-inc.php (Version 1.05 -12-Aug-2015)

For folks who prefer to not include the Radar ID (ICAO) in the images, you can use the optional
GR3-radar-floater-inc.php script to display the images with names like 'br1_0.jpg, cr_0.jpg, vil_0.jpg etc.). It uses the same setup (minus the $GR3radar variable), and in the figure above, untick the 'Include Site ID' to generate the 'floater radar' images.

Download: GR3-radar-floater-inc.php (Version 1.05 -12-Aug-2015)

Version History

  • Version 1.04 - 04-Jun-2012 - added support for GRLevel3 V2.xx Dual Polarization product displays
  • Version 1.03 - 23-Dec-2008 - added support for Digital Total Rain display
  • Version 1.02 - 21-Jul-2008 - added fix for XHTML validation (via JavaScript insert)
  • Version 1.01 - 15-Mar-2008 - added logic to find web document root on IIS servers
  • Version 1.00 - 07-Mar-2008 - Initial Release

Acknowledgements and thanks

  • Thanks to Tim Hanko at Walker, MI Weather for his sharing of his radar image selection code which forms the basis for this script.
deformed-offering