define_water: Create a water class object given water quality parameters
Description
This function takes user-defined water quality parameters and creates an S4 "water" class object that forms the input and output of all tidywater models.
A water class object where slots are filled or calculated based on input parameters.
Arguments
ph
water pH
temp
Temperature in degree C
alk
Alkalinity in mg/L as CaCO3
tot_hard
Total hardness in mg/L as CaCO3
ca
Calcium in mg/L Ca2+
mg
Magnesium in mg/L Mg2+
na
Sodium in mg/L Na+
k
Potassium in mg/L K+
cl
Chloride in mg/L Cl-
so4
Sulfate in mg/L SO42-
free_chlorine
Free chlorine in mg/L as Cl2. Used when a starting water has a free chlorine residual.
combined_chlorine
Combined chlorine (chloramines) in mg/L as Cl2. Used when a starting water has a chloramine residual.
tot_po4
Phosphate in mg/L as PO4 3-. Used when a starting water has a phosphate residual.
tot_nh3
Total ammonia in mg/L as N
tds
Total Dissolved Solids in mg/L (optional if ions are known)
cond
Electrical conductivity in uS/cm (optional if ions are known)
toc
Total organic carbon (TOC) in mg/L
doc
Dissolved organic carbon (DOC) in mg/L
uv254
UV absorbance at 254 nm (cm-1)
br
Bromide in ug/L Br-
f
Fluoride in mg/L F-
fe
Iron in mg/L Fe3+
al
Aluminum in mg/L Al3+
mn
Manganese in ug/L Mn2+
Details
Carbonate balance is calculated and units are converted to mol/L. Ionic strength is determined from ions, TDS, or conductivity.
Missing values are handled by defaulting to 0 or NA.
Calcium defaults to 65 percent of the total hardness when not specified. DOC defaults to 95 percent of TOC.