Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Dual unit display

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
R-II
Posts: 11
Joined: Wed 21 Dec 2011 8:29 pm
Weather Station: Smart Weather WH2080
Operating System: Windows 7
Location: United Kingdom

Dual unit display

Post by R-II »

Simple question I hope..

Can I have Sea Level pressure displayed in both mb and inch on my web page and how easy is it to implement

Somebody commented that mb is more common now and they would prefer to see it that way, rather than edit a years worth of data by changing my system settings I thought I may be able to display both

Ie Pressure 30.12in (997mb) or something like
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Dual unit display

Post by beteljuice »

If you are talking about the 'standard' html templates you would need to add some JavaScript to do the math for the additional unit.

This bit of code should give whatever the alternative unit is for your current pressure:

Code: Select all

<script type="text/javascript">
<!--
function showAltBaro(input) {
	if(<#pressunit> == "in"){ // convert to hPa
       output = (input * 33.86388).toFixed(1);
	    output += " hPa";
	}else{ // convert to inHG
       output = (input / 33.86388).toFixed(2);
	    output += " inHG";
   }
   document.write(output);
}    // END function showAltBaro
-->
</script>
and your html would be something like:

Code: Select all

.....

Pressure <#press> <#pressunit> (<script>showAltBaro(<#press>);</script>)

.....
Ooops - just realised <#pressunit> option should be 'in' NOT 'inHG' - corrected
Last edited by beteljuice on Tue 10 Jan 2012 12:17 pm, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !
R-II
Posts: 11
Joined: Wed 21 Dec 2011 8:29 pm
Weather Station: Smart Weather WH2080
Operating System: Windows 7
Location: United Kingdom

Re: Dual unit display

Post by R-II »

Thanks, i found a way to do it after much fiddling but will try yours to see the effect.

I'm learning as I go along, my next step is to get the gauge to show alternate units via a radio button

Thanks again
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Dual unit display

Post by beteljuice »

ATM you've 'lost' a table cell.

If you try my code (which I've corrected an error in :oops: ), then try this chunk of html:

Code: Select all

  <tr class="td_pressure_data">
    <td>Barometer&nbsp;</td>

    <td><#press>&nbsp;<#pressunit><br /><script>showAltBaro(<#press>);</script></td>
    <td><#presstrend></td>
    <td><#presstrendval>&nbsp;inHG/hr<br /><script>showAltBaro(<#presstrendval>);</script>/hr</td>
  </tr>
Image
......................Imagine, what you will KNOW tomorrow !
scoobs
Posts: 82
Joined: Mon 23 Mar 2009 2:50 pm
Weather Station: WH3080
Operating System: Windows server
Location: Skegness

Re: Dual unit display

Post by scoobs »

Hi Richard get yourself an account on the Met office wow site too :) be nice to have another station near to compare results.
Image
R-II
Posts: 11
Joined: Wed 21 Dec 2011 8:29 pm
Weather Station: Smart Weather WH2080
Operating System: Windows 7
Location: United Kingdom

Re: Dual unit display

Post by R-II »

beteljuice wrote:ATM you've 'lost' a table cell.
The loss of cell was deliberate ... well it happened by accident and I quite liked the result, but when i get home i'll have a play with the code
R-II
Posts: 11
Joined: Wed 21 Dec 2011 8:29 pm
Weather Station: Smart Weather WH2080
Operating System: Windows 7
Location: United Kingdom

Re: Dual unit display

Post by R-II »

scoobs wrote:Hi Richard get yourself an account on the Met office wow site too :) be nice to have another station near to compare results.
Will do, glad to see a local face about :)
Post Reply