cloudy

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

0 Members and 5 Guests 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
Re: Cloud Height Graphic (released)
« Reply #135 on: May 06, 2009, 02:56:54 PM »
Hi Rainer, Whats v2.0 about if i may ask please? Just wondering whether i should wait before i
put this one live or wait for v2.0?

You can go live with V1.8.
It's just that I'm gonna determine the cloud type and precipitation in a slightly different manner than before,
clean up the code, and make the code more easily to work with.
On the face not any changes.

EDIT: I'm getting the code ready for the dynamic conditions icon  :D
« Last Edit: May 06, 2009, 02:58:42 PM by Rainer »
Cheers,
Rainer

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

Bashy

  • Guest
Re: Cloud Height Graphic (released)
« Reply #136 on: May 06, 2009, 02:58:31 PM »
Ok Rainer, thanks, now to slot it in somewhere obtrusively :)

Bashy

  • Guest
Re: Cloud Height Graphic (released)
« Reply #137 on: May 06, 2009, 04:01:13 PM »
Hi again Rainer

I am using the AJAX DASHBOARD ADDITIONS as shown in the 1st page of this thread
but it dont seem to keep up with the conditions on my dashboard, the wind speed is never
the same


When i added it to the ajaxWDwx file I left out the php tags but only because non of
the other functions in there had them

for example

Code: [Select]
//Windspeed ...
wind = convertWind(clientraw[2]);
beaufortnum = ajax_get_beaufort_number(clientraw[2]);
set_ajax_obs("ajaxbeaufortnum",beaufortnum);
set_ajax_obs("ajaxbeaufort",langBeaufort[beaufortnum]);

Code: [Select]
//Pressure...
pressure = convertBaro(clientraw[6]);
set_ajax_obs("ajaxbaro",pressure.toFixed(dpBaro) + uomBaro);
pressuretrend = convertBaro(clientraw[50]);
pressuretrend = pressuretrend.toFixed(dpBaro+1);
if (pressuretrend > 0.0) {pressuretrend = '+' + pressuretrend; } // add '+' to rate
set_ajax_obs("ajaxbarotrend",pressuretrend + uomBaro);
set_ajax_obs("ajaxbaroarrow",
   ajax_genarrow(pressure, pressure-pressuretrend, '',
langBaroRising+uomBaro+langBaroPerHour,
langBaroFalling+uomBaro+langBaroPerHour,2)
);

set_ajax_obs("ajaxbarotrendtext",ajax_get_barotrend(clientraw[50]));

pressuremin = convertBaro(clientraw[132]);
set_ajax_obs("ajaxbaromin",pressuremin.toFixed(dpBaro) + uomBaro);
pressuremax = convertBaro(clientraw[131]);
set_ajax_obs("ajaxbaromax",pressuremax.toFixed(dpBaro) + uomBaro);

Your code but with out the <?php and at the end ?> do i really need to included them in the ajax file?

Code: [Select]
// Cloud Height
   stationAlt = 0; // your station altitude in meters if you want ASL (meters = ft / 3.2808399)
   temp = clientraw[ 4];
   dewp = clientraw[72];
   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=' + useunits + '&alt=' + altitude + '&alti=' + uomHeight + '&wind=' + uomWind;
   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="" />');

Also to include it in the dashboard i had to leave out the  <?php and the ?> again cause it killed the whole thing lol
« Last Edit: May 06, 2009, 04:18:42 PM by Bashy »

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 #138 on: May 06, 2009, 04:54:00 PM »
Made some changes to the METAR DECODER
Now also displays the time for your timezone from where you are in the world.
Cheers,
Rainer

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

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 #139 on: May 06, 2009, 05:07:21 PM »
When i added it to the ajaxWDwx file I left out the php tags but only because non of
the other functions in there had them ....

Yes you need to exclude the "<?php" and "?>" tags.
I only put them in for the rendering effect.

Replace these lines with the new code in your "ajaxWDwx.js" file:
Code: [Select]
   // cloud height
   cloudheight = clientraw[73];
   set_ajax_obs("ajaxcloudheight",convertHeight(cloudheight) + uomHeight);
Not that it should make any difference.

However if there is a javascript error somewhere in the ajaxloader() function
Firefox does not seem to throw an exception in the Javascript Error Console.
Therefore you'll have to check visually for javascript errors.
The ajaxloader() then also stops processing any further tags down the line.

I'll check the code tomorrow again.


Cheers,
Rainer

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

Bashy

  • Guest
Re: Cloud Height Graphic (released)
« Reply #140 on: May 06, 2009, 05:19:08 PM »
Hi Rainer, thanks

I just thought, the ajax code is purely for the cloud height?

What would be cool is, if the whole lot can be ajax just like the wind rose image,

what i mean is, is there a way to make this
http://www.northantsweather.com/cloud-base.php?uom=M
refresh automatically using ajax, i misunderstood the ajax part and assumed all the
data on the image updated, but this aint the case, but if you refresh that image in
that link it updates as often as the clientraw updates (3 seconds for me) so if the
full image could be ajaxed that would be great, it also would be easier to have the
whole shabang as ajax opposed to having to add each data set, such as wind, temp
cloud height and so on into the ajaxWDwx file, just adding the image itself would be
easier, just an idea is all, that way all the data on the image would update?

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 #141 on: May 06, 2009, 05:27:30 PM »
Hi Rainer, thanks

I just thought, the ajax code is purely for the cloud height?

What would be cool is, if the whole lot can be ajax just like the wind rose image,

