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 4017) - 17 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

ec-forecast V5.00 released -- uses XML instead of EC page scraping

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
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:

ec-forecast V5.00 released -- uses XML instead of EC page scraping

Post by saratogaWX »

This version is a MAJOR rewrite of the script (originally released in 2006) and changes the way the data is acquired -- no longer will it be subject to the whims of the Environment Canada webmasters who seem to delight in minor tweaks to the page HTML. Instead, this script relies on the XML data provided by the EC via http://dd.weather.gc.ca/citypage_weather/xml/ site, and that XML data format has been stable for many years.

The main issue to overcome was how to seamlessly convert the existing EC website URLs used in V1-V4 of the script to the XML data file URLs needed for the actual data. That was solved by a new lookup table (ec-forecast-lookup.txt) that (along with a new function call) will do that conversion. So, ec-forecast-lookup.txt is now REQUIRED to be in the same directory as the ec-forecast.php script for proper operation.

Some new features with this release:
1) the * indicator for abnormal temperature is back and appears after the Min or Max temperature in the icon display.
2) a new Averages and Extremes table is now produced (in $almanac string).
3) a new 24-hour hourly forecast table is now produced (in $forecast24h string).
4) new settings control the display of the Averages and Extremes and the 24-hour forecast table. In Settings.php these can be used:

$SITE['ECshowConditions'] = true; // set to false to disable Conditions display box
$SITE['ECshowAlmanac'] = true; // set to false to disable Almanac (Averages/Extremes) display box
$SITE['ECshow24hour'] = true; // set to false to disable 24-hour hourly forecast display box

In a calling script, the variables:

$doShowConditions, $doShowAlmanac, $doShow24hour will override the above.

The HTML for almanac is returned in $almanac and the 24-hour hourly forecast is returned in the $forecast24h string.

I'm hoping that the shift to using XML will put an end to the frequent updates to this script as we'll no longer depend on the raw HTML of the EC website :)

Standalone: download from the script page note: download ec-forecast-lookup.txt too!
Saratoga template: use the update tool page with a query for Base-Canada, Plugin-*, 27-Sep-2017

Thanks to all the testers who provided feedback with the V5.00 beta!!

Best regards,
Ken
Post Reply