Learn R Programming

bdrc - Bayesian Discharge Rating Curves

This software package fits a discharge rating curve based on the power-law and the generalized power-law from data on paired water elevation and discharge measurements in a given river using a Bayesian hierarchical model as described in Hrafnkelsson et al. (2022). Four models are implemented:

plm0() - Power-law model with a constant error variance. This is a Bayesian hierarchical implementation of the most commonly used discharge rating curve model in hydrological practice.

plm() - Power-law model with error variance that varies with water elevation.

gplm0() - Generalized power-law model with a constant error variance. The generalized power-law is introduced in Hrafnkelsson et al. (2022).

gplm() - Generalized power-law model with error variance that varies with water elevation. The generalized power-law is introduced in Hrafnkelsson et al. (2022).

Installation

# Install release version from CRAN
install.packages("bdrc")
# Install development version from GitHub
devtools::install_github("sor16/bdrc")

Getting started

It is very simple to fit a discharge rating curve with the bdrc package. All you need are two mandatory input arguments, formula and data. The formula is of the form y~x where y is discharge in ms and x is water elevation in m (it is very important that the data is in the correct units). data is a data.frame which must include x and y as column names. As an example, we will use data from the Swedish gauging station Krokfors, which is one of the datasets that come with the package. In this table, the Q column denotes discharge while W denotes water elevation:

gplm.fit <- gplm(Q~W,krokfors)

To dig deeper into the functionality of the package and the different ways to visualize a discharge rating curve model for your data, we recommend taking a look at our two vignettes.

References

Hrafnkelsson, B., Sigurdarson, H., and Gardarsson, S. M. (2022). Generalization of the power-law rating curve using hydrodynamic theory and Bayesian hierarchical modeling, Environmetrics, 33(2):e2711.

Copy Link

Version

Install

install.packages('bdrc')

Monthly Downloads

310

Version

1.1.0

License

MIT + file LICENSE

Maintainer

Solvi Rognvaldsson

Last Published

March 19th, 2023

Functions in bdrc (1.1.0)

gplm0

Generalized power-law model with a constant variance
gplm

Generalized power-law model with variance that varies with stage.
jokfjoll

Jokulsa a Fjollum gauging station in Iceland
autoplot.plm0

Autoplot method for discharge rating curves
evaluate_game

Compare two models using a specified model selection criteria
plot.tournament

Plot method for discharge rating curve tournament
kallstorp

Kallstorp gauging station in Sweden
plm0

Power-law model with a constant variance
plm

Power-law model with variance that varies with stage.
nordura

Nordura gauging station in Iceland
krokfors

Krokfors gauging station in Sweden
norn

Norn gauging station in Sweden
plot_fun

Plot bdrc model objects
melby

Melby gauging station in Sweden
spread_draws

Spread MCMC chain draws to data.frame on a wide format
plot.plm0

Plot method for discharge rating curves
summary.tournament

Summary method for a discharge rating curve tournament
print.tournament

Print method for discharge rating curve tournament
spanga

Spanga gauging station in Sweden
summary.plm0

Summary method for discharge rating curves
skogsliden

Skogsliden gauging station in Sweden
theme_bdrc

Custom bdrc theme
tournament

Tournament - Model comparison
skjalf

Skjalfandafljot gauging station in Iceland
predict.plm0

Predict method for discharge rating curves
print.plm0

Print method for discharge rating curves
jokdal

Jokulsa a Dal gauging station in Iceland
gather_draws

Gather MCMC chain draws to data.frame on a long format
autoplot.tournament

Autoplot method for discharge rating curve tournament
get_report

Report for a discharge rating curve or tournament
get_report_pages

Report pages for a discharge rating curve or tournament