deformed-offering

Weather station scripts - Widget

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, 28-Jan-2022 1:48 PM

PHP for current/high/low Thermometer PNG image

This PHP script will read Weather-Display clientraw.txt, VWS Weather Flash wflash.txt/wflash2.txt or Cumulus realtime.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
with $invertColor=true on black background
Current temperature, daily max/min Current temperature, daily max/min

Settings

 

//------------ settings ------------------
$wxSoftware = 'WD'; // 'WD' for Weather-Display, 'VWS' for Virtual Weather Station,
// 'CU' for Cumulus
//
$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
// $wxSoftware = 'CU': set the $realtimefile
//
$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
$realtimefile = './realtime.txt'; // relative file location for Cumulus realtime.txt file
//
// 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
//
$invertColor = false; // set to true if thermometer display is over black background
$BlankGraphic = './thermometer-blank.png'; // relative file address for thermometer blank image PNG
$BlankGraphicBlack = './thermometer-blank-black.png'; // for black background use
//------------ 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)
Set to 'CU' for Cumulus realtime.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';
$realtimefile
Set to the relative directory and file location of the Cumulus realtime.txt file. Only needed if using $wxSoftware = 'CU';
$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.
$invertColor
=false for normal graphic (default), =true for graphic for black background use.
$BlankGraphic
Sets the relative file location for the thermometer template graphic. Default is ./thermometer-blank.png
$BlankGraphicBlack
Sets the relative file location for the thermometer template black background graphic. Default is ./thermometer-blank-black.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.18 - 27-Jan-2022)

deformed-offering