add_st: Apply Storage Flux Correction

View source: R/Data_handling.R

add_stR Documentation

Apply Storage Flux Correction

Description

Correction of matter or energy flux (flux) with storage computed using discrete (one point) approach (st) or profile measurement of CO2 concentration (stp).

Usage

add_st(flux, st, stp = NULL, name_out = "-")

Arguments

flux

A numeric vector with flux values.

st

A numeric vector with storage computed using discrete (one point) approach.

stp

A numeric vector with storage computed using profile measurement of CO2.

name_out

A character string providing varnames value of the output.

Details

If both storage estimates are available, stp takes priority. If both st and stp estimates are NA, original flux value is kept. flux, st and stp (if not NULL) must have the same length.

Value

A vector with attributes varnames and units is produced. varnames value is set by name_out argument. units value is extracted from flux vector by units or set to default "-".

See Also

units.

Examples

aa <- matrix(ncol = 3, nrow = 10, byrow = TRUE, c(-1, 1, 2),
             dimnames = list(NULL, c("flux", "st", "stp")))
aa[c(4, 8, 9, 11, 15, 18, 22, 25, 27, 29)] <- NA
(aa <- as.data.frame(aa))
aa$flux_stc <- add_st(aa$flux, aa$st, aa$stp, "flux_stc")
aa
lapply(aa, attributes)


lsigut/openeddy documentation built on Aug. 5, 2023, 12:25 a.m.