Level2Volume {EmiStatR}R Documentation

Function for linear interpolation given the relationship of two variables

Description

Given a relationship between two variables (e.g. level and volume), this function interpolates the corresponding second variable (e.g. volume) for a known value of the first variable (e.g. level). This function is suitable to represented e.g. the dynamics of water storage in a combined sewer overflow chamber.

Usage

Level2Volume(lev, lev2vol)

Arguments

lev

A numeric object that represents the know variable e.g. the level in a storage chamber.

lev2vol

A list of two elements. The first element is a vector named "lev" that contains the interpolation steps of the first variable (e.g. level). The second element is a vector that contains the interpolation steps of the second variable (e.g. volume).

Details

The function uses the approx function from the stats package with "yleft" argument equal to the minimum value of the second variable and "yright" argument equal to the maximum value of the second variable.

Value

A numeric object with one element representing the interpolated value of the second variable (e.g. volume).

Author(s)

J.A. Torres-Matallana; K. Klepiszewski; G. Schutz.

Examples

library(EmiStatR)

# definition of relationship level to volume
lev2vol <- list(lev = c(.06, 1.10, 1.30, 3.30), vol = c(0, 31, 45, 200))

interpolated_volume <- Level2Volume(lev=c(0, .25, 1.25, 2.25, 4.25), lev2vol = lev2vol)
interpolated_volume

[Package EmiStatR version 1.2.3.0 Index]