Skip to contents

Calculate a time series of load values from time series of concentration and discharge.

Usage

conc_to_load(
  conc,
  flow,
  conc_unit = "mg L-1",
  flow_unit = "m3 s-1",
  out_unit = "kg day-1"
)

Arguments

conc

Data frame with a date column and one or many columns with concentration values. The number of concentration columns must be the same as the number of discharge columns in the data frame flow.

flow

Data frame with a date column and one or many columns with discharge values. The number of flow columns must be the same as the number of concentration columns in the data frame conc.

conc_unit

Unit of the concentration values provided as a text string in the format 'mass volume-1. Default is 'mg L-1'.

flow_unit

Unit of the discharge values provided as a text string in the format 'volume time-1. Default is 'm3 s-1'.

out_unit

Unit of the load values provided as a text string in the format 'mass time-1. Default is 'kg day-1'.

Value

A table with date column and calculated concentration values.

Examples

if (FALSE) {
# Example usage:
date_conc <- seq(as.Date('2000-01-01'), as.Date('2000-12-31'), by = '2 week')
date_flow <- seq(as.Date('2000-01-01'), as.Date('2000-12-31'), by = 'day')

c_df <- data.frame(date = date_conc,
                   value = runif(length(date_conc)))

f_df <- data.frame(date = date_flow,
                   value = runif(length(date_flow)))

load <- conc_to_load(conc = c_df, flow = f_df, out_unit = 'tons day-1')
}