cloudy

Author Topic: Cloud Height Graphic v2.1  (Read 76888 times)

0 Members and 1 Guest are viewing this topic.

Offline Meerkat

  • Rainer
  • Posts: 695
  • WD v10.37Q b31, Win 7, HP 2 Core 4GB, 72hr UPS
  • Pretoria, South Africa
    • Bashewa
Cloud Height Graphic v2.1
« on: April 12, 2009, 05:57:28 PM »
CLOUD BASE GRAPHIC - RELEASE V2.1

DESCRIPTION:
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 ADDITIONS
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).
Code: [Select]
<?php
//--- begin cloud height graphic -----------------------------------------------
      
stationAlt 0// your station altitude in meters if you want ASL (meters = ft / 3.2808399)
      
temp clientraw4];
      
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:
Code: [Select]
<?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=1
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: 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.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 $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 UTILITIES
ICAO AIRPORT CODES
METAR/TAF DECODER

ADDITIONAL SCRIPTS:
Additional scripts you might be interested in:
Gradient Thermometer
Alternate ajaxWDwx.js
Mobile / Cellphone / iPhone Safari Script

CREDITS:
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.
« Last Edit: January 16, 2011, 01:27:48 PM by Meerkat »
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline MichaelPT

  • Posts: 831
  • Staffordshire Nr Leek
    • Weather-Above
Re: Cloud Height Graphic
« Reply #1 on: April 12, 2009, 06:20:08 PM »
hi

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

mick

Offline Meerkat

  • Rainer
  • Posts: 695
  • WD v10.37Q b31, Win 7, HP 2 Core 4GB, 72hr UPS
  • Pretoria, South Africa
    • Bashewa
Re: Cloud Height Graphic
« Reply #2 on: April 12, 2009, 06:34:32 PM »
hi
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
mick

Absolutely.
You just need to upload your WD clientraw files (or VWS flash files).
Hopefully by next weekend I'll have it ready.
« Last Edit: April 12, 2009, 06:38:25 PM by Rainer »
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Online Weather Display

  • Posts: 64,502
Re: Cloud Height Graphic
« Reply #3 on: April 12, 2009, 07:27:28 PM »
I like it
a visual representation in graphical form of the major elements

your wmr200 console is looking very good too, kudos!

Offline vk2him

  • Posts: 411
  • Gerringong, NSW, Australia
    • The Shack by the Beach
Re: Cloud Height Graphic
« Reply #4 on: April 12, 2009, 09:14:27 PM »
These look excellent, looking forward to the script :-)

Cheers

Offline Rabbit66ca

  • Posts: 29
  • Cedar Hills - Surrey, BC Canada
Re: Cloud Height Graphic
« Reply #5 on: April 13, 2009, 04:23:46 PM »
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...

Offline rafid

  • Posts: 23
  • Bagnacavallo, Ravenna, ITA
Re: Cloud Height Graphic
« Reply #6 on: April 15, 2009, 08:05:58 AM »
i am ready too!, raf  :D

Offline wxflint

  • Posts: 140
  • When The Weather Gets Tough! Get With The Weather
  • Flint, Michigan
    • Flint, Michigan Live and Local weather
Re: Cloud Height Graphic
« Reply #7 on: April 15, 2009, 01:11:10 PM »
Wow they look great cant wait till this is released Nice work  :lol:

Live Local Weather http://wxflint.com

Offline mth

  • Posts: 1,438
  • Baltimore, Maryland
    • Relay, Maryland Weather Source
Re: Cloud Height Graphic
« Reply #8 on: April 15, 2009, 04:51:13 PM »
Rainer,

Wow, these look great!

Michael
Michael Holden
Relay, Maryland Weather Station
http://www.relayweather.com


Offline magical46

  • Posts: 447
    • Weybourne Weather
Re: Cloud Height Graphic
« Reply #9 on: April 15, 2009, 09:02:40 PM »
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!!)

Phil

Offline Rabbit66ca

  • Posts: 29
  • Cedar Hills - Surrey, BC Canada
Re: Cloud Height Graphic
« Reply #10 on: April 27, 2009, 06:56:12 AM »
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??

Offline Meerkat

  • Rainer
  • Posts: 695
  • WD v10.37Q b31, Win 7, HP 2 Core 4GB, 72hr UPS
  • Pretoria, South Africa
    • Bashewa
Re: Cloud Height Graphic (released)
« Reply #11 on: May 02, 2009, 05:14:56 AM »
CLOUD BASE GRAPHIC RELEASED

For downloads see begining of tread: here.

Enjoy!
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline arthurhh

  • Tokoroa Weather Live
  • Posts: 369
  • IT Fixer
  • Tokoroa South Waikato New Zealand
    • Tokoroa Weather Live
Re: Cloud Height Graphic (released)
« Reply #12 on: May 02, 2009, 07:36:07 AM »
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

Code: [Select]
// 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);

Bashy

  • Guest
Re: Cloud Height Graphic (released)
« Reply #13 on: May 02, 2009, 07:47:22 AM »
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?

http://www.northantsweather.com/cloud-base.php?uom=M&html=1

Offline gorpett

  • Posts: 57
  • Varmdo (Sweden)
    • HEASSELMARA WEATHER
Re: Cloud Height Graphic (released)
« Reply #14 on: May 02, 2009, 07:58:58 AM »
Hi Rainer

Very nice script indeed.

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

See here >  http://www.goranpettersson.se/cloud-base.php?uom=M&html=1

Regards
Göran
WD on a eeepc 1101H, Windows 7 Home Premium SP1
http://www.goranpettersson.se/wxindex.php?lang=en

 

cumulus