what i mean is, is there a way to make this
http://www.northantsweather.com/cloud-base.php?uom=M
refresh automatically using ajax, i misunderstood the ajax part and assumed all the
data on the image updated, but this aint the case, but if you refresh that image in
that link it updates as often as the clientraw updates (3 seconds for me) so if the
full image could be ajaxed that would be great, it also would be easier to have the
whole shabang as ajax opposed to having to add each data set, such as wind, temp
cloud height and so on into the ajaxWDwx file, just adding the image itself would be
easier, just an idea is all, that way all the data on the image would update?

Hi Bashy,
Forgot about that one ... it's currently only changing if the altitude changes.
Replace this line in my code:
Code: [Select]
param = '?uom=' + useunits + '&alt=' + altitude + '&alti=' + uomHeight + '&wind=' + uomWind + '&buster=' + temp + dewp + wind + pressure;

Then it should change if any of the variables change.
Cheers,
Rainer

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

Bashy

  • Guest
Re: Cloud Height Graphic (released)
« Reply #142 on: May 06, 2009, 05:32:14 PM »
Hi Rainer

Thanks for the fix, dont suppose you can point to which code to replace could you, i cannot
see where to replace it, sorry... :oops:

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 #143 on: May 06, 2009, 05:40:44 PM »
Hi Rainer

Thanks for the fix, dont suppose you can point to which code to replace could you, i cannot
see where to replace it, sorry... :oops:

Hi Bashy,
Grab the code from the front page again ... I've updated the javascript snippet.
« Last Edit: May 06, 2009, 05:43:15 PM by Rainer »
Cheers,
Rainer

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

Offline Rabbit66ca

  • Posts: 29
  • Cedar Hills - Surrey, BC Canada
Re: Cloud Height Graphic (released)
« Reply #144 on: May 06, 2009, 05:51:17 PM »
Darn....   that fix broke my ajaxWDwx   :(

If I comment out past &buster then things work again....

Bashy

  • Guest
Re: Cloud Height Graphic (released)
« Reply #145 on: May 06, 2009, 05:53:01 PM »
Yeah, same here, i was just refreshing the page to make sure and it is broken now

Offline magical46

  • Posts: 448
    • Weybourne Weather
Re: Cloud Height Graphic (released)
« Reply #146 on: May 06, 2009, 10:25:20 PM »
Quote
You must have write permission in your root folder (or the folder in which cloud-base.php runs).
The ?html=1 function needs to output the graphic (cb.jpeg) to your disk whereas the normal
procedure  feeds it as a stream to the browser. This here works fine without the ?html=1 ...
http://www.weybourneweather.co.uk/cloud-base.php?uom=M

Also if you use the METAR it needs to save this to the disk as well (eg. metar-FAJS.txt).
I have moved the files to a seperate directory on the server but now I get this

http://www.weybourneweather.co.uk/cloud%20graphic/cloud-base.php?uom=M&html=1&test=1
http://www.weybourneweather.co.uk/cloud%20graphic/cloud-base.php?uom=M&html=1

I am not using METAR

Phil

Offline Rabbit66ca

  • Posts: 29
  • Cedar Hills - Surrey, BC Canada
Re: Cloud Height Graphic (released)
« Reply #147 on: May 07, 2009, 02:47:09 AM »
I have moved the files to a seperate directory on the server but now I get this

http://www.weybourneweather.co.uk/cloud%20graphic/cloud-base.php?uom=M&html=1&test=1
http://www.weybourneweather.co.uk/cloud%20graphic/cloud-base.php?uom=M&html=1

I am not using METAR

Phil

The script can't find your clientraw files because you forgot to edit a couple of things...

You have
Code: [Select]
// The below will be overridden by Settings.php if it's available
$clientraw   = './clientraw.txt';      // relative file address for WD clientraw.txt
$clientextra = './clientrawextra.txt'; // relative file address for WD clientrawextra.txt
$wflashDir   = './wflash/Data/';       // directory for the the VWS wflash.txt and wflash2.txt files (with trailing slash)

$WXtags      = './testtags.php';       // optional ...not required (overridden if specified in Settings.php)
and I'll bet your clientraw*.txt and testtags.php files are in your root folder....

Just change to
Code: [Select]
// The below will be overridden by Settings.php if it's available
$clientraw   = '../clientraw.txt';      // relative file address for WD clientraw.txt
$clientextra = '../clientrawextra.txt'; // relative file address for WD clientrawextra.txt
$wflashDir   = '../wflash/Data/';       // directory for the the VWS wflash.txt and wflash2.txt files (with trailing slash)

$WXtags      = '../testtags.php';       // optional ...not required (overridden if specified in Settings.php)

and it should all be good...  Note the double ..

Offline magical46

  • Posts: 448
    • Weybourne Weather
Re: Cloud Height Graphic (released)
« Reply #148 on: May 07, 2009, 08:20:10 AM »
Ok I have made the changes as per above message but now I'm back to having no image

http://www.weybourneweather.co.uk/cloud%20graphic/cloud-base.php?uom=M&html=1

Being a complete numpty when comes to all this I have no idea how to do what the following two quotes suggest

Quote
You must have write permission in your root folder (or the folder in which cloud-base.php runs).
The ?html=1 function needs to output the graphic (cb.jpeg) to your disk whereas the normal
procedure  feeds it as a stream to the browser. This here works fine without the ?html=1 ...

Quote
Yes the permissions are set wrong or the file does not exist
touch cb.jpeg
you may have to chmod the file

Any help for a bafled novice much appreciated

Phil

Bashy

  • Guest
Re: Cloud Height Graphic (released)
« Reply #149 on: May 07, 2009, 09:31:23 AM »
Hi folks

Does anyone know an easy way to change the wind speed from average to gust please?