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 Saturday, 01-Mar-2008 9:22 AM

PHP for current/high/low Thermometer PNG image

This PHP script will read either Weather-Display clientraw.txt or VWS Weather Flash wflash.txt/wflash2.txt and create a PNG image of a thermometer with rounded high/low temperature lines, and a scale with ticks and values. The script will do the display in Celsius or Fahrenheit with the conversion built-in.

Fahrenheit Demo Centigrade Demo
Current temperature, daily max/min Current temperature, daily max/min

Settings

 

//------------ settings ------------------
$wxSoftware = 'WD'; // set to 'VWS' to use VWS WeatherFlash files
//
$UOM = 'F'; // set to 'C' for Celsius/Centigrade, 'F'=Fahrenheit
//
$autoScale = true; // set to false to disable autoscale.
//
// you only have to set one of these correctly based on the $useWD selection
// $wxSoftware = 'WD' : set the $clientrawfile
// $wxSoftware = 'VWS': set the $wflashDir
//
$clientrawfile = './clientraw.txt'; // relative file address for WD clientraw.txt
$wflashDir = './wflash/Data/'; // directory for the the VWS wflash.txt and wflash2.txt files
// // relative to directory location of this script (include
// // trailing '/' in the specification
//
// settings for ranges -- adjust for your climate :-)
// Fahrenheit settings
$TmaxF = 105; // maximum °F temperature on thermometer
$TminF = 25; // minimum °F temperature on thermometer
$TincrF = 5; // increment number of degrees °F for major/minor ticks on thermometer
$TMajTickF = 10; // major tick with value when °F scale number divisible by this
// Centigrade settings
$TmaxC = 40; // maximum °C temperature on thermometer
$TminC = -10; // minimum °C temperature on thermometer
$TincrC = 2; // increment number of degrees °C for major/minor ticks on thermometer
$TMajTickC = 10; // major tick with value when °C scale number divisible by this
//
$BlankGraphic = './thermometer-blank.png'; // relative file address for thermometer blank image PNG
//------------ end settings --------------

$wxSoftware
This variable controls the source of data used for the thermometer graphic.
Set to 'WD' for Weather-Display clientraw.txt
Set to 'VWS' for Virtual Weather Station Weather Flash (wflash.txt/wflash2.txt)
 
$UOM
This variable controls the unit-of-measure used for the thermometer
Set to 'F' for Fahrenheit display
Set to 'C' for Centigrade/Celsius display
May be overridden by thermometer.php?uom=f or thermometer.php?uom=c on script URL
$autoScale
This variable controls autoscaling. If 'true', then upper scale and lower scale is adjusted (if needed) to have current, minimum, maximum temperature appear on the graphic. The amount of increment is one major scale division. Default is 'true'. Set to 'false' to disable. (new with Version 1.01)
$clientrawfile
Set to the relative directory and file location of the Weather-Display clientraw.txt file. Only needed if using $wxSoftware = 'WD';
$wflashDir
Set to the relative directory location for the VWS wflash.txt, wflash2.txt files, and include the trailing '/'. Only needed if $wxSoftware = 'VWS';
$TmaxF,$TmaxC
Sets the maximum temperature scale (in °F or °C respectively)
$TminF,$TminC
Sets the minimum temperature scale (in °F or °C respectively)
$TincrF,$TincrC
Sets the increment used for tick marks on the scale (in °F or °C respectively) Default is 5°F and 2°C
$TMajTickF,$TMajTickC
Sets the major division on the temperature scale with a longer length tick and value displayed. Default is 10 degrees.
$BlankGraphic
Sets the relative file location for the thermometer template graphic. Default is ./thermometer-blank.png

Usage

To use the graphic on your site, install the thermometer.php and thermometer-blank.png files, customize the thermometer.php settings as you wish, then on the page you wish to display the thermometer graphic, just put

<img src="thermometer.php"
height="170" width="54"
alt="Current temperature, daily max/min"
title="Current temperature, daily max/min" />

Download: thermometer.zip (Version 1.03 - 28-Feb-2008)

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.