Water Quality Models for Drinking Water Treatment Processes

Provides multiple water chemistry-based models and published empirical models in one standard format. As many models have been included as possible, however, users should be aware that models have varying degrees of accuracy and applicability. To learn more, read the references provided below for the models implemented. Functions can be chained together to model a complete treatment process and are designed to work in a 'tidyverse' workflow. Models are primarily based on these sources: Benjamin, M. M. (2002, ISBN:147862308X), Crittenden, J. C., Trussell, R., Hand, D., Howe, J. K., & Tchobanoglous, G., Borchardt, J. H. (2012, ISBN:9781118131473), USEPA. (2001) < https://www.epa.gov/sites/default/files/2017-03/documents/wtp_model_v._2.0_manual_508.pdf>.


tidywater

R-CMD-check

Overview

Tidywater incorporates published water chemistry and empirical models in a standard format. The modular functions allow for building custom, comprehensive drinking water treatment processes. Functions are designed to work in a tidyverse workflow.

Installation

# Install tidywater from CRAN:
install.packages("tidywater")

# Alternatively, install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("BrownandCaldwell-Public/tidywater")

Examples

In this first example, acid-base chemistry and TOC removal models are demonstrated. This example uses tidywater base functions to model a single water quality scenario.

library(tidywater)
library(tidyverse)
## Use base tidywater functions to model water quality for a single scenario.
base_coagulation <- define_water(ph = 8, alk = 90, tds = 50, toc = 3, doc = 2.8, uv254 = 0.08) %>%
  chemdose_ph(alum = 30) %>%
  chemdose_toc(alum = 30)
#> Warning in chemdose_ph(., alum = 30): Sulfate-containing chemical dosed, but
#> so4 water slot is NA. Slot not updated because background so4 unknown.

To model multiple water quality scenarios, use tidywater’s helper functions (x_chain or x_once) to apply the models to a dataframe.

## x_chain functions apply models to a list of "waters", and output a list of "waters" so that
## the data can be piped into the next tidywater model.
coagulation <- water_df %>%
  define_water_chain(output_water = "raw") %>%
  mutate(alum = 30) %>%
  chemdose_ph_chain(input_water = "raw", output_water = "phchange") %>%
  chemdose_toc_chain(input_water = "phchange", output_water = "coag")
#> Warning: `chemdose_toc_chain()` was deprecated in tidywater 0.10.0.
#> ℹ Please use `chemdose_toc_df()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> Warning: `chemdose_ph_chain()` was deprecated in tidywater 0.10.0.
#> ℹ Please use `chemdose_ph_df()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> Warning: `define_water_chain()` was deprecated in tidywater 0.10.0.
#> ℹ Please use `define_water_df()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

## To get out individual parameters, use `pluck_water`
coagulation <- coagulation %>%
  pluck_water(input_waters = c("raw", "coag"), parameter = c("ph", "doc"))

Note that these functions use a “water” class. The “water” class is the foundation of the package; it provides a mechanism for linking models in any order while maintaining water quality information. The define_water function takes water quality inputs, but define_water_chain may be used to convert a dataframe to a list of “waters”.

For more detailed examples on tidywater functions and how to use “water” class data, please see the tidywater vignettes: browseVignettes("tidywater")

Limitations

This project is maintained by volunteers and is provided without warranties or guarantees of any kind.

Use at your own risk. For official support, please contact Brown and Caldwell.

Please read our CONTRIBUTING.md and SECURITY.md before submitting issues or pull requests.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("tidywater")

0.10.0 by Sierra Johnson, a year ago


https://github.com/BrownandCaldwell-Public/tidywater


Report a bug at https://github.com/BrownandCaldwell-Public/tidywater/issues


Browse source code at https://github.com/cran/tidywater


Authors: Sierra Johnson [aut, cre] , Libby McKenna [aut] , Riley Mulhern [aut] , Chris Corwin [aut] , Rachel Merrifield [ctb] , Mayuri Namasivayam [ctb] , Phoebe Chen [ctb] , Jiaming Yuan [ctb] , USEPA [cph] (Copyright holder of included TELSS fragments (dissolve_pb function)) , Brown and Caldwell [fnd, cph]


Documentation:   PDF Manual  


Apache License (>= 2) | MIT + file LICENSE license


Imports dplyr, tidyr, forcats, knitr, ggplot2, ggrepel, magrittr, methods, rlang, deSolve, lifecycle

Suggests rmarkdown, purrr, testthat


See at CRAN