Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

BT's Global Zambretti Weathercard Forecaster PHP Scripts

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

Moderators: daj, TNETWeather

User avatar
Buford T. Justice
Posts: 382
Joined: Fri Aug 17, 2012 9:21 pm
Weather Station: Ambient Weather WS-2095
Operating System: https://ubuntu-mate.org/
Location: USA

BT's Global Zambretti Weathercard Forecaster PHP Scripts

Postby Buford T. Justice » Sat Mar 02, 2013 1:04 am

For even more accuracy, I would suggest using BT's Global Sager Weathercaster PHP Scripts For Cumulus instead of this forecaster if you are within 30 miles of a METAR reporting station.

PLEASE POST YOUR WEBSITE IF YOU ARE USING THIS FORECASTER!

When I ordered a Zambretti Forecaster (the well-known circular one), I also received a Zambretti Weathercard Forecaster. I liked the Weathercard version so much I wanted to try to use it with Cumulus. I tried changing the forecast names Cumulus uses over to the equivalents on the Weathercard, but they were never right. The only thing easily changeable is the forecast that appears on the webpage. So I decided to make my own PHP Scripts (originally JavaScripts) for Cumulus using the Weathercard. I made them early in 2013 and have kept testing and improving them to what they are now.

I have added the ability to use the Zambretti Weathercard Forecaster anywhere on Earth as it is originally meant for use in the Northern Temperate Zone. My modifications should allow accurate forecasts anywhere on Earth.

Prerequisites

Your web server host must support PHP 5.x which most already do.

You must be running at least Cumulus v1.9.4 (1088) or newer.

Cumulus

There are some settings that need to be made to and checked in Cumulus.

Click on CONFIGURATION>STATION. Make sure the boxes in front of "Use bearing zero when calm" and "Cumulus pressure trend names" are checked. Also make sure you have correctly entered your GPS coordinates. Click OK.

Close Cumulus.

Open the Cumulus\web folder and your weather website directory. Delete this file if you have been using a previous version of this forecaster if it exists:

bt-zambrettiwcf-cu.js

When you open the BT's Zambretti Weathercard Forecaster PHP Scripts For Cumulus.zip attachment at the bottom of this long post, you will see 2 PHP files:

bt-zambrettiwcf.php
bt-zambrettiwcf-cu.php

Here is what they do:

bt-zambrettiwcf.php
This file reads data obtained from bt-zambrettiwcf-cu.php and displays it in a useful way. You can access this file by clicking on the forecast on your weather webpage.

bt-zambrettiwcf-cu.php
This file is what Cumulus updates during a web update with the correct variables to determine a forecast.

You will need to upload both files once to your web server in the same directory Cumulus uploads to during web updates. Any FTP program will work. I use Firefox so I use the FireFTP add-on. Once you have the 2 files uploaded, close your FTP program.

You can now re-open Cumulus. Once it finishes reading data, click on CONFIGURATION>INTERNET then click on the FILES tab. You will see a series of boxes. The ones on the left are LOCAL files. The ones on the right are REMOTE files. You will need a blank LOCAL one with a blank REMOTE one to the right of it. Between these two boxes is a BROWSE button. Click it. You need to browse to your Cumulus web folder and select bt-zambrettiwcf-cu.php. This file along with the folder location it is in should now be in the LOCAL box. Now in the REMOTE box, you will need to type in /bt-zambrettiwcf-cu.php or if you are uploading to a folder use the folder name so type in /FOLDER NAME/bt-zambrettiwcf-cu.php. Now to the right of the REMOTE box are some check boxes. You need to check PROCESS? and FTP? so bt-zambrettiwcf-cu.php is updated when Cumulus performs a web update. Click OK.

Now you need to update either the Cumulus indexT.htm file if you are using the default templates from Cumulus on your weather webpage or you will need to update the template files for the template you are using. Usually most folks use the default Cumulus templates, but others use the Saratoga or the Weather by You PHP templates. All of these changes are explained below. You only need to change the ones you are using obviously.

You will need to open the following with a text editor. I HIGHLY RECOMMEND Notepad++ which is free. This is the program I am going to assume you will be using to do all which follows.

indexT.htm
Open this with Notepad++.

