Home About Downloads Forum RavenR the Team

RavenR is an R library for pre- and post-processing of Raven input and output. It includes a wide range of tools for hydrologic analysis, described below. Even with very little knowledge of R, you can put together a simple workflow script to run the model and produce visual output or initially set up a Raven model by importing meteorological and streamflow data. The tools here are readily supplemented by the model-independent hydrology tools of the Canadian hydRology project.

If interested in getting the newest development version, or participating in development, please go to the RavenR GitHub page. Otherwise, the newest release version is available on the Raven downloads page. Once you have downloaded the .tar.gz file from the downloads page, run the following line of code in RStudio (or use the Tools->Install Packages... menu):

install.packages(path_to_file, repos = NULL, type="source")

Where path_to_file is the full path and file name in quotes, e.g., "C:/TEMP/RavenR_1.3.0.tar.gz" on Windows or "home/temp/RavenR_1.3.0.tar.gz" on Linux. The source code is accompanied by tutorials on how to use RavenR (in the Tutorials folder).



Summary of Tools

** denotes new features in RavenR 1.2

Pre-processing

Processing Input Time Series:
  • ECmet.rvt
  • converts Environment Canada historical meteorological data for a given station into .rvt format
  • ECflow.rvt
  • converts Environment Canada historical streamgauge data from the Water Survey Canada into .rvt format
  • obsfile.gen**
  • converts observation in R xts format to .rvt formatted observation file
  • obsweights.gen**
  • creates observation weights to define calibration/validation periods based upon user specifications
  • timeseries.infill**
  • generates continuous time series from time series data with date gaps
Reading, Visualizing, & Manipulating Raven Input Files:
  • subbasinNetwork.plot**
  • reads the .rvh file and plots the subbasin network
  • rvh.read**
  • reads in model input .rvh file and returns subbasin and HRU dataframes with additional data such as contributing area to subbasins and subbasin network graph
  • rvh.write**
  • writes datatables of HRU and subbasin data to new (otherwise empty) .rvh file
  • rvh.overwrite**
  • writes datatables of HRU and SubBasin data to preexisting .rvh file, leaving other content
  • rvh.cleanHRUs**
  • reduces the number of HRUs in an .rvh file by removing small HRUs and consolodating similar ones
Post-processing & Visualization

Ingesting Raven Output:
  • custom.read
  • reads in any custom output file and returns as readily manipulable xts dataframe
  • forcings.read
  • reads in ForcingFunctions.csv and returns as xts dataframe
  • hyd.read / hyd.extract
  • reads in Hydrographs.csv and returns as xts dataframe
  • res.read / res.extract
  • reads in ReservoirStages.csv and returns as xts dataframe
  • watershed.read
  • reads in WatershedStorage.csv and returns as xts dataframe
  • watershedmeb.read
  • reads in WatershedMassEnergyBalance.csv and returns as xts dataframe
Plotting Raven Output - Hydrograph diagnostics:
  • annual.peak
  • annual.peak.error
  • annual.peak.event
  • annual.peak.event.error
  • annual.peak.timing.error
  • a variety of routines for plotting simulated vs. observed peak flow magnitudes and timings
  • annual.volume
  • plots simulated vs. observed annual cumulative volume flowthrough
  • monthly.vbias
  • plots simulated vs. observed monthly volume bias
  • cum.plot.flow
  • creates a cumulative flow plot of the simulated flows
  • flow.spaghetti
  • flow.scatterplot
  • flow.residuals
  • creates a residuals time series plot for flow values, with optional smoothing
  • flowdurcurve.plot
  • generates side-by-side observed and simulated flow duration curves
Plotting Raven Output - Internal diagnostics:
  • calc.runoff.coeff **
  • calculates estimated bulk runoff coefficients at all gauged basins
  • customoutput.plot
  • plots contents of a custom output .csv file
  • forcings.plot
  • plots watershed forcings summary
  • res.plot
  • plots observed vs. simulated reservoir stage
Additional Utilities
  • apply.wyearly
  • apply.wyearly.cols
  • enables aggregation of xts data based upon water year
Ostrich support routines
  • Ost.bestparams, Ost.params.compare, Ost.plot, Ost.read