Learn R Programming

README

RavenR

RavenR is an R package for handling Raven hydrologic modelling framework inputs, outputs, and diagnostics.

Installation

The CRAN version of the package may also installed with:

install.packages("RavenR")

You can also install the latest RavenR version from github with:

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

The developmental version can be installed from the dev branch with:

if (!require(devtools)) install.packages("devtools")
library(devtools)
devtools::install_github("rchlumsk/RavenR", ref="dev")

Tutorials and Quick Start Guide

Please see the package vignette for an overview of the RavenR package. Sample data is included in the package, so you need only to install the RavenR library and follow along in the guide documents to get started.

The RavenR vignette can be accessed with the browseVignettes function.

browseVignettes("RavenR")

Citation

citation("RavenR")

To cite RavenR in publications, use:

Robert Chlumsky, James Craig, Leland Scantlebury, Simon

Lin, Sarah Grass, Genevieve Brown and Rezgar Arabzadeh (2022). RavenR: Raven Hydrological Modelling Framework R Support and Analysis. R package version 2.1.7. https://github.com/rchlumsk/RavenR

A BibTeX entry for LaTeX users is:

@Manual{RavenRPackage,
title = {RavenR: Raven Hydrological Modelling Framework R Support and Analysis},
author = {Robert Chlumsky and James Craig and Leland Scantlebury and Simon Lin and Sarah Grass and Genevieve Brown and Rezgar Arabzadeh},
year = {2022},
note = {R package version 2.1.7},
url = {https://github.com/rchlumsk/RavenR},
}

RavenR Wishlist

Any issues or feature requests can be submitted on the Github Issues page as an issue, or discussed more openly on the new Github Discussions page.

Version Update Notes

2.1.7

Minor updates and bug fixes, including:

  • added new functions including rvn_rvp_fill_template for filling in rvp template files, rvn_met_recordplot to show station record lenghts;
  • added function for plotting subbasin network with interactive visNetwork library
  • updated rvn_run with additional options, including adding rvi commands to the file before execution;
  • added new model templates from Raven Manual v3.5 to rvn_rvi_write_template;
  • enhancements to rvn_rvh_read for splitting subbasin and HRU information in separate files, other minor improvements; and
  • bug fix in rvn_rvt_write for writing initial start date with correct month code;

2.1.4

Updates to a number of functions and new features implemented, including:

  • removal of all dependencies on spatial packages (e.g. sf, raster), and removal of the netcdf-related functions;
  • rvn_download and rvn_run to enable downloading and running Raven.exe within R;
  • rvn_rvi_write_template to write model rvi files from templates in the Raven manual;
  • rvn_budyko_plot to generate a budyko curve from model precip, AET, and PET;
  • updates to rvi mapping, including improvements to add functionality from ggrepel library in spacing labels, and addition of the DiagrammeR library to support rvn_rvi_process_diagrammer;
  • rvn_budyko_plot to generate a budyko curve from model precip, AET, and PET;
  • updates to handling rvt reading and writing, which is now generic for all rvt types; and
  • rvn_met_interpolate for performing inverse distance weighting interpolation to fill missing data values in meteorological data (works immediately with weathercan downloads).

2.0.0

Major updates to the package, including core package styling such as function case, naming conventions, and use of ggplot2 libraries for plotting. Some of these include:

  • all core RavenR functions have an ‘rvn_’ prefix to specify the package origin;
  • functions and input/output variables now use an underscore naming convention, rather than periods or camelCase;
  • ggplot2 is now the default plotting library for plotting functions, and some plotting arguments have been reduced, as ggplot objects may be modified in post-production by the user;
  • many new functions added;
  • new sample data sets and examples, including tidying of all function examples and addition of netcdf files to test netcdf-related functions; and
  • multiple bug fixes and improvements to handling rvi, rvh, and writing rvt files.

See Also

Copy Link

Version

Install

install.packages('RavenR')

Monthly Downloads

606

Version

2.2.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Robert Chlumsky

Last Published

October 28th, 2022

Functions in RavenR (2.2.0)

rvn_budyko_plot

Budkyo Plot
rvn_calc_runoff_coeff

Generate runoff coefficients upstream of gauges
rvn_apply_wyearly

Apply function for water year
rvn_apply_wyearly_which_max_xts

which.max over water year periods
rvn_annual_quantiles_plot

Plot of Annual Median, Upper and Lower Quantiles of Flow
rvn_annual_volume

Annual Volume Comparison
rvn_fdc_plot

Plots summary of watershed forcing functions
rvn_custom_data

Custom Output Data from Raven
rvn_exhaustive_mb_read

Read in Raven Exhaustive Mass Balance file
rvn_download

Downloads Raven
rvn_flow_residuals

Residuals of model flows
rvn_forcing_data

Forcings Data from Raven
rvn_forcings_plot

Plots summary of watershed forcing functions
rvn_fortify_xts

Fortify xts object to specific format
rvn_df_to_Raven_table

Sets up tables for writing to Raven input files
rvn_forcings_read

Read in Raven ForcingFunctions file
rvn_dist_lonlat

Calculate distance from long/lat
rvn_gen_obsweights

Create weights time series for calibration/diagnostic evaluation
rvn_hyd_dygraph

Read in Raven Hydrograph file
rvn_run

Run Raven Executable
rvn_num_days_month

Number of Days in Month
rvn_flow_spaghetti

Flow Spaghetti Plot
rvn_flow_scatterplot

Scatterplot of model flows
rvn_hydrograph_data

Hydrograph Data from Raven
rvn_res_read

Read in Raven ReservoirStages file
rvn_res_dygraph

Plot Raven reservoir/lake stage time series using dygraph
rvn_met_interpolate

Interpolate meteorological data using IDW
rvn_hyd_extract

Extract function for Raven Hydrograph object
rvn_get_prd

Check period input
rvn_hyd_plot

Create Hydrograph Plot
rvn_month_names

Months in the Year vector
rvn_met_recordplot

EC Climate Gauge Record Overlap Visualization
rvn_hyd_read

Read in Raven Hydrograph file
rvn_rvh_subbasin_network_plot

Basic Raven subbasin network plot
rvn_res_extract

Extract function for Raven Reservoir object
rvn_rvc_from_custom_output

Generate RVC file from Custom Output CSVs
rvn_res_plot

Plot Reservoir Stage
rvn_rvh_read

Read Raven .rvh (watershed discretization) file
rvn_rvh_query

Queries RVH object for subbasins and HRUs of interest
rvn_rvh_write_subbasingroup

Write a subbasin group to Raven RVH format
rvn_rvi_connections

Generate Hydrological process connections list
rvn_num_days

Number of Days between two dates
rvn_monthly_vbias

Monthly Volume Bias
rvn_rvh_subbasin_visnetwork_plot

Plot subbasin network using visNetwork
rvn_rvh_blankSBdf

Generate Blank Raven SubBasin DataFrame
rvn_rvc_write

Write Raven Initial Condition (rvc) file
rvn_rvt_write_met

EC Climate Station File Conversion
rvn_rvi_write_template

Write Raven rvi file based on model configuration templates
rvn_rvp_fill_template

Rewrite template rvp file with values
rvn_rvh_blankHRUdf

Generate Blank Raven HRU DataFrame
rvn_rvh_cleanhrus

Clean HRU data table.
rvn_substrMLeft

substring minus characters from the Left
rvn_rvi_read

Read Raven .rvi (watershed discretization) file
rvn_rvc_res

Create initial conditions file for Reservoirs
rvn_substrLeft

substring from the Left
rvn_rvi_process_ggplot

Plot Raven hydrologic process network
rvn_write_Raven_header

Write common Raven file header
rvn_which_max_xts

which.max for xts objects
rvn_rvh_summarize

Summarize RVH object
rvn_rvh_overwrite

Write/Overwrite Raven rvh file
rvn_substrRight

substring from the Right
rvn_substrMRight

substring minus characters from the Right
rvn_watershed_read

Read in Raven WatershedStorage file
rvn_watershedmeb_read

Read in Raven WatershedMassEnergyBalance file
rvn_rvi_getparams

Retrieve Parameter Information from RVI file Algorithms
rvn_stringpad

Pads string with spaces, either right or left justified
rvn_rvi_process_diagrammer

Plot Raven hydrologic process network using DiagrammeR
rvn_rvt_mappings_data

Rvt Mappings Data
rvn_theme_RavenR

RavenR ggplot theme
rvn_rvt_read

Read .rvt (Raven time series) file
rvn_rvt_tidyhydat

EC Streamgauge File Conversion from tidyhydat
rvn_xts_plot

Create plot from xts data
rvn_tidyhydat_sample

tidyhydat sample data for RavenR package
rvn_watershed_data

Watershed Storage Data from Raven
rvn_rvt_write

Write Raven rvt file from Time Series
rvn_ts_infill

Infill discontinuous time series with blank values
rvn_weathercan_sample

weathercan sample data for RavenR package
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_weathercan_metadata_sample

weathercan sample metadata for RavenR package
rvn_wyear_indices

Water Year Indices
rvn_write_Raven_table

Writes a nicely formatted tables of Raven attributes/parameters
rvn_annual_peak_event

Annual Peak Event Comparison
rvn_annual_peak_event_error

Annual Peak Event Errors
rvn_annual_peak_error

Annual Peak Errors
RavenR-package

RavenR
rvn_annual_peak

Annual Peak Comparison
cmax

cmax
rvn_annual_peak_timing_error

Annual Peak Timing Errors
rvn_annual_quantiles

Calculates Yearly Median, Upper and Lower Quantiles of Flow
%notin%

%notin% operator
%>%

Pipe operator See magrittr::%>% for details.
rvn_cum_plot_flow

Cumulative Plot of model flows
rvn_custom_output_plot

Plot Raven Custom Output
rvn_custom_read

Read Raven Custom Output files