CHANGE:

Code: Select all

<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
<meta name="description" content="<#location> weather data" />
<meta name="keywords" content="Cumulus, <#location> weather data, weather, data, weather station" />
<title><#location> weather</title>
<link href="weatherstyle.css" rel="stylesheet" type="text/css" />
</head>

TO:

Code: Select all

<head>
   <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
   <meta http-equiv="refresh" content="299">
   <meta name="description" content="<#location> weather data">
   <meta name="keywords" content="Cumulus, <#location> weather data, weather, data, weather station">
   <title><#location> weather</title>
   <link href="weatherstyle.css" rel="stylesheet" type="text/css">
</head>

CHANGE:

Code: Select all

<p>Forecast: <#forecast></p>

TO:

Code: Select all

<p align= "center"><b>12-24 Hour Forecast:</b><br>
<a href = "bt-zambrettiwcf.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000" face = "Tahoma" size = "4"><script src = "bt-zambrettiwcf-cu.php"></script></font></b></a></p>

OR FOR SMALLER LETTERS:

Code: Select all

<p><b>12-24 Hour Forecast:</b>&nbsp;<a href = "bt-zambrettiwcf.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000"><script src = "bt-zambrettiwcf-cu.php"></script></font></b></a></p>

PLEASE leave the <a href> link in the code as it makes it easy to see the variables used to determine a forecast simply by clicking on the forecast.

That's it! Now when Cumulus updates your website, you will see The Zambretti Weathercard Forecaster forecast on your main weather webpage. If you use Saratoga or Weather by You PHP templates on your website, keep reading.

Saratoga Templates

Open bt-zambrettiwcf-cu.php with Notepad++. Scroll down to the very bottom of the file. Add // to the front of Line 322 so it looks like this:

Code: Select all

// echo "document.write ('$zf');";// This allows displaying the forecast on a HTML webpage.  Add // to the front of this line if using a PHP webpage.

Backup these two files just to be safe then open them with Notepad++:

ajax-dashboard.php
top.php

Using the 30 Dec 2013 04:31pm PST (31 Dec 2013 00:31 GMT) version of "Base-USA.zip":

For ajax-dashboard.php on Line 971, CHANGE:

Code: Select all

         <td class="data1" style="width: 80px;font-size: 8pt;border: none;text-align: center" valign="middle" align="center"><strong><?php echo $forecasticons[0] . "</strong><br />" . $forecasttemp[0]; ?></td>

TO:

Code: Select all

         <p align = "center" style = "line-height : 1.3"><b><font face = "Tahoma" size = "2">12-24 Hour Forecast:</font></b><br>
         <a href = "bt-zambrettiwcf.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000" face = "Tahoma" size = "4"><?php include "bt-zambrettiwcf-cu.php"; echo "$zf"; ?></font></b></a></p>
         <td class="data1" style="width: 80px;font-size: 8pt;border: none;text-align: center" valign="middle" align="center"><strong><?php echo $forecasticons[0] . "</strong><br />" . $forecasttemp[0]; ?></td>

For top.php on Line 113, CHANGE:

Code: Select all

   <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

TO:

Code: Select all

   <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
   <meta http-equiv="refresh" content="299">

Weather by You Templates

Open bt-zambrettiwcf-cu.php with Notepad++. Scroll down to the very bottom of the file. Add // to the front of Line 322 so it looks like this:

Code: Select all

// echo "document.write ('$zf');";// This allows displaying the forecast on a HTML webpage.  Add // to the front of this line if using a PHP webpage.

Backup index.php just to be safe then open it with Notepad++.

Using the "Weather Blues V2 2a" template as an example:

CHANGE Lines 34-47 FROM:

Code: Select all

<head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title><?php echo $location.' | '.$TT_now; ?></title>
   <meta name="keywords" content="Current, actually, last minute" />
   <meta name="description" content="Current weather observations" />
   <link href="styles.css" rel="stylesheet" type="text/css" />
   <link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
   <script type="text/javascript" src="lib/clock/clockt.js"></script>
   <script type="text/javascript" src="lib/clock/clockp.js"></script>
  <script type="text/javascript" src="lib/dropmenu/dropdowntabs.js"></script>
   <script type="text/javascript">
      var dayname = new Array('<?php echo $Tr_sun."', '".$Tr_mon."', '".$Tr_tue."', '".$Tr_wed."', '".$Tr_thu."', '".$Tr_fri."', '".$Tr_sat."', '".$Tr_sun; ?>');
   </script>
