Aggregate a time series of fluxes to a cummulative flux value.
Usage
agg.fluxes(fluxes, datetimes, timeunit = "hours")
Value
A one-row data.frame with columns
flux
the cumulative flux
from
the start of the cumulation period
to
the end of the cumulation period
The return value being a data.frame is useful, when the function is used for "split-apply-combine" type operations to calculate groupwise cumulated values,
e.g., using package data.table.
Arguments
fluxes
flux values
datetimes
datetime values (POSIXct or POSIXlt)
timeunit
the unit of time (denominator of the flux unit), supported are the explicit units supported by difftime
Details
The function uses linear interpolation. The unit of the cumulative flux is [fluxes] * timeunit.
NA values are removed and values sorted according to time order. If less then two non-NA value pairs are provided,
NA is returned for the cumlative flux.