Home About Downloads Utilities RavenR Forum 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.

The RavenR package is available on the Comprehensive R Archive Network (CRAN), and can be installed directly within R/RStudio with the following line of code (or in RStudio, use the Tools -> Install Packages... menu):

install.packages("RavenR")

Alternatively, if you are interested in getting the newest development version, or participating in the development of the package, please go to the RavenR GitHub page. The development version of RavenR can be installed directly from Github using the devtools package, with the following lines of code:

install.packages("devtools")
library(devtools)
devtools::install_github("rchlumsk/RavenR")

The source code on Github is accompanied by a vignettes folder with tutorials on how to use RavenR. Additional scripting workflows are also available on this page (see Example .Rmd Scripts).




Summary of Tools

** denotes new features in RavenR 2.0

Pre-processing

Processing Input Time Series:
  • rvn_df_to_Raven_table**
  • Sets up tables for writing to Raven input files
  • rvn_gen_gridweights**
  • Generate Raven grid weights from shapefile
  • rvn_gen_obsweights
  • creates observation weights to define calibration/validation periods based upon user specifications
  • rvn_netcdf_to_gridshp**
  • Generate grid overlay from netCDF file XXX
  • rvn_rvt_ECmet
  • converts Environment Canada historical meteorological data for a given station into .rvt format
  • rvn_rvt_flow**
  • Write Raven rvt file from Flow Series
  • rvn_rvt_obsfile
  • Converts observation in R xts format to .rvt formatted observation file
  • rvn_rvt_obsweights
  • Create Raven observation data weight (rvt) file
  • rvn_rvt_read**
  • Read .rvt (Raven time series) file
  • rvn_rvt_tidyhydat**
  • EC Streamgauge File Conversion from tidyhydat
  • rvn_rvt_write**
  • Write Raven rvt file from Time Series
  • rvn_rvt_wsc
  • converts Environment Canada historical streamgauge data from the Water Survey Canada into .rvt format
  • rvn_ts_infill
  • generates continuous time series from time series data with date gaps
Reading, Visualizing, & Manipulating Raven Input Files:
  • rvn_rvc_res**
  • Create initial conditions file for Reservoirs
  • rvn_rvh_blankHRUdf **
  • Generate Blank Raven HRU DataFrame
  • rvn_rvh_blankSBdf**
  • Generate Blank Raven SubBasin DataFrame
  • rvn_rvh_cleanhrus
  • Clean HRU data table.
  • rvn_rvh_overwrite
  • Write/Overwrite Raven rvh file
  • rvn_rvh_read
  • Read Raven .rvh (watershed discretization) file
  • rvn_rvh_write
  • Write/Overwrite Raven rvh file
  • rvn_rvi_read**
  • Read Raven .rvi (model input) file
  • rvn_write_Raven_header**
  • Write common Raven file header
  • rvn_write_Raven_label**
  • Writes common Raven labeled line to file, with optional value (appends)
  • rvn_write_Raven_newfile**
  • Opens/Creates a new file, writes common file header.
  • rvn_write_Raven_table**
  • Writes a nicely formatted tables of Raven attributes/parameters
Post-processing & Visualization

Ingesting Raven Output:
  • rvn_custom_read
  • Read Raven Custom Output files
  • rvn_exhaustive_mb_read**
  • Read in Raven Exhaustive Mass Balance file
  • rvn_forcings_read
  • Read in Raven ForcingFunctions file
  • rvn_hyd_read
  • Read in Raven Hydrograph file
  • rvn_hyd_extract**
  • Extract function for Raven Hydrograph object
  • rvn_res_extract**
  • Extract function for Raven Reservoir object
  • rvn_res_read
  • Read in Raven ReservoirStages file
  • rvn_watershedmeb_read
  • Read in Raven WatershedMassEnergyBalance file
  • rvn_watershed_read
  • Read in Raven WatershedStorage file
Plotting Raven Output - Hydrograph diagnostics:
  • rvn_annual_peak
  • Plot Annual Peak Comparison
  • rvn_annual_peak_error
  • Plot Annual Peak Errors
  • rvn_annual_peak_event
  • Plot Annual Peak Event Comparison
  • rvn_annual_peak_event_error
  • Plot Annual Peak Event Errors
  • rvn_annual_peak_timing_error
  • Plot Annual Peak Timing Errors
  • rvn_annual_quantiles **
  • Calculates Yearly Median, Upper and Lower Quantiles of Flow
  • rvn_annual_quantiles_plot **
  • Plot of Annual Median, Upper and Lower Quantiles of Flow
  • rvn_annual_volume
  • Plot Annual Volume Comparison
  • rvn_cum_plot_flow
  • Cumulative Plot of model flows
  • rvn_fdc_plot
  • Plots flow duration curve comparison
  • rvn_flow_residuals
  • Plot Residuals of model flows
  • rvn_flow_scatterplot
  • Plot Scatterplot of model flows
  • rvn_flow_spaghetti
  • Plot Flow Spaghetti Plot
  • rvn_hyd_dygraph **
  • Plot hydrograph time seriess using shiny dygraph
  • rvn_hyd_plot **
  • Create Hydrograph Plot
  • rvn_monthly_vbias
  • Plot Monthly Volume Bias
Plotting Raven Output - Internal diagnostics:
  • rvn_calc_runoff_coeff **
  • Generate runoff coefficients upstream of gauges
  • rvn_custom_output_plot
  • Plot Raven custom output
  • rvn_forcings_plot
  • Plots summary of watershed forcing functions
  • rvn_rvi_process_plot **
  • Plot Raven hydrologic process network
  • rvn_subbasin_map **
  • Plot Continuous Data Using Subbasin Shapefile
  • rvn_subbasin_network_plot **
  • Plot Raven subbasin network.
  • rvn_res_dygraph **
  • Plot Raven reservoir/lake stage time series using dygraph
  • rvn_res_plot
  • Plot Reservoir Stage
Additional Utilities
  • rvn_apply_wyearly
  • Apply function for water year
  • rvn_apply_wyearly_which_max_xts **
  • Which.max over water year periods
  • rvn_get_prd **
  • Check period input
  • rvn_rvi_connections **
  • Generate Hydrological process connections list