</head>

TO:

Code: Select all

<head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <meta http-equiv="refresh" content="299">
   <title><?php echo $location.' | '.$TT_now; ?></title>
   <meta name="keywords" content="Current, actually, last minute" />
   <meta name="description" content="Current weather observations" />
   <link href="styles.css" rel="stylesheet" type="text/css" />
   <link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
   <script type="text/javascript" src="lib/clock/clockt.js"></script>
   <script type="text/javascript" src="lib/clock/clockp.js"></script>
   <script type="text/javascript" src="lib/dropmenu/dropdowntabs.js"></script>
   <script type="text/javascript">
      var dayname = new Array('<?php echo $Tr_sun."', '".$Tr_mon."', '".$Tr_tue."', '".$Tr_wed."', '".$Tr_thu."', '".$Tr_fri."', '".$Tr_sat."', '".$Tr_sun; ?>');
   </script>
</head>

CHANGE Line 92 FROM:

Code: Select all

               <h1><?php echo $Tr_forecast; ?> : <span style="color: #000"><?php echo $forecast; ?></span></h1><br />

TO:

Code: Select all

               <p align = "center" style = "line-height : 1.3"><b><font face = "Tahoma" size = "2">12-24 Hour Forecast:</font></b><br>
               <a href = "bt-zambrettiwcf.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000" face = "Tahoma" size = "4"><?php include "bt-zambrettiwcf-cu.php"; echo "$zf"; ?></font></b></a></p><br>

LOCALIZATION

If you use a language other than English, you can customize bt-zambrettiwcf-cu.php after you extract it to the Cumulus web folder to work properly for your location. Open bt-zambrettiwcf-cu.php with Notepad++ and look at Lines 40-56, 62-90, 111-131, and 134-152. These are the lines to be changed to your local language, however, not all of what is in each line needs to be changed.

As you can see, there are Rain/Snow, Forecasts, and Month/Season names. You would have to change Snow and Rain on Lines 40-56 and the Month and Season names on Lines 111-152 to your language. For the forecasts on Lines 62-90, let's assume you are in Spain. Using Line 87 and Spanish as an example, it should be:

Code: Select all

$forecast[5] = "Cambiable, Unos $fp Peor Después";// Lluvia cambió a $fp.

As you can see, only some of the original text is translated.

The bt-zambrettiwcf-cu.php file also uses English wind directions for N, NE, E, SE, S, SW, W, NW, and Calm. If you have Cumulus set to use wind directions other than these, you need to change these.

The EASY WAY would be to click on SEARCH>REPLACE in Notepad++. Let's say you need to change NE to NO.

In FIND WHAT, enter with quotes "NE" and in REPLACE WITH, enter with quotes "NO" then click REPLACE ALL. Repeat for the other wind directions you need to change.

Save bt-zambrettiwcf-cu.php and re-upload it to your website.

CHANGE LOG:

2014-02-02
I changed all of the default forecast readings so they are based on a South wind. This way, the barometric pressure offset is an addition to the barometric pressure used. This offset is based on location, time of year, and wind direction.

2014-01-30
The JavaScripts have been converted to PHP Scripts.

Rain has been changed to a variable which is determined by temperature so Rain can be Snow in the forecasts.

2013-06-13
JavaScripts date and time represented in international standard date and time notation.

JavaScripts var bp has been changed from using the <#RCpress> webtag to using the <#altimeterpressure> webtag in order to bypass Davis Vantage Pro/Pro2 calculations of relative barometric pressure which use other factors in addition to altitude which can make the reading too low and result in an erroneous forecast. The <#altimeterpressure> webtag does the exact same thing as the <#press> webtag for non-Davis weather stations. It is represented as:

Code: Select all

var bp = parseFloat("<#altimeterpressure>".replace(",","."));

The (",",".") part replaces the decimal separator comma with a period.

2013-06-05
Localization directions added to this post.

