Ticket #3811 (closed enhancement: fixed)
Opened 5 years ago
Last modified 5 years ago
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
Change History
Changed 5 years ago by vitaminjoe@…
- Attachment ENVCAN_icons added
Changed 5 years ago by vitaminjoe@…
- Attachment ENVCAN-Stations.xml added
Describes all Enviroment Canada locations and URLs to the data
Changed 5 years ago by vitaminjoe@…
- Attachment ENVCANLocation.pm added
PERL module used to search the XML document
Changed 5 years ago by vitaminjoe@…
- Attachment ENVCANParser.pm added
PERL module used to parse HTML data. Requires HTML::Parser module.
Changed 5 years ago by vitaminjoe@…
PERL script that downloads Environment Canada data. MUST be marked executable.
comment:1 Changed 5 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 5 years ago by vitaminjoe@…
- Attachment ENVCAN-Maps.xml added
Environment Canada satellite map XML database (animated and static)
Changed 5 years ago by vitaminjoe@…
- Attachment ENVCANMapSearch.pm added
PERL module used to search the ENVCAN-Maps.xml file
Changed 5 years ago by vitaminjoe@…
- Attachment envcan_animaps.pl added
PERL script used to grab data for Environment Canada animated satellite images
comment:2 Changed 5 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 5 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 5 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 5 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 5 years ago by Joe Ripley <vitaminjoe@…>
- Attachment ENVCANParser.pm.patch added
Add wind gust speed parsing.
Changed 5 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 5 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 5 years ago by Joe Ripley <vitaminjoe@…>
- Attachment envcan.patch added
Patch to include Environment Canada grabber as produced by 'svn diff'.
comment:5 Changed 5 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 5 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 5 years ago by stuartm
- Status changed from new to closed
- Resolution set to fixed
comment:8 Changed 5 years ago by stuartm
Changed 5 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 5 years ago by Joe Ripley <vitaminjoe@…>
- Status changed from closed to reopened
- Resolution fixed deleted
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 5 years ago by stuartm
- Status changed from reopened to closed
- Resolution set to fixed

Maps Enviroment Canada icons to MythWeather? icons