R Packages for CRHM and other hydrological applications

R is Free Open Source Software (FOSS), used widely for data handling and statistical analysis. It is available for all computer platforms at http://www.r-project.org/. Using R is made much easier by RStudio, a free development environment available at http://www.rstudio.com/. As well as acting as a stand-alone program, R can be used as a programming language. The language is extensible with several thousands of packages, each of which contains many functions.

Dr Kevin Shook (email) has written packages of R functions to solve the problems of creating CRHM input data sets, and post-processing model output.

The input functions allow data to be read in, infilled and exported to CRHM .obs files. All of the functions that create or change .obs files write to logfiles, so that the sources of all of the data in each .obs file, and all of the processing that was done, are always recorded.

The post-processing functions read in data from any CRHM model, and allow it to be aggregated.

All of the code is also FOSS, and is released under the Gnu Public Licence (GPL) version 3. Note that all of the packages depend on other R packages, and several contain code written by others. Please acknowledge use of these packages in any publications.

The following packages, together with manuals and release notes, are available through the CH GitHub Repository:

  • CRHMr: Reads in CRHM inputs and outputs: does aggregation, interpolation, imputation, and creates .obs files
  • MSCr: Reads daily and sub-daily meteorological data from the Meteorological Service of Canada (MSC) web server, and saves to CRHM .obs files: also reads daily and monthly data from the Adjusted and Homogenized Canadian Climate Data (AHCCD)
  • WATCHr: Creates CRHM .obs files from WATCH reanalysis data
  • WISKIr: Reads time series directly from a WISKI web server


Web Disclaimer
Centre for Hydrology
University of Saskatchewan
e-mail webmaster