2013-05-30
Added the longitude to the bt-zambrettiwcf-cu.js file to make finding a location easier.

2013-05-10
Thanks to steve, support for the new Cumulus GPS webtags which convert commas into periods has been added. You must be running Cumulus 1.9.4 beta build 1073 or newer for these to work.

Added directions for other weather templates.

2013-04-25
Fixed an issue with the Calm wind reading.

2013-04-20
Fixed an issue with the barometer reading conversion to hPa not working properly with in/inHg barometric pressure readings.

2013-03-13
Original release.
You do not have the required permissions to view the files attached to this post.
Last edited by Buford T. Justice on Thu Feb 06, 2014 7:30 am, edited 46 times in total.

uncle_bob
Posts: 472
Joined: Wed Aug 17, 2011 2:58 pm
Weather Station: WeatherDuino Pro2
Operating System: 2008
Location: Canberra

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby uncle_bob » Sat Mar 02, 2013 2:57 am

Might try this one out. The built in one, after years or trying, only reads right about 50% of the time (like a broken watch reads right twice a day:) ).
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image

User avatar
William Grimsley
Posts: 833
Joined: Thu Sep 22, 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby William Grimsley » Sat Mar 02, 2013 7:50 am

That's very cool! I think that forecast would be good for the Cumulus templates but not for the Saratoga Templates. But, as you're aiming this new Zambretti Weathercard Forecaster for people that use Cumulus templates, then that's great! :D

User avatar
Buford T. Justice
Posts: 382
Joined: Fri Aug 17, 2012 9:21 pm
Weather Station: Ambient Weather WS-2095
Operating System: https://ubuntu-mate.org/
Location: USA

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby Buford T. Justice » Sun Mar 03, 2013 6:17 am

uncle_bob wrote:Might try this one out. The built in one, after years or trying, only reads right about 50% of the time (like a broken watch reads right twice a day:) ).

http://www.users.on.net/~cond/weather/

I see you are in Australia. I think the default one supports only the Northern Hemisphere and "kind of" supports the Southern Hemisphere. I just finished adding support for the Southern Hemisphere to my JavaScript. If you are using it now, redownload the file in the first post and go through the directions once again.

The following should work or get you going in the right direction. Be sure to save a copy of your current file before modifying it.

CHANGE:

Code: Select all

<head>
   <meta http-equiv="content-type" content="text/html; charset=iso8559-1" />
   <title>Conder, Canberra, ACT, Australia | Most recent observations</title>
   <meta name="keywords" content="" />
   <meta name="description" content="" />
   <link href="styles.css" rel="stylesheet" type="text/css" />
   <link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
   <script type="text/javascript" src="js/clockt.js"></script>
   <script type="text/javascript" src="js/clockp.js"></script>
   
   <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-3491004-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
   
</head>
<body>

TO:

Code: Select all

<head>
   <meta http-equiv="content-type" content="text/html; charset=iso8559-1" />
   <meta http-equiv="refresh" content="299">
   <title>Conder, Canberra, ACT, Australia | Most recent observations</title>
   <meta name="keywords" content="" />
   <meta name="description" content="" />
   <link href="styles.css" rel="stylesheet" type="text/css" />
   <link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
   <script type="text/javascript" src="bt-zambrettiwcf-cu.js"></script>
   <script type="text/javascript" src="js/clockt.js"></script>
   <script type="text/javascript" src="js/clockp.js"></script>
   
   <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-3491004-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
   
</head>
<body onload="forecast();">

CHANGE:

Code: Select all

<h1>Forecast : <span style="color: #000">Sunny</span></h1><br />

TO:

Code: Select all

<h1>Forecast: <a href="bt-zambrettiwcf-cu.js" target="_blank"><span id="Forecast" style="font-family:Tahoma;color:black;font-size:20px;">...Forecast Offline...</span></a></h1><br />
Last edited by Buford T. Justice on Fri May 10, 2013 10:15 pm, edited 1 time in total.

User avatar
Buford T. Justice
Posts: 382
Joined: Fri Aug 17, 2012 9:21 pm
Weather Station: Ambient Weather WS-2095
Operating System: https://ubuntu-mate.org/
Location: USA

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby Buford T. Justice » Sun Mar 03, 2013 6:43 am

