Description Usage Arguments Details Value References Examples
View source: R/calc_annual_ldc.R
Calculates the median annual ldc with confidence intervals.
1 2 3 4 5 6 7 8 9 10 11 12 |
.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 |
breaks |
a numeric vector of break points for flow categories. Must be
of length of labels + 1. defaults to |
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 |
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 |
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.
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).
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)
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.