calc_annual_ldc: Calculate annualized load duration curve

Description Usage Arguments Details Value References Examples

View source: R/calc_annual_ldc.R

Description

Calculates the median annual ldc with confidence intervals.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
calc_annual_ldc(
  .tbl,
  Q = NULL,
  C = NULL,
  Date = NULL,
  allowable_concentration = NULL,
  breaks = c(1, 0.8, 0.4, 0),
  labels = c("High Flows", "Medium Flows", "Low Flows"),
  conf_level = 0.9,
  estimator = 6,
  n = 500
)

Arguments

.tbl

data frame with at least three columns Q (discharge or flow), C (associated pollutant concentration), and Date.

Q

variable name in .tbl for discharge or flow. This must be of class 'units', typically with a units value of "ft^3/s".

C

variable name in .tbl for associated pollutant concentration at a given flow value. This must be of class 'units', typically with a units value of "mg/L" or "cfu/100mL".

Date

variable name in .tbl for the event Date. This variable must be of class 'Date'.

allowable_concentration

an object of class units specifying the allowable pollutant concentration.

breaks

a numeric vector of break points for flow categories. Must be of length of labels + 1. defaults to c(1, 0.8, 0.4, 0).

labels

labels for the categories specified by breaks.

conf_level

numeric, confidence level (default is 0.9) of the median interval at given exceedance probability.

estimator

one of c(5,6,7,8,9,"hd"). 6 is the default method correponding to the Weibull plotting position. Further details are provided in quantile. "hd" uses the Harrell-Davis Distribution-Free Quantile Estimator (see: hdquantile).

n

numeric, the length of generated probability points. Larger n may result in a slightly smoother curve at a cost of increased processing time. The probability points are used to generate the continuous sample quantiles types 5 to 9 (see quantile).

Details

The median annual ldc is calculated by computing the flow duration curve for each individual year in the dataset. Exceedance probabilities are calculated from the descending order of Daily Flows. By default, the Weibull plotting position is used:

p = P(Q > q_i) = \frac{i}{n+1}

where q_i, i = 1, 2, ... n, is the i-th sorted streamflow value.

The median streamflow +/- chosen confidence interval is calculated at each exceedance probability. The load duration curve is calculated by multiplying the median streamflow by the allowable concentration and appropriate conversions.

Value

list of two tibbles (Q and C). Includes variables in .tbl and Daily_Flow_Volume (discharge volume), Daily_Load (pollutant sample volume), P_Exceedance (exeedance probability), Flow_Category (as defined by breaks and labels).

References

Vogel, Richard M., and Neil M. Fennessey. "Flow-duration curves. I: New interpretation and confidence intervals." Journal of Water Resources Planning and Management 120, no. 4 (1994): 485-504. doi: 10.1061/(ASCE)0733-9496(1994)120:4(485)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Basic example using built in Tres Palacios data
library(dplyr)
library(units)
# Format data
install_unit("cfu")
df <- as_tibble(tres_palacios) %>%
  ## filter data so this run quicker
  filter(!is.na(Indicator_Bacteria)) %>%
  ## flow must have units, here is is in cfs
  mutate(Flow = set_units(Flow, "ft^3/s")) %>%
  ## pollutant concentration must have units
  mutate(Indicator_Bacteria = set_units(Indicator_Bacteria, "cfu/100mL"))
# Calculate LDC

## specify the allowable concentration
allowable_concentration <- 126
## set the units
units(allowable_concentration) <- "cfu/100mL"
df_ldc <- calc_annual_ldc(df,
                   Q = Flow,
                   C = Indicator_Bacteria,
                   Date = Date,
                   allowable_concentration = allowable_concentration,
                   estimator = 5,
                   n = 1000)
df_ldc$Q

## cleanup
remove_unit("cfu")

TxWRI/ldc documentation built on Feb. 13, 2022, 9:22 a.m.