Welcome to the Cumulus Support forum.

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

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.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

broken weather underground forecast?

Discussion of Ken True's web site templates

Moderator: saratogaWX

Sadgit
Posts: 192
Joined: Sun 04 Jan 2009 5:56 pm
Weather Station: Vantage Vue
Operating System: Windows 7
Location: Middlesbrough, England

Re: broken weather underground forecast?

Post by Sadgit »

SpaceWalker wrote:Indeed, I have noticed the same situation where the name of the days are duplicated whereas the forecasts are different.

So, rather than bothering Ken, I have looked at the code, found the location where the variable '$nowdaytime' is located and added a few lines of code to take care of the missing 'tonight/night' words (it is my belief that Ken has been quite busy having to modify, if not to completely rewrite, the two scripts handling the forecasts and radar information from Environment Canada).
would you mind sharing that code please? :S
Sadgit
Posts: 192
Joined: Sun 04 Jan 2009 5:56 pm
Weather Station: Vantage Vue
Operating System: Windows 7
Location: Middlesbrough, England

Re: broken weather underground forecast?

Post by Sadgit »

I have it and here it is
replace

Code: Select all

	$WUforecastday[$n] = trim($FCpart['summary'][$dnpart]['title']);
	if(strlen($WUforecastday[$n]) < 1) {
		
	   $WUforecastday[$n] = WU_get_dayname($FCpart['summary']['date']['iso8601'],$nowdaytime);
	   $Status .= "<!-- WUforecastday[$n] null 'title'.  Set to '".$WUforecastday[$n]."' -->\n";
	}
with

Code: Select all

//   $WUforecastday[$n] = trim($FCpart['summary'][$dnpart]['title']);
//   if(strlen($WUforecastday[$n]) < 1) {      
      $WUforecastday[$n] = WU_get_dayname($FCpart['summary']['date']['iso8601'],$nowdaytime);
      $Status .= "<!-- WUforecastday[$n] null 'title'.  Set to '".$WUforecastday[$n]."' -->\n";
//   }
This was supplied to me by BCJKiwi and works in the new version of Ken's template.
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: broken weather underground forecast?

Post by saratogaWX »

An update to WU-forecast.php V2.08 (18-Oct-2014) addresses two issues that have come up:
1) multilingual operation didn't work outside the Saratoga template (now it does)
2) the funky forecast period names were annoying many around the world. I've put in a solution that uses the WU JSON-supplied names for the days to ensure that each period is <dayname> or <dayname> <night> in the selected language. No more duplicated day-names for periods :)

Standalone users: download source from the script page

Saratoga template users: use the updates tool page for Base-World, Plugin-*, 18-Oct-2014 for the .zip download

Best regards,
Ken
Sadgit
Posts: 192
Joined: Sun 04 Jan 2009 5:56 pm
Weather Station: Vantage Vue
Operating System: Windows 7
Location: Middlesbrough, England

Re: broken weather underground forecast?

Post by Sadgit »

works like a dream Ken, thank you!
User avatar
PaulMy
Posts: 3776
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: broken weather underground forecast?

Post by PaulMy »

Hi Ken,
I use the EC-forecast script on my website which works well. Can I also use the WU-forecast?
I just tried a former WU-forecast version and it gives a message
Sorry.. this country forecast can not be processed by this script.

Locations in the United States and territories should use the carterlake NOAA script.
Locations in Canada should use the Environment Canada forecast script
and the current version gives a warning message and does not work.

Thanks,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
SpaceWalker
Posts: 67
Joined: Sun 04 Mar 2012 2:54 am
Weather Station: Davis Vantage
Operating System: Windows XP
Location: Eastern-Canada
Contact:

Re: broken weather underground forecast?

Post by SpaceWalker »

Paul, I have been using the Weather Underground script on my test site for more than a year - I cannot remember what modifications were required. Not only can I get the data for canadian sites, I can also get the data from my own site, that data my weather software is uploading to the Weather Underground site.
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: broken weather underground forecast?

Post by gluepack »

Thanks, the update works fine...
...just wish my parameters, set up front...
$maxWidth $maxIcons $maxForecasts $numIconsInFoldedRow
...didn't get overridden later on.
Also it would be nice to space out "WeatherUnderground" in titles to save me having to do it.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: broken weather underground forecast?

Post by saratogaWX »

PaulMy wrote:Hi Ken,
I use the EC-forecast script on my website which works well. Can I also use the WU-forecast?
I just tried a former WU-forecast version and it gives a message
Sorry.. this country forecast can not be processed by this script.

Locations in the United States and territories should use the carterlake NOAA script.
Locations in Canada should use the Environment Canada forecast script
and the current version gives a warning message and does not work.

Thanks,
Paul
Hi Paul,

Yes, the WU-forecast.php will now work with Canadian (and USA) forecasts. To use it in a Saratoga template site, you have to provide some $SITE[] values to customize it. Just make a copy of wxnewpage.php and replace the <div id="main-copy>...</div> with

Code: Select all

