Skip to contents

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

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().

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).

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.

Examples

# 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
#> # A tibble: 72 × 9
#>    site_no  Date           Flow Indicator_Bacteria Daily_Flow_Volume  Daily_Load
#>    <chr>    <date>     [ft^3/s]        [cfu/100mL]         [100mL/d]     [cfu/d]
#>  1 08162600 2011-09-28     4.99                770        122084120.     9.40e10
#>  2 08162600 2009-09-09     5.52                 92        135050970.     1.24e10
#>  3 08162600 2003-06-24     7.12                 10        174196179.     1.74e 9
#>  4 08162600 2009-06-11     7.7                 160        188386317.     3.01e10
#>  5 08162600 2010-12-16     8.99                 93        219947142.     2.05e10
#>  6 08162600 2008-12-16     9.06                 74        221659744.     1.64e10
#>  7 08162600 2012-01-04     9.15                220        223861662.     4.92e10
#>  8 08162600 2002-06-12     9.2                  74        225084950.     1.67e10
#>  9 08162600 2016-02-10     9.46                 32        231446047.     7.41e 9
#> 10 08162600 2016-04-06     9.46                 31        231446047.     7.17e 9
#> # … with 62 more rows, and 3 more variables: Allowable_Daily_Load [cfu/d],
#> #   P_Exceedance <dbl>, Flow_Category <fct>

## cleanup
remove_unit("cfu")