CSHS-CWRA / CSHShydRology

Main package
GNU Affero General Public License v3.0
35 stars 39 forks source link

Added AHCCD functions #10

Closed KevinShook closed 5 years ago

KevinShook commented 5 years ago

Description

I've added 4 functions to read in AHCCD daily and monthly precips and temps. The data are in EC's awful month x day or year x month formats. The header may be in English or English and French

Related Issue

Example

Each function reads in a single .txt file, e.g. monthly_total_precip <- read_AHCCD_monthly_temp("mt3011120.txt")

Unfortunately we can't distribute the daily values, and the monthly files are contained in a single huge .zip file, so I can't think of how to incorporate automated tests. I'm attaching some test files, but it might be a good idea to get some other ones, esp. as they change the file formats without warning. The data location is indicated in the documentation for each function.

The first character of the file name indicates its time step (d - daily, m- monthly). The second indicates the data type, whether precip or temp and the type of value, either min, max or mean. mt3011120.txt ms3011120.txt dt1126150.txt dm1085835.txt

KevinShook commented 5 years ago

I've re-written the functions so that there are single functions to read in monthly and daily values, respectively. I've added a function to d/l a single station from the EC site as well. This could be improved by removing the need to specify the province. However, that would require getting the station list, which seems to only be accessible through the WMS server.

boshek commented 5 years ago

Looks good to me!