William Grimsley wrote:That's very cool! I think that forecast would be good for the Cumulus templates but not for the Saratoga Templates. But, as you're aiming this new Zambretti Weathercard Forecaster for people that use Cumulus templates, then that's great! :D

Thanks. A lot of work went into it.

Yes it is mainly geared towards the Cumulus indexT.htm template file. If you want to mess with it, you could backup your current indexT.htm file if you have customized it, save the indexT.htm file in the attached .ZIP file in the first post to the Cumulus/web folder named as something else, and restore your customized indexT.htm file. Then add the new .htm file to the files list to be processed just like the bt-zambrettiwcf-cu.js file is. Call the local file bt-forecastT.htm and the remote file bt-forecast.htm and use the same check boxes used for the bt-zambrettiwcf-cu.js file.

Then simply go to http://www.newton-poppleford-weather.co ... recast.htm :)
Last edited by Buford T. Justice on Fri May 10, 2013 10:16 pm, edited 1 time in total.

User avatar
beteljuice
Posts: 2472
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby beteljuice » Sun Mar 03, 2013 7:02 am

To clarify Dear Reader.

The original Dial and now Card reader were designed for Northern Temperate Zone. The Cumulus Zambretti has always worked for Southern Temperate Zone as well, and has a vague attempt at Equatorial and Polar Zones also - although in the most part these are likely to be very erratic as they are NOT cyclonically driven weather systems.
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
Buford T. Justice
Posts: 382
Joined: Fri Aug 17, 2012 9:21 pm
Weather Station: Ambient Weather WS-2095
Operating System: https://ubuntu-mate.org/
Location: USA

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby Buford T. Justice » Fri Mar 08, 2013 12:25 am

Who is all using it? How is it working? I am very curious how accurate the Southern Hemisphere settings are. In the weeks so far I have used it for the Northern Hemisphere, I would give it roughly a 95% accuracy rating.

User avatar
kingqueen
Posts: 60
Joined: Tue Feb 26, 2013 6:52 pm
Weather Station: Maplin N96GY / Fine Offset 1081
Operating System: Windows 7 HP 64 bit
Location: Wetherby, UK
Contact:

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby kingqueen » Tue Mar 26, 2013 11:51 pm

I'm using it. I just implemented it as an alternative forecast, at http://www.wetherbyweather.org.uk/forecast.htm . (Currently loading very slowly due to hosting problems at a third party.) I can't use it as my "main" forecast as it won't do things like appear in my Cumulus Tweet or interface with the forecast icons.

I have yet to see if I think it's more accurate than the built-in Cumulus one, as I've only just put it in place.

Thank you for it. I've put your credit in the "About" page, rather than directly on the forecast - I've grouped all credits together.

cheers
Image

uncle_bob
Posts: 472
Joined: Wed Aug 17, 2011 2:58 pm
Weather Station: WeatherDuino Pro2
Operating System: 2008
Location: Canberra

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby uncle_bob » Wed Apr 17, 2013 10:51 am

Sorry BT, nearly forgot about this.
I haven't had a chance to tinker with it yet.
I'm now using Jacques D's php template, will it work with this?

Cheers Bob
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image

User avatar
Buford T. Justice
Posts: 382
Joined: Fri Aug 17, 2012 9:21 pm
Weather Station: Ambient Weather WS-2095
Operating System: https://ubuntu-mate.org/
Location: USA

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby Buford T. Justice » Thu Apr 18, 2013 4:20 am

uncle_bob wrote:Sorry BT, nearly forgot about this.
I haven't had a chance to tinker with it yet.
I'm now using Jacques D's php template, will it work with this?

Cheers Bob

Not without modification to those templates.

bnwrx
Posts: 453
Joined: Wed Feb 25, 2009 12:01 am
Weather Station: Ambient WS2095 (Fine/Offset)
Operating System: Windows 10 64bit
Location: Woodland Park, Colorado USA
Contact:

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby bnwrx » Thu Apr 18, 2013 2:02 pm

I must be missing something, mine says only "...Getting Forecast..."?
Any suggestions?

