Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3044 7 December 2018. See the Wiki for download

BT's Global Sager Weathercaster PHP Scripts For Cumulus

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

Moderator: daj

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

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by bnwrx » Thu 09 May 2013 3:35 pm

BT, Wanted to say I appreciate ALL the work you did on these 2 forecasting scripts. There really is a LOT of coding involved for you. Can't imagine the hours you spent with these, getting them to function as they do. Having said that, I will probably discontinue their use or use them on a temp basis, because of my unique and particular environmental situations. I live at nearly 9,000' elevation, in the front range of the Rockies. 15 miles to my East the elevation is 6200', to my South 15 miles away is Pikes Peak at 14,000' and to my West is a pass with an elevation of 9500'. With all these elevation changes, getting a forecaster to work correctly is just too difficult. Just this morning we had over 7" of snow with my temp. at 36 degrees! We were maybe 3 miles from the rain/snow line, below which minimal rain was recorded. The Sager forecaster does seem a little more dependable, however since it uses the Cumulus "current conditions" logger as part of its function, and I use that as a way of placing the current NWS forecast on my site, I decided the NWS forecast is more in line with what we can expect here and will continue to use that. It is really amazing to me, the talent and knowledge available on this Forum. Good luck with future endeavors..... :clap:

User avatar
Buford T. Justice
Posts: 385
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ambient Weather WS-2902A
Operating System: Windows 10 Pro 64-bit
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice » Fri 10 May 2013 7:10 pm

Thanks to "steve", the new Cumulus decimal GPS tags now can convert commas into periods. You must be running Cumulus 1.9.4 beta build 1073 or newer for these to work. I added support for them in the attachment in the very first post of this thread.

User avatar
Buford T. Justice
Posts: 385
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ambient Weather WS-2902A
Operating System: Windows 10 Pro 64-bit
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice » Fri 10 May 2013 10:42 pm

I encourage all of you who are using BT's Global Sager Weathercaster JavaScripts For Cumulus to reload everything FROM SCRATCH even if you just updated it a few minutes ago from the time of this post following the directions in the first post. Also be sure to do the HTML code changes again.

User avatar
Werk_AG
Posts: 182
Joined: Sun 13 Jan 2013 8:04 pm
Weather Station: WeatherDuino Pro2
Operating System: Windows 7
Location: Cercal CDV - Portugal

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Werk_AG » Sat 11 May 2013 1:52 am

Now it is working, even with the damm comma... :)
I have tested with the suplied indexT.htm. Now I will try to integrate in my template.
Thanks for your nice work.

I am impressed with Steve's ability to quickly troubleshoot all of us.
Image

User avatar
Buford T. Justice
Posts: 385
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ambient Weather WS-2902A
Operating System: Windows 10 Pro 64-bit
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice » Sat 11 May 2013 9:11 am

Werk_AG wrote:Now it is working, even with the damm comma... :)
I have tested with the suplied indexT.htm. Now I will try to integrate in my template.
Thanks for your nice work.

I am impressed with Steve's ability to quickly troubleshoot all of us.
Damn commas, lol.

I figured out how to add my JavaScripts to the Saratoga weather templates. Backup these two files just to be safe:

top.php
wxindex.php (possibly renamed to index.php)

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">
	<script type="text/javascript" src="bt-sager-cu.js"></script>
	<script type="text/javascript" src="bt-sager.js"></script>
For wxindex.php on Line 40, CHANGE:

Code: Select all

<body>
TO:

Code: Select all

<body onload="forecast();">
And on Line 91, CHANGE:

Code: Select all

  </table>
TO:

Code: Select all

  </table>
  <p align="center"><b>12-24 Hour Forecast:</b><br>
  <a href="bt-sager-cu.js" style="text-decoration:none;" target="_blank"><b><span id="Forecast" style="font-family:Tahoma;color:red;font-size:20px;">...Forecast Offline...</span></b></a></p>

User avatar
Werk_AG
Posts: 182
Joined: Sun 13 Jan 2013 8:04 pm
Weather Station: WeatherDuino Pro2
Operating System: Windows 7
Location: Cercal CDV - Portugal

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Werk_AG » Sat 11 May 2013 7:34 pm

Code: Select all

I figured out how to add my JavaScripts to the Saratoga weather templates
Thanks for all this help.
I had added your JavaScripts in a new page in the Saratoga template ( http://www.meteocercal.info/localforecast.php ),
but in future I will do it in the Home Page, as you explain.

For now, I must find a way to get automatically current conditions for my place, and put then in the currentconditions.txt

Greetings
Image

User avatar
Buford T. Justice
Posts: 385
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ambient Weather WS-2902A
Operating System: Windows 10 Pro 64-bit
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice » Thu 16 May 2013 4:16 am

It started raining about 40 minutes ago. It stormed pretty good here and is still raining. Here are the forecasts from the Zambretti and the Sager leading up to this storm:

Sager
Rain or showers followed by fair early in period (within 6 hours) and becoming cooler; Moderate to fresh (13-24 mph) West or Northwest winds.

Zambretti
Fine Weather

Not so fine after all, lol.

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

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by uncle_bob » Sat 18 May 2013 12:08 am

Looks like it's working on my site, fairly accurately at this point :)
Though since modifying the index.php, I've lost the hands off my clock.

Here's the before code (lines 31-42 inclusive) :

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>
</head>
<body>
and line 84

Code: Select all

h1><?php echo $Tr_forecast; ?> : <span style="color: #000"><?php echo $forecast; ?></span></h1><br />
and here's the complete modified index.php:

Code: Select all

<?php
$tpl_version = "1.0";
if (isset($_GET['ver'])) {
  echo $tpl_version;
  exit;
}

session_start(); // start PHP session
// Check if a language has been selected
if (isset($_POST['langue'])) {
  $lang = $_POST['langue'];
  $_SESSION['langue'] = $lang; // store session data
}
elseif(isset($_SESSION['langue'])){
  $lang = $_SESSION['langue']; // Default language
}
else {
  $lang = 'en'; // Default language
  $_SESSION['langue'] = $lang;
}

// Include text and data file
require('lang/text_standard_'.$lang.'.php');
include('wt_data_inc.php');

// Include language files available in lang folder
include('include/local_lang.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<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>
   <meta http-equiv="refresh" content="299">
   <script type="text/javascript" src="bt-sager-cu.js"></script>
   <script type="text/javascript" src="bt-sager.js"></script>
</head>
<body onload="forecast();">
<div id="bg_clouds">
	<div id="main">
		<!-- header top and main menu begins -->
    <?php
      require_once('header_menu.php');
    ?>
    <script type="text/javascript">
    // Select menu current item highlight
    //SYNTAX: tabdropdown.init("menu_id", [item menu, start from 0])
    tabdropdown.init("mainmenu", 0)
    </script>
		<div style="height:13px"></div>
		<!-- header ends -->
		<div class="header_top"></div>
		<div class="header">
			<div id="wrapper">
				<div id="slider-wrapper">        
					<div id="slider" class="nivoSlider">
						<img src="style/header1.jpg" alt="" />
						<img src="style/header2.jpg" alt=""/>
						<img src="style/header3.jpg" alt="" />
					</div>
				</div>
			</div>
			<script type="text/javascript">
				$(window).load(function() {
				$('#slider').nivoSlider();
				});
			</script>
		</div>
		<div class="header_bot"></div>
		<div style="height:15px"></div>
		<!-- content begins -->
		<div class="cont_top"></div>
		<div id="content">
			<div class="razd_lr_h">
				<div id="left_h">
					<h1 style="padding-top:15px"><?php echo $Tr_welcome.' '.$Tr_station; ?></h1>
					<p><?php echo $Tr_ind_station.' '.$stationtype.', '.$Tr_ind_update.' '.$interval.' '.$Tr_minutes.'<br />'.$Tr_ind_mday.' '.$rollovertime; ?>.
					</p>
					<br />
					<p align="center"><b>12-24 Hour Forecast:</b><br>
               <a href="bt-sager-cu.js" style="text-decoration:none;" target="_blank"><b><span id="Forecast" style="font-family:Tahoma;color:red;font-size:20px;">...Forecast Offline...</span></b></a></p><br>
					<!-- WEATHER DATA INCLUSION -->
          <?php include('index_txt.php');?>
					<div style="clear: both"></div>
				</div>
        <!--  Right side column  -->
				<div id="right_h">
					<div class="pan_clock">
						<div class="local_time">
							<h1 style="padding: 5px 0px; text-align:center"><?php echo $Tr_localtime ?></h1>
              <!-- This place to indicate your location (City and contry)  -->
							<p><strong>Conder, Tuggeranong</strong></p>
							<p><strong>Canberra, Australia</strong></p>
						</div>
						<div id="clock_a" class="clock"></div>
					</div>
					<div class="pan observ" style="margin-top:5px">
						<h2 style="padding-top:10px;">Observations</h2>
						<table cellspacing="0" style="padding:30px 0px; line-height: 22px" summary="Most recent observations">
						<tr>
							<td style="text-align:right"><?php echo $now_temp; ?> :</td>
							<td style="text-align:left"><strong><?php echo $temp; ?></strong><small><?php echo $tempunit; ?></small></td>
						</tr><tr>
							<td style="text-align:right"><?php echo $now_hum; ?> :</td>
							<td style="text-align:left"><strong><?php echo $hum; ?></strong><small>%</small></td>
						</tr><tr>
							<td style="text-align:right"><?php echo $Tr_wind; ?> :</td>
							<td style="text-align:left"><strong><?php echo $wspeed; ?></strong> <small><?php echo $windunit; ?></small></td>
						</tr><tr>
							<td style="text-align:right"><?php echo $Tr_windd; ?> :</td>
							<td style="text-align:left"><strong><?php echo $currentwdir; ?></strong></td>
            </tr>
						</table>
						<p style="text-align: center">
              <!--  This show current date, format: Monday, 1 may 2012  -->
              <?php echo $dayname.', '.$day.' '.$monthname.' '.$year; ?>
            </p>
						<p style="text-align: center">Last read at <?php echo $timehhmmss; ?></p>
					</div>
					<div class="pan forec">
						<h2><?php echo $Tr_forecast; ?></h2>
						<img src="style/forecast/forecast_<?php echo $isdaylight.'_'.$forecastnumber; ?>.png" style="padding: 35px 0px 10px 75px" alt="<?php echo $Tr_forecast.': '.$forecast; ?>" title="<?php echo $Tr_forecast.': '.$forecast; ?>" />
						<p style="text-align:center">Forecast image<br /><em>(next 12 hours)</em></p>
					</div>
					<div class="pan night" style="margin-bottom:5px;">
						<h2><?php echo $Tr_moonphase; ?></h2>
						<img src="images/moon.bmp" style="padding: 50px 0px 52px 120px" alt="Forecast icon" title="Forecast icon" />
						<p style="text-align:center">Phase : <strong><?php echo $moonphase; ?></strong><br />
						<?php echo $Tr_MoonPercent; ?> <strong><?php echo $MoonPercentAbs; ?>%</strong></p>
					</div>
				</div>
				<div style="clear: both"></div>
			</div>
		</div>
    <!-- content ends --> 
		<div class="cont_bot"></div>
		<!-- footer begins -->
		<div id="footer">
      <!-- Do not remove -->
			<a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional"><abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a> | <a href="http://jigsaw.w3.org/css-validator/check/referer" title="This page validates as CSS"><abbr title="Cascading Style Sheets">CSS</abbr></a> | Weather Blues Template by <a href="http://weatherbyyou.com">Weather by You!</a>
			<p style="width:100%; font-family:helvetica; font-size:10px; color:#fff">Copyright  2011. Designed by <a href="http://www.metamorphozis.com/free_templates/free_templates.php" title="Free Web Templates">Free Web Templates</a>, coded by <a href="http://www.myfreecsstemplates.com/" title="Free CSS Templates">Free CSS Templates</a></p>
     <p>&nbsp</p>
	 <script type="text/javascript" src="http://jc.revolvermaps.com/r.js"></script><script type="text/javascript">rm_f1st('7','260','true','true','3578c9','296u1v3zk6d','true','ff0000');</script><noscript><applet codebase="http://rc.revolvermaps.com/j" code="core.RE" width="260" height="260" archive="g.jar"><param name="cabbase" value="g.cab" /><param name="r" value="true" /><param name="n" value="true" /><param name="i" value="296u1v3zk6d" /><param name="m" value="7" /><param name="s" value="260" /><param name="c" value="ff0000" /><param name="v" value="true" /><param name="b" value="3578c9" /><param name="rfc" value="true" /></applet></noscript>

	 <a href="http://cumulussites.net/"><img src="http://cumulussites.net/button.php?u=uncle_bob" alt="Cumulus Top Weather Sites" border="0"></a>
	 
	<!-- Do not remove end -->
		</div>
		<!-- footer ends -->
	</div>
</div>
<!--  Best place to put javascript to speed up page loading  -->
<script type="text/javascript" src="lib/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="lib/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript">
	$(window).load(function() {
	$('#slider').nivoSlider();
	});
</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>

</body>
</html>
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image

User avatar
Werk_AG
Posts: 182
Joined: Sun 13 Jan 2013 8:04 pm
Weather Station: WeatherDuino Pro2
Operating System: Windows 7
Location: Cercal CDV - Portugal

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Werk_AG » Sat 18 May 2013 6:52 pm

Buford T. Justice wrote:It started raining about 40 minutes ago. It stormed pretty good here and is still raining. Here are the forecasts from the Zambretti and the Sager leading up to this storm:
How do you feed Cumulus with the Current Conditions state? You do it manually with current conditions box, or with some automated method?
If with some automated method, from were you get current conditions state? From a near Metar with some type of script?

Sorry for all this questions
Image

User avatar
Buford T. Justice
Posts: 385
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ambient Weather WS-2902A
Operating System: Windows 10 Pro 64-bit
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice » Sun 19 May 2013 7:24 am

Werk_AG wrote:How do you feed Cumulus with the Current Conditions state? You do it manually with current conditions box, or with some automated method?
If with some automated method, from were you get current conditions state? From a near Metar with some type of script?

Sorry for all this questions
Typed manually into the Current box that must be shown as detailed in the first post.

User avatar
Buford T. Justice
Posts: 385
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ambient Weather WS-2902A
Operating System: Windows 10 Pro 64-bit
Location: USA

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Buford T. Justice » Sun 19 May 2013 7:47 am

uncle_bob wrote:Looks like it's working on my site, fairly accurately at this point :)
Though since modifying the index.php, I've lost the hands off my clock.
Change the body onload to this:

Code: Select all

<body onload="forecast(); setClocks();">

User avatar
mcrossley
Posts: 5236
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by mcrossley » Sun 19 May 2013 8:04 am

I haven't looked at the script but it sounds like you are just setting the onload() function like

body.on load = function () {...};

This will replace any existing on load function that is already present. If you use jquery it will automatically append your new function, or if you are not using a framework then you need to use .attachevent() or create your own function to do the append....

window.attachEvent("onload", function(){...});

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

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by uncle_bob » Sun 19 May 2013 8:57 am

Buford T. Justice wrote:

Code: Select all

<body onload="forecast(); setClocks();">
Worked a treat!
Thanks BT
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image

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

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by uncle_bob » Sun 19 May 2013 8:59 am

mcrossley wrote:I haven't looked at the script but it sounds like you are just setting the onload() function like

body.on load = function () {...};

This will replace any existing on load function that is already present. If you use jquery it will automatically append your new function, or if you are not using a framework then you need to use .attachevent() or create your own function to do the append....

window.attachEvent("onload", function(){...});
Mark, if that post was for me, it when straight over my head :)
Thanks for taking the time to post it though.
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image

User avatar
Werk_AG
Posts: 182
Joined: Sun 13 Jan 2013 8:04 pm
Weather Station: WeatherDuino Pro2
Operating System: Windows 7
Location: Cercal CDV - Portugal

Re: BT's Global Sager Weathercaster JavaScripts For Cumulus

Post by Werk_AG » Sun 19 May 2013 12:19 pm

Buford T. Justice wrote:
Werk_AG wrote:How do you feed Cumulus with the Current Conditions state? You do it manually with current conditions box, or with some automated method?
If with some automated method, from were you get current conditions state? From a near Metar with some type of script?

Sorry for all this questions
Typed manually into the Current box that must be shown as detailed in the first post.
As I suspected... I can't do that, mostly of the time I'm far away from the station location.
Thanks for reply.
Image

Post Reply