Calculates summary statistics for flow and pollutant concentrations for desired flow categories. Estimates "average" pollutant load per category based on average concentration times the median flow.
Arguments
- .tbl
data frame, prefferably the output from
calc_ldc()
.- 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".
- Exceedance
variable name in .tbl with flow/load exceedance probabilities.
- groups
variable name in .tbl with categorized flow names.
- method
string that describes the summary statistic used for the pollutant concentration. Must be one of
c('geomean', 'mean', 'median')
.
Value
object of class tibble. Includes Flow Category grouping variable, median flow and exceedance values, geometric mean/mean/median pollutant concentration, and estimated average load based on median flow times the average pollutant concentration per flow category.
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)
# Summarize LDC
df_sum <- summ_ldc(df_ldc,
Q = Flow,
C = Indicator_Bacteria,
Exceedance = P_Exceedance,
groups = Flow_Category,
method = "geomean")
df_sum
#> # A tibble: 3 × 6
#> Flow_Category Median_Flow Median_P Geomean_C Median_Daily_Fl… Median_Flow_Load
#> <fct> [ft^3/s] <dbl> [cfu/100… [100mL/d] [cfu/d]
#> 1 High Flows 31.9 0.205 201. 780457599. 156839317356.
#> 2 Medium Flows 14.5 0.603 81.0 354753454. 28727125809.
#> 3 Low Flows 9.18 0.897 77.5 224473306. 17399766767.
## cleanup
remove_unit("cfu")