df: a data frame containing a water class column, which has already been computed using define_water_chain. The df may include a column indicating the EBCT or whether the water is ozonated.
input_water: name of the column of Water class data to be used as the input for this function. Default is "defined_water".
ebct: The empty bed contact time (min) used for the biofilter
ozonated: Logical; TRUE if the water is ozonated (default), FALSE otherwise
Returns
A data frame with updated DOC, TOC, and BDOC concentrations.
Details
The data input comes from a water class column, as initialized in define_water_chain.
If the input data frame has column(s) named "ebct" or "ozonated", the function uses those as arguments. Note: The function can use either a column or the direct function arguments, not both.
tidywater functions cannot be added after this function because they require a water class input.
For large datasets, using fn_once or fn_chain may take many minutes to run. These types of functions use the furrr package for the option to use parallel processing and speed things up. To initialize parallel processing, use plan(multisession) or plan(multicore) (depending on your operating system) prior to your piped code with the fn_once or fn_chain functions. Note, parallel processing is best used when your code block takes more than a minute to run, shorter run times will not benefit from parallel processing.
Examples
library(purrr)library(furrr)library(tidyr)library(dplyr)example_df <- water_df %>% define_water_chain()%>% biofilter_toc_once(input_water ="defined_water", ebct =10, ozonated =FALSE)example_df <- water_df %>% define_water_chain()%>% mutate( ebct = rep(c(10,15,20),4), ozonated = c(rep(TRUE,6), rep(FALSE,6)))%>% biofilter_toc_once(input_water ="defined_water")# Initialize parallel processingplan(multisession, workers =2)# Remove the workers argument to use all available computeexample_df <- water_df %>% define_water_chain()%>% biofilter_toc_once(input_water ="defined_water", ebct = c(10,20))# Optional: explicitly close multisession processingplan(sequential)