User avatar
Buford T. Justice
Posts: 382
Joined: Fri Aug 17, 2012 9:21 pm
Weather Station: Ambient Weather WS-2095
Operating System: https://ubuntu-mate.org/
Location: USA

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby Buford T. Justice » Sat Apr 20, 2013 11:44 am

bnwrx wrote:I must be missing something, mine says only "...Getting Forecast..."?
Any suggestions?

Your barometer unit is shown as "in" instead of inHg.

In the .txt file, change this:

Code: Select all

switch (b) {
      case "cmHg": var p = r * 13.332239 - p_offset.toFixed(2); break;
      case "hPa": var p = r - p_offset; break;
      case "inHg": var p = r * 33.8638866667 - p_offset.toFixed(2); break;
      case "kPa": var p = r * 10 - p_offset.toFixed(2); break;
      case "mb": var p = r - p_offset; break;
      case "mmHg": var p = r * 1.3332239 - p_offset.toFixed(2);
   }


To this:

Code: Select all

switch (b) {
      case "cmHg": var p = r * 13.332239 - p_offset.toFixed(2); break;
      case "hPa": var p = r - p_offset; break;
      case "in": var p = r * 33.8638866667 - p_offset.toFixed(2); break;
      case "inHg": var p = r * 33.8638866667 - p_offset.toFixed(2); break;
      case "kPa": var p = r * 10 - p_offset.toFixed(2); break;
      case "mb": var p = r - p_offset; break;
      case "mmHg": var p = r * 1.3332239 - p_offset.toFixed(2);
   }
Last edited by Buford T. Justice on Tue May 14, 2013 5:17 pm, edited 1 time in total.

User avatar
Buford T. Justice
Posts: 382
Joined: Fri Aug 17, 2012 9:21 pm
Weather Station: Ambient Weather WS-2095
Operating System: https://ubuntu-mate.org/
Location: USA

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby Buford T. Justice » Sat Apr 20, 2013 11:46 am

Does Cumulus default report inHg as in? If so, I will need to update the code for future use.

bnwrx
Posts: 453
Joined: Wed Feb 25, 2009 12:01 am
Weather Station: Ambient WS2095 (Fine/Offset)
Operating System: Windows 10 64bit
Location: Woodland Park, Colorado USA
Contact:

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby bnwrx » Sat Apr 20, 2013 11:57 am

Buford T. Justice wrote:
bnwrx wrote:I must be missing something, mine says only "...Getting Forecast..."?
Any suggestions?

You barometer unit is shown as "in" instead of inHg.

In the .txt file, change this:

Code: Select all

switch (b) {
      case "cmHg": var p = r * 13.332239 - p_offset.toFixed(2); break;
      case "hPa": var p = r - p_offset; break;
      case "inHg": var p = r * 33.8638866667 - p_offset.toFixed(2); break;
      case "kPa": var p = r * 10 - p_offset.toFixed(2); break;
      case "mb": var p = r - p_offset; break;
      case "mmHg": var p = r * 1.3332239 - p_offset.toFixed(2);
   }


To this:

Code: Select all

switch (b) {
      case "cmHg": var p = r * 13.332239 - p_offset.toFixed(2); break;
      case "hPa": var p = r - p_offset; break;
      case "in": var p = r * 33.8638866667 - p_offset.toFixed(2); break;
      case "inHg": var p = r * 33.8638866667 - p_offset.toFixed(2); break;
      case "kPa": var p = r * 10 - p_offset.toFixed(2); break;
      case "mb": var p = r - p_offset; break;
      case "mmHg": var p = r * 1.3332239 - p_offset.toFixed(2);
   }


Thank you BT, it now works!

User avatar
steve
Cumulus Author
Posts: 26630
Joined: Mon Jun 02, 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: BT's Zambretti Weathercard Forecaster JavaScript For Cum

Postby steve » Sat Apr 20, 2013 12:06 pm

Buford T. Justice wrote:Does Cumulus default report inHg as in?
Yes.
Steve
-----
Hosting available for Cumulus web sites. See http://sandaysoft.com/forum/viewtopic.php?f=2&t=11876

Please read the posts in the Announcements section about the current status of Cumulus development since I have retired from my day job


Return to “Web site - General”

Who is online

Users browsing this forum: No registered users and 2 guests