Page 1 of 1
idea for new option
Posted: Mon 30 Nov 2009 2:37 am
by n9mfk
Hi Steve,
under internet settings files tab
could ad a check boxes for us an metric unit
so you have a choice if you wanted a file in metric were all tags wood use c mm knots an hpa
beau
Re: idea for new option
Posted: Mon 30 Nov 2009 4:11 am
by beteljuice
But non-US wind speed could be Knots, Miles Per Hour, Metres Per Sec or Kilometres Per Hour.
I assume you want to be able to upload multiple different 'standards' pages ?
Re: idea for new option
Posted: Mon 30 Nov 2009 2:22 pm
by n9mfk
Hi beteljuice,
yes that is what i went to do
beau
Re: idea for new option
Posted: Mon 30 Nov 2009 2:43 pm
by steve
I think a solution like the beteljuice's multi-language pages would be good here

Re: idea for new option
Posted: Tue 01 Dec 2009 3:42 am
by gemini06720
steve wrote:I think a solution like the beteljuice's multi-language pages would be good here

Steve, indeed, but that involves a template written in PHP where any kind of format can be converted to any kind of format ... such as the following conversion functions:
// Convert temperatures [°C | °F]
function convFtoC($value) { return (($value-32) / 1.8); }
function convCtoF($value) { return (($value * 1.8)+32); }
// Convert pressure [ mb | hPa | kPa | inHg ] 0.0295333727
function convINHGtoHPA($value) { return ($value / 0.0295333727); }
function convHPAtoINHG($value) { return ($value * 0.0295333727); }
function convHPAtoKPA ($value) { return ($value * 0.1); }
function convHPAtoMB ($value) { return ($value); }
// Convert depths [mm | inch)
function convINtoMM($value) { return ($value / 0.0393700787); }
function convMMtoIN($value) { return ($value * 0.0393700787); }
// Convert depths [cm | inch]
function convINtoCM($value) { return ($value / 0.393700787); }
function convCMtoIN($value) { return ($value * 0.393700787); }
// Convert heights [ft | m]
function convFTtoM($value) { return ($value / 3.2808399); }
function convMtoFT($value) { return ($value * 3.2808399); }
// Convert wind speeds [ kts | kmh | mph | m/s | beaufort]
function convMPHtoKTS($value) { return ($value / 1.15077945); }
function convKTStoMPH($value) { return ($value * 1.15077945); }
function convKTStoKMH($value) { return ($value * 1.852 ); }
function convKTStoMPS($value) { return ($value * 0.51444444); }
function convKTStoBFT( $spd ) {
switch (true) {
case ($spd < 1): $val= 0; break; // Calm
case ($spd < 4): $val= 1; break; // Light air
case ($spd < 7): $val= 2; break; // Light breeze
case ($spd < 11): $val= 3; break; // Gentle breeze
case ($spd < 17): $val= 4; break; // Moderate breeze
case ($spd < 22): $val= 5; break; // Fresh breeze
case ($spd < 28): $val= 6; break; // Strong breeze
case ($spd < 34): $val= 7; break; // Near gale
case ($spd < 41): $val= 8; break; // Gale
case ($spd < 48): $val= 9; break; // Strong gale
case ($spd < 56): $val=10; break; // Storm
case ($spd < 64): $val=11; break; // Violent storm
case ($spd >=64): $val=12; break; // Hurricane
}
return $val;
}
So, something as the following could probably be used (I have not tried it yet but will later on):
...
<tr class="td_temperature_data">
<td>Temperature</td>
<td><?php convFtoC(<#temp>); ?> <#tempunit></td>
<td>Dew Point </td>
<td><?php convFtoC(<#dew>); ?> <#tempunit></td>
</tr>
...
In the above example, the PHP function 'convFtoC' would convert from F to C...
I will have to look further in my
other software templates as there are functions that take any of the value to be converted and convert them to any other value, such as sending a C value to that function and it will return an F value...
Re: idea for new option
Posted: Tue 01 Dec 2009 8:52 am
by steve
gemini06720 wrote:Steve, indeed, but that involves a template written in PHP where any kind of format can be converted to any kind of format ... such as the following conversion functions:
Ah, sorry, I thought they were HTML + Javascript.
Re: idea for new option
Posted: Tue 01 Dec 2009 10:21 am
by gemini06720
steve wrote:Ah, sorry, I thought they were HTML + Javascript.
Do not be sorry, 'beteljuice' templates are 'HTML + JavaScript'.
But I was offering another option of adding a bit of PHP coding into an HTML template...

Re: idea for new option
Posted: Tue 01 Dec 2009 10:48 am
by beteljuice
The philosophy is much same
Except of course your 'library' is incomplete.
It only has 'native' speed conversions for mph and knots.
It does NOT require kts => beaufort (Cumulus already provides F#)
There appears to be a function missing, to put the required decimal point values.
I've stopped 'messing' atm as the strings.ini file 'builds', but anyone using the beteljuice_ajax already has all possible units available to them. But I leave it to their imagination as how to present those values.
Re: idea for new option
Posted: Tue 01 Dec 2009 1:44 pm
by gemini06720
Beau,
I have made some modifications to my Cumulus PHP Weather (main page only) where the temperature, the rain, the wind and the pressure are displayed in both formats (metric in large fonts and imperial in small fonts).
Here is the link: [link removed]
If that is what you want, the code I have used in my PHP template can surely be incorporated into the HTML template...
beteljuice,
...Except of course your 'library' is incomplete...
Indeed, I quickly copied and pasted some of the code I found in one of my older function template - the new and improved template contains more conversion code as well as precision (number of decimals) code...

Re: idea for new option
Posted: Tue 01 Dec 2009 10:57 pm
by n9mfk
ray how do you do this
Moon Phase: Full Moon - 15 days, 3 hours, 26 minutes in its cycle - 100% illuminated
Thanks Beau
Re: idea for new option
Posted: Tue 01 Dec 2009 11:56 pm
by gemini06720
n9mfk wrote:ray how do you do this
Moon Phase: Full Moon - 15 days, 3 hours, 26 minutes in its cycle - 100% illuminated
The moon phase thing...
It is a PHP function that has been added to my functions template - it continuously calculate the phase of the moon (in the case of my Cumulus PHP template, every time the page is refreshed - in the case of my Weather Display Ajax-PHP templates, every 5 seconds). I am not going to post the PHP code here as it is way too long (and wide). But, please be advised that I do not think I could easily add that code to the Cumulus HTML templates.
Beau, the way I display both the metric and imperial values (for the temperature, the rain, the wind and the pressure), is that what you were looking for or are you looking for a button that will change every values on the page from one system to another?
Re: idea for new option
Posted: Wed 02 Dec 2009 1:25 am
by n9mfk
Ray is that done by cumulus ?
Re: idea for new option
Posted: Wed 02 Dec 2009 1:37 am
by gemini06720
Ray is that done by wd or cumulus ?
Beau, what?
The Web page you looked at (the one I posted the link to) is using data from Cumulus to produce it weather information.
The moon phase information is not relying on Cumulus at all (nor on the other 'I will not name' software

) - the moon phase is being continuously calculate using using PHP coding/function from properly entered latitude and longitude coordinates.
On my main weather pages (the one produced by the 'I will not name' software), the moon phase is also calculated by a JavaScript making the resulting display accurate to 5 seconds (when the JavaScript automatically updates the pages).
Re: idea for new option
Posted: Wed 02 Dec 2009 1:55 am
by n9mfk
Hi i like to get more moon info on my site if you can help pm me thanks beau
Re: idea for new option
Posted: Wed 02 Dec 2009 2:16 am
by gemini06720
Beau, let me check how I can adapt the moon phase PHP code into the Cumulus HTML template. I should probably have something for you by mid afternoon (european time) or mid morning (north american time).
Beau, may I make a comment on the information about your weather station: It is now displaying "davis vp2 sereal datalogger"! Well, there is no such word as 'sereal' (certainly not in the Merriam-Webster Online dictionary)...
And Davis Instruments do not nor have not (ever) produced a 'sereal' datalogger...
So, I guess, your weather station must be a Davis Vantage Pro2 with 'serial' datalogger...
