calc_ldc: Calculate load duration curve

Description Usage Arguments Details Value Examples

View source: R/calc_ldc.R

Description

Calculates the period of record load duration curve from a data frame that includes mean daily flow and associated point measurements of pollutant concentration.

Usage

1
2
3
4
5
6
7
8
9
calc_ldc(
  .tbl,
  Q = NULL,
  C = NULL,
  allowable_concentration = NULL,
  breaks = c(1, 0.8, 0.4, 0),
  labels = c("High Flows", "Medium Flows", "Low Flows"),
  estimator = 6
)

Arguments

.tbl

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

Q

variable name in .tbl for discharge or flow. This must have unit set, typically "ft^3/s".

C

variable name in .tbl for associated pollutant concentration at a given flow value. This must have a unit set, typically "mg/L" or "cfu/100mL".

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.

estimator

numeric, one of c(5,6,7,8,9). 6 is the default method correponding to the Weibull plotting position. Further details are provided in stats::quantile().

Details

The exceedance probability is 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.

Value

object of class tibble. 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).

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
# 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_ldc(df,
                   Q = Flow,
                   C = Indicator_Bacteria,
                   allowable_concentration = allowable_concentration)
df_ldc

## cleanup
remove_unit("cfu")

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