<div id="main-copy">
<?php 
// customize settings for WU-forecast by changing these $SITE[] items
//  fcsturlWU  is used by WeatherUnderground script (WU-forecast.php)
// find the correct URL by going to www.wunderground.com, search for your location and copy the resulting
// URL from your browser location bar into the $SITE['fcsturlWU']  value.
$SITE['fcsturlWU'] 		= 'http://www.wunderground.com/global/stations/06108.html'; // Vamdrup, Denmark
$SITE['fcsticonsdir'] = './forecast/images/'; // NOAA-style icons for NWS, WU, WXSIM forecast scripts
$SITE['fcsticonstype']= '.jpg'; // default type='.jpg' -- use '.gif' for animated icons from http://www.meteotreviglio.com/
// 
// optional multi-city forecasts for WeatherUnderground with WU-forecast V1.26+ ML
// Note: make sure the first entry is the same as your $SITE['fcsturlWU'] contents listed above.
//
//*
$SITE['WUforecasts'] = array(
 // Location|forecast-URL  (separated by | characters
'Vamdrup|http://www.wunderground.com/global/stations/06108.html', // Vamdrup, Denmark
'Auckland|http://www.wunderground.com/global/stations/93119.html', // Awhitu, Waiuku New Zealand
'Amsterdam|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Amsterdam%2C+Netherlands',
'Paris|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Paris%2C+France',
'Stockholm|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Stockholm%2C+Sweden',
'Oslo|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Oslo%2C+Norway',
'Moscow|http://bulgarian.wunderground.com/global/stations/27612.html',
'Athens|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Athens%2C+Greece',
'Tel Aviv|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Tel+Aviv%2C+Israel',
'Madrid|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Madrid%2C+Spain',
'Helsinki|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Helsinki%2C+Finland',
'Castrop-Rauxel|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=51.572%2C7.376&sp=INORDRHE72',
'Southampton|http://www.wunderground.com/global/stations/03865.html',
); 


$doIncludeWU  = true; // handle WU-forecast include w/o additional HTML
include_once("WU-forecast.php"); 
		 
?>

</div><!-- end main-copy -->
and the script will work without interfering with the ec-forecast for Base-Canada sites. Same thing can be done with Base-USA sites, and can use the WU-forecast.php script unmodified, as all the customization needed is in this new wxwuforecast.php page. Don't forget to upload the forecast/images/* icon files (Saratoga or Meteo Triviglio version as you choose), since this script does not use the ec-icons (which are for ec-forecast only).

Keep in mind that using WU-forecast in Base-Canada or Base-USA is ok, but... the check-fetch-times.php?show=versions will not detect nor recommend an update when the WU-forecast.php is revved, so you'll need to do a manual replacement for it when needed.

Hope this helps...

Best regards,
Ken
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: broken weather underground forecast?

Post by saratogaWX »

gluepack wrote:Thanks, the update works fine...
...just wish my parameters, set up front...
$maxWidth $maxIcons $maxForecasts $numIconsInFoldedRow
...didn't get overridden later on.
Also it would be nice to space out "WeatherUnderground" in titles to save me having to do it.
Most folks don't tweak the $maxWidth $maxIcons $maxForecasts $numIconsInFoldedRow values, so I didn't put in
$SITE[] override capability for them (sorry...).

"WeatherUnderground" is the (tm) name.. not the same as "Weather Underground" which for us was a radical 70's semi-terrorist organization. I'd recommend leaving it as 'WeatherUnderground' since it's their official name.

Best regards,
Ken
User avatar
PaulMy
Posts: 3776
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: broken weather underground forecast?

Post by PaulMy »

Thanks Ken,
But must have missed something as http://www.komokaweather.ca/wxwuforecast.php does not yet work.

Uploaded WU-forecast.php after editing line 139 for $WU_URL with station 71623
Uploaded full images set to http://www.komokaweather.ca/forecast/images/
Saved your sample below as wxwuforecast.php and edited line 54 with $SITE['fcsturlWU'] = 'http://www.wunderground.com/global/stations/71623.html'; // London, Canada
and upload the file to http://www.komokaweather.ca
In wxwuforecast.php added a new top line 64 with our local 71623 London, Canada station
There is no WU-forecast.txt file but with running http://www.komokaweather.ca/WU-forecast.php a WU-forecast-0-en.txt was auto created and have then set the Permission to 0777.

Any suggestion?
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: broken weather underground forecast?

Post by saratogaWX »

Yes, the problem is your PHP is 5.2.17 and the script needs PHP 5.3+ to run. With PHP before 5.3+, there was a problem with the built-in PHP function json_decode() in that it would choke up and not parse the large JSON returned by WeatherUnderground.

Upgrade your PHP to 5.3+ and the script will work fine :)

BTW... in the sample code for the page, the multi-forecast-locations was left enabled, so make sure the first on in the array has the same URL as in the separate URL used. The multi-forecast array presence will override the separate URL :)

Best regards,
Ken
User avatar
PaulMy
Posts: 3776
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: broken weather underground forecast?

Post by PaulMy »

Thanks, once again you've solved the riddle Ken, upgraded to PHP 5.3 and WU forecast is working.

Now I've got so many forecasts, one is bound to be correct :lol:

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: broken weather underground forecast?

Post by gluepack »

"WeatherUnderground" is the (tm) name.. not the same as "Weather Underground" which for us was a radical 70's semi-terrorist organization. I'd recommend leaving it as 'WeatherUnderground' since it's their official name.
Don't know nothing about no trade mark...
wu.jpg
You do not have the required permissions to view the files attached to this post.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: broken weather underground forecast?

Post by gluepack »

Another problem just started?...

Warning: Division by zero in /home/jerbi780/public_html/saratoga/WU-forecast.php on line 790
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: broken weather underground forecast?

Post by saratogaWX »

Yes, just saw the issue... they are no longer including the JSON with the forecast in the page.. their page has been rewritten to use jquery to access the forecast via their API.

Looks like this will not be fixable with the current script, but I'll do more research on this.
Post Reply