CLOUD BASE GRAPHIC - RELEASE V2.1DESCRIPTION:This script outputs a 100x200 graphic of the current cloud conditions as a raw jpg image stream.

o There are 11 cloud type overlays and 34 day and night backgrounds to choose from.
o The windsock has 5 positions.
o There are 28 moon phases each for North and South.
o A future enhancement would be to place the moon according to it's height in the sky and don't show it if it's not visible.
o The script is multilingual.
o Can fetch a METAR from NOAA for cloud conditions at night and/or day.
I plan to use the same script at a later stage to make dynamic icons for the ajax dashboard.
REQUIREMENTS: This script requires one of the following data files:
o Weather Display (WD) .............. clientraw.txt & clientrawextra.txt
o Virtual Weather Station (VWS) ..... wflash.txt & wflash2.txt
o Heavy Weather (WUHU) .............. currdat.lst
If you intend using it with any other language you also need the translations in your
"language-??.txt" file. See the notes at the end of the script for the required words.
Language translations requires the "common.php" script.
The following settings in "Settings.php" are used but not required.
$SITE['wxSoftware'] = 'WD'; // [ WD | VWS | WU ]
$SITE['clientrawfile'] = './clientraw.txt';
$SITE['clientrawextrafile']= './clientrawextra.txt';
$SITE['wflashdir'] = './wflash/Data/';
$SITE['metarICAO'] = 'FAJS'; // 4 letter ICAO code for METAR
$SITE['WXtags'] = './testtags.php';
GRAPHIC IMAGES REQUIRED:(included)
"./images/cb/" ........ background, cloud, windsock & scale images.
"./images/cb/moon/" ... moon images southern & northern hemisphere.
USAGE: Metric : <img src="cloudbase.php?uom=M" alt="" width="100" height="200" />
English: <img src="cloudbase.php?uom=E" alt="" width="100" height="200" />
OPTIONAL PARAMETERS:
uom= [ M | E] ....................... set units-of-measure (M)etric or (E)glish
all= [ 0 | 1 ] ...................... 1=show all elements on picture
wind= [ kts | mph | kph | km/h ] ..... set uom for wind
alti= [ ft | m ] ..................... set uom for cloud altitude
rain= [ mm | in ] .................... set uom for rain
baro= [ hPa | kPa | inHg ] ............ set uom for barometer
temp= [ C | F ] ...................... set uom for temperature
humi= [ 0 | 1 ] ...................... 1=show humidity
cond= [ 0 | 1 ] ...................... 1=show conditions
cloud=[ 0 | 1 ] ...................... 1=always show clouds when sunny or clear.
metar=[ <code> | empty ] ............. get NOAA METAR for given code. Disable if empty.
data= [ en | de ] .................... language of data files ie. clientraw.txt
lang= [ en | de | fi | nn | sv | es ] . language to use for translation
test= [ 1..5 ] ........................ use preset conditions for drawing picture
html= [ 0 | 1 ] ....................... 1=output html code for testing, 0=save picture only
PS: passing any of the above parameters will always override the internal settings.
FOR TESTING USE THE FOLLOWING:
http//www.mysite.com/cloud-base.php?uom=M&html=1 ... for current conditions
http//www.mysite.com/cloud-base.php?uom=M&html=1&test=1 ... where test=[1 to 5]
AJAX DASHBOARD ADDITIONSAdd the following to your "
ajaxWDwx.js" file into the "
ajaxLoader()" function
for updateing your cloud height on your Ajax Dashboard dynamically.
Do not include the "<?php" and "?>" when copying (it's only there for the rendering).<?php
//--- begin cloud height graphic -----------------------------------------------
stationAlt = 0; // your station altitude in meters if you want ASL (meters = ft / 3.2808399)
temp = clientraw[ 4];
dewp = clientraw[72];
pres = convertBaro(clientraw[6]);
wind = convertWind(clientraw[1]); // gust = clientraw[2]
wdir = windDirLang(clientraw[3]);
rain = convertRain(clientraw[7]);
cloudheight = Math.max(0,(temp-dewp)/0.00802)*1.0 + stationAlt; // in meters
altitude = (useunits=="E") ? Math.round(cloudheight*3.2808399) : Math.round(cloudheight);
above = (stationAlt>0)? ' ASL' : ' AGL';
cloudText = altitude.toString() + uomHeight + above;
param = '?uom=' + useUOM + '&buster=' + altitude + pres + beaufortnum + rain;
set_ajax_obs("ajaxcloudheightimg"
,'<img src="cloud-base.php' + param
+ '" alt="' + cloudText
+ '" title="' + cloudText
+ '" width="100" height="200" hspace="0" vspace="0" align="" border="0" style="" />');
//--- end cloud height graphic -------------------------------------------------
?>
The ajax tag to use for your dashboard is "
ajaxcloudheightimg".
In your "
ajaxdashboard.php" script you should tag the cloud height graphic as follows:
<?php
<span class="ajax" id="ajaxcloudheightimg">
<img src="cloud-base.php?alt=<?php echo $cloudheightmeters; ?>m" alt="" height="200" width="100" />
</span>
?>
I DON'T SEE MY CLOUD HEIGHT GRAPHIC:Have a look wheter you can see the graphic when you look at:
http://www.mysite.com/cloud-base.php?html=1If you have script errors they will show up here ... make the nessary corrections and try again.
Have a look wheter you see garbage when you look at:
http://www.mysite.com/cloud-base.php:
If you see garbage make sure you don't have spaces before the opening
<?php tag and
the after the closing
?> tag in the following files:
1) Settings.php
2) testtags.php ... testtags.txt on your computer
3) common.phpThe spaces and carriage returns affect the output of the graphic ... remove them.
VERSION HISTORY:
02 May 2009 V1.0 First release.
02 May 2009 V1.1 Fixed translation issue for non-multilingual web sites.
02 May 2009 V1.2 Added "dry" to the "clear,sunny" match string.
Added German match strings for German WD version.
03 May 2009 V1.3 Added extra parameters for overriding specific UOM's.
Added $alwaysShowCloud when conditions are sunny or clear.
Added $alwaysShowMPH if wind speed should be in MPH for metric UOM.
03 May 2009 V1.4 Added $arrowColor for cloud height marker (arrow)
03 May 2009 V1.5 Added ?all=1 parameter for showing all elements.
04 May 2009 V1.6 Fixed altitude and wind speed text overlap problem.
Added $useMetarAtNight for determinig clouds at night.
Added $onlyUseMetar for determinig clouds at all times.
Added $stationAltitude if you want to display ASL height instead of AGL.
04 May 2009 V1.7 Added $useWDHeight to always use the cloud height reported by WD.
05 May 2009 V1.8 Added language translations for de, es, fi, nn, sv.
Added OZZ METAR download from www.airservices.gov.au
Added code for WUHU software (Heavy Weather).
Fixed problem with METAR always being used in conditions.
07 May 2009 V1.9 Added $showCloudTemp to show cloud temperature.
05 Jan 2010 V2.0 Fixed problem with Moon Phase.
16 Jan 2011 V2.1 Fixed problem with Moon Phase (Thanks goes to Ken True, Ken True - Saratoga-weather.org)
ICAO AIRPORT UTILITIESICAO AIRPORT CODESMETAR/TAF DECODERADDITIONAL SCRIPTS:Additional scripts you might be interested in:
Gradient ThermometerAlternate ajaxWDwx.jsMobile / Cellphone / iPhone Safari ScriptCREDITS:Please put the following snippet into your "wxabout.php" page:Cloud height graphic courtesy of <a href="http://www.bashewa.com" title="Bronberg">Bashewa Weather</a>DOWNLOAD: cloud-base.zip (1.5mb)PS: If you use this script please let me know so I can add your site to the download page.