dampen_vec: Dampen inputs of rpmodel

View source: R/subroutines.R

dampen_vecR Documentation

Dampen inputs of rpmodel

Description

Applies an exponential dampening input time series with specified time scale.

Usage

dampen_vec(vec, tau)

Arguments

vec

A numeric vector for the time series of a daily meteorological variable used as input for rpmodel (temperature, vapour pressure deficit, CO2, or atmospheric pressure). The length of x must be at least 365, i.e., corresponding to one year.

tau

The time scale of dampening (e-folding time scale of a perturbation). Must be smaller or equal to 365 d.

Value

A numeric vector of equal length as x with damped variation. The dampening is calculated as:

S(t+1) - S(t) = (X(t+1) - S(t)) / τ

Where X is the daily varying time series given by argument x, S is the dampened time returned by this function, and τ is the decay time scale of a perturbation, given by argument tau.

Examples

## Not run: 
dampen_vec(
 vec = 20 * (sin(doy*pi/(365)))^2 + rnorm(365, mean = 0, sd = 5),
 tau = 40 
 )

## End(Not run)

stineb/rpmodel documentation built on Feb. 21, 2023, 8:37 a.m.