Opened 13 years ago

Closed 13 years ago

#3811 closed enhancement (fixed)

Add Environment Canada weather grabber for Canadian locations

Reported by: anonymous Owned by: ldunning
Priority: minor Milestone: unknown
Component: mythweather Version: head
Severity: medium Keywords: Canadian weather, Environment Canada
Cc: Ticket locked: no

Description

This is an enhancement to MythWeather? in the form of a new grabber script. This script allows MythWeather? to report on Canadian cities. Data is retrieved from Environment Canada (http://www.weatheroffice.gc.ca/).

The enhancement includes the following files:

envcan.pl
ENVCAN-Stations.xml
ENVCANParser.pm
ENVCANLocation.pm
ENVCAN_icons

All files should be copied into the <prefix>/share/mythtv/mythweather/scripts directory.

envcan.pl MUST be marked as executable. It is the script called to actually download the weather data. There are notes for each file included in the PERL comments.

The code is by no means perfect, but it does work. Comments on improving it are welcome.

Thanks!

-- Joe Ripley vitaminjoe@…

Attachments (14)

ENVCAN_icons (913 bytes) - added by vitaminjoe@… 13 years ago.
Maps Enviroment Canada icons to MythWeather? icons
ENVCAN-Stations.xml (194.9 KB) - added by vitaminjoe@… 13 years ago.
Describes all Enviroment Canada locations and URLs to the data
ENVCANLocation.pm (3.0 KB) - added by vitaminjoe@… 13 years ago.
PERL module used to search the XML document
ENVCANParser.pm (6.7 KB) - added by vitaminjoe@… 13 years ago.
PERL module used to parse HTML data. Requires HTML::Parser module.
envcan.pl (3.5 KB) - added by vitaminjoe@… 13 years ago.
PERL script that downloads Environment Canada data. MUST be marked executable.
ENVCAN-Maps.xml (24.9 KB) - added by vitaminjoe@… 13 years ago.
Environment Canada satellite map XML database (animated and static)
ENVCANMapSearch.pm (3.0 KB) - added by vitaminjoe@… 13 years ago.
PERL module used to search the ENVCAN-Maps.xml file
envcan_animaps.pl (2.6 KB) - added by vitaminjoe@… 13 years ago.
PERL script used to grab data for Environment Canada animated satellite images
envcan.2.pl (4.4 KB) - added by Joe Ripley <vitaminjoe@…> 13 years ago.
New version of envcan.pl. Adds caching support. Must be marked executable.
envcan.2.pl.patch (1.1 KB) - added by Joe Ripley <vitaminjoe@…> 13 years ago.
Add wind gust data from Environment Canada. Fix kph to mph conversion. Apply to envcan.2.pl.
ENVCANParser.pm.patch (737 bytes) - added by Joe Ripley <vitaminjoe@…> 13 years ago.
Add wind gust speed parsing.
envcan.3.pl (4.4 KB) - added by Joe Ripley <vitaminjoe@…> 13 years ago.
Ignore envcan.2.pl.patch... bad conversion logic. This is the latest copy of envcan.pl. Adds correct wind gust speed and SI/ENG conversions.
envcan.patch (242.2 KB) - added by Joe Ripley <vitaminjoe@…> 13 years ago.
Patch to include Environment Canada grabber as produced by 'svn diff'.
envcan_animaps.patch (3.3 KB) - added by Joe Ripley <vitaminjoe@…> 13 years ago.
Patch to include Animated Maps grabber for Environment Canada. This file was missed in the previous envcan.patch.

Download all attachments as: .zip

Change History (24)

Changed 13 years ago by vitaminjoe@…

Attachment: ENVCAN_icons added

Maps Enviroment Canada icons to MythWeather? icons

Changed 13 years ago by vitaminjoe@…

Attachment: ENVCAN-Stations.xml added

Describes all Enviroment Canada locations and URLs to the data

Changed 13 years ago by vitaminjoe@…

Attachment: ENVCANLocation.pm added

PERL module used to search the XML document

Changed 13 years ago by vitaminjoe@…

Attachment: ENVCANParser.pm added

PERL module used to parse HTML data. Requires HTML::Parser module.

Changed 13 years ago by vitaminjoe@…

Attachment: envcan.pl added

PERL script that downloads Environment Canada data. MUST be marked executable.

comment:1 Changed 13 years ago by vitaminjoe@…

Forgot to mention that this grabber provides data for the following screens:

Current Conditions 3 Day Forecast 6 Day Forecast

I'm working on an animated maps script that will use Environment Canada's animated radar and satellite maps as well.

-- Joe Ripley vitaminjoe@…

Changed 13 years ago by vitaminjoe@…

Attachment: ENVCAN-Maps.xml added

Environment Canada satellite map XML database (animated and static)

Changed 13 years ago by vitaminjoe@…

Attachment: ENVCANMapSearch.pm added

PERL module used to search the ENVCAN-Maps.xml file

Changed 13 years ago by vitaminjoe@…

Attachment: envcan_animaps.pl added

PERL script used to grab data for Environment Canada animated satellite images

comment:2 Changed 13 years ago by vitaminjoe@…

Just added a few more files that provides access to the animated satellite imagery provided by Environment Canada. The 'envcan_animaps.pl' file MUST be marked as executable.

All files must be copied to the <prefix>/share/mythtv/mythweather/scripts directory. After that, all animated satellite images available at http://www.weatheroffice.gc.ca/satellite/ can be used in MythWeather?.

The scripts work for me, and I've tested a few different animated images. Please advise if you encounter bugs or have suggestions for improvements.

Thanks!

-- Joe Ripley vitaminjoe@…

Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Attachment: envcan.2.pl added

New version of envcan.pl. Adds caching support. Must be marked executable.

comment:3 Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Added a new version of envcan.pl. This version caches the weather data received from Environment Canada using the same Data::Dumper method that Lucien's scripts use. The data is cached for 15 minutes.

-- Joe Ripley vitaminjoe@…

Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Attachment: envcan.2.pl.patch added

Add wind gust data from Environment Canada. Fix kph to mph conversion. Apply to envcan.2.pl.

Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Attachment: ENVCANParser.pm.patch added

Add wind gust speed parsing.

Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Attachment: envcan.3.pl added

Ignore envcan.2.pl.patch... bad conversion logic. This is the latest copy of envcan.pl. Adds correct wind gust speed and SI/ENG conversions.

comment:4 Changed 13 years ago by stuartm

Could you use "svn add" to add the files to your local checkout, then use "svn diff" to get a single patch containing all the new files and changes? It makes it easier to review and apply.

Looking at the number of files being added here and those for the UK grabber I'm writing, I think I'll make a change to the code so that we can group scripts and their support files into subdirectories e.g. scripts/envcan/, scripts/bbc/, scripts/nws/.

Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Attachment: envcan.patch added

Patch to include Environment Canada grabber as produced by 'svn diff'.

comment:5 Changed 13 years ago by Joe Ripley <vitaminjoe@…>

No problem. I've added the files and generated the diff. The patch (envcan.patch) includes the latest versions of the Environment Canada grabber and all its related files. envcan.pl and envcan_animaps.pl must be marked as executable.

I agree that we'll need some form of script organization to prevent the jumble of multiple grabbers.

-- Joe Ripley vitaminjoe@…

comment:6 Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Did some checking on the legality of using Environment Canada as a data source. Looks like it should be OK. I'm not a lawyer, but as far as I can tell from the website, MythTV usage should fall into the 'Non-commercial reproduction' of the weather data.

More at: http://www.ec.gc.ca/copy_e.html

-- Joe Ripley vitaminjoe@…

comment:7 Changed 13 years ago by stuartm

Resolution: fixed
Status: newclosed

(In [14436]) Adds a mythweather grabber for Canada using the Environment Canada website.

Patch by Joe Ripley

Closes #3811

comment:8 Changed 13 years ago by stuartm

(In [14437]) Set the svn:executable property on the two new grabbers.

Refs #3811 and #3722

Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Attachment: envcan_animaps.patch added

Patch to include Animated Maps grabber for Environment Canada. This file was missed in the previous envcan.patch.

comment:9 Changed 13 years ago by Joe Ripley <vitaminjoe@…>

Resolution: fixed
Status: closedreopened

Stuart,

I missed a file in my previous patch... sorry about that.

I've attached the file as a patch. Please include it with your MythWeather? updates as well. It allows users to download animated satellite images from Environment Canada. As with the other grabbers, it must be marked executable.

Thanks!

-- Joe Ripley vitaminjoe@…

comment:10 Changed 13 years ago by stuartm

Resolution: fixed
Status: reopenedclosed

(In [14441]) Adds animated map grabber for the Environment Canada data source.

Closes #3811 and refs #3722

Note: See TracTickets for help on using tickets.