Cloud Height Graphic v2.1


This script outputs a 100x200 graphic of the current cloud conditions as a raw jpg image stream.[url=]

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.

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.
Metric :
English: 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 [color=red][i]PS: passing any of the above parameters will always override the internal settings.[/i][/color]
FOR TESTING USE THE FOLLOWING: http// ... for current conditions http// ... where test=[1 to 5]
Add 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).

//--- 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;
         ,'<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:

      <span class="ajax" id="ajaxcloudheightimg">
      <img src="cloud-base.php?alt=<?php echo $cloudheightmeters; ?>m" alt="" height="200" width="100" />

Have a look wheter you can see the graphic when you look at: [color=blue][/color]
If 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: [color=blue][/color]:
If you see garbage make sure you don’t have spaces before the opening <?php[/b][/color] tag and the after the closing [color=red][b]?> tag in the following files:`

  1. Settings.php
  2. testtags.phptesttags.txt on your computer
  3. common.php`
    The 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 [color=blue][i]$alwaysShowCloud[/i][/color] when conditions are sunny or clear. Added [color=blue][i]$alwaysShowMPH[/i][/color] if wind speed should be in MPH for metric UOM. 03 May 2009 V1.4 Added [color=blue][i]$arrowColor[/i][/color] for cloud height marker (arrow) 03 May 2009 V1.5 Added [color=blue][i]?all=1[/i][/color] parameter for showing all elements. 04 May 2009 V1.6 Fixed altitude and wind speed text overlap problem. Added [color=blue][i]$useMetarAtNight[/i][/color] for determinig clouds at night. Added [color=blue][i]$onlyUseMetar[/i][/color] for determinig clouds at all times. Added [color=blue][i]$stationAltitude[/i][/color] if you want to display ASL height instead of AGL. 04 May 2009 V1.7 Added [color=blue][i]$useWDHeight[/i][/color] 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 Added code for [color=red]WUHU[/color] software (Heavy Weather). Fixed problem with METAR always being used in conditions. 07 May 2009 V1.9 Added [color=blue]$showCloudTemp[/color] 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 -
[color=blue]ICAO AIRPORT CODES[/color]
[color=blue]METAR/TAF DECODER[/color]

Additional scripts you might be interested in:
[color=blue]Gradient Thermometer[/color]
[color=blue]Alternate ajaxWDwx.js[/color]
[color=blue]Mobile / Cellphone / iPhone Safari Script[/color]

Please put the following snippet into your “wxabout.php” page:
Cloud height graphic courtesy of Bashewa Weather

DOWNLOAD: [color=blue][/color] (1.5mb)

PS: If you use this script please let me know so I can add your site to the download page.


will this script worked as a standalone I do not use any templates

have you any idea when you’re have the script ready

I’m very interested


You just need to upload your WD clientraw files (or VWS flash files).
Hopefully by next weekend I’ll have it ready.

I like it
a visual representation in graphical form of the major elements

your wmr200 console is looking very good too, kudos!

These look excellent, looking forward to the script :slight_smile:


I await the release of this cool script as well… I’ve got just the right place on my dashboard to plug this right into…

i am ready too!, raf :smiley:

Wow they look great cant wait till this is released Nice work :lol:


Wow, these look great!


Wow these are impressive. You say you data from NOAA for the METAR, I am a begginer at all this but my question is will I be able to get the right data to get it working right here in the UK?

Looking forward to the script ( hope it will be easy for a complete numpty like me to install!!)


Hey… Just curious as to how this script is coming along?? Any chance of a public release in the near future, or did I miss it already??


For downloads see begining of tread: here.


Dam well done it is a very smooth and easy to configure script.

I only have one problem with showing the wind deg above the windsock.
Fatal error: Call to undefined function langtransstr() in C:\wamp\www\tok\cloud\cloud-base.php on line 641

Any suggestions

// Add wind direction text
if ($showWindDir) {
   $txtD  = langtransstr(windDEGtoDIR($winddir));
   $sizD = strlen($txtD)*imagefontwidth(3);
   imagestring ( $slate, 3, 86-round($sizD/2), 174, $txtD, $white);

Hi, thanks for the script, sadly mines giving me an error with regards to the language
side of things and i dont use and other language, just English, any ideas please?

Hi Rainer

Very nice script indeed.

But I get an error message about a “cb.jpeg” image that I can not find.

See here >


Have you perhaps got a “common.php” file in your root?
It should have a langtransstr() function in it.
I can fix it by checking for it.


[quote author=gorpett link=topic=39180.msg323772#msg323772 date=1241254738]
Hi Rainer

Very nice script indeed.

But I get an error message about a “cb.jpeg” image that I can not find.

See here >


Ok I’ll fix that one too.


The language translation problems have been fixed.
Grab the new cloud-base.php V1.1 below. (12 KB)

Thanks a lot for the great script. Works pretty.

Only that there were clouds shown but there aren’t any. How can I correct that?

I set Metar to false but nothing worked.