flux.calib {flux} | R Documentation |
Determine calibration measurement ranges according to the dates of real measurements
Description
The function basically takes calibration gas measurements and extracts the calibration gas measurements that have been carried out temporally close to a real data measurement and calculates the standard deviation of the calibration gas measurements. The obtained range limits can be used in flux
as a quality parameter (via range.lim
).
Usage
flux.calib(dat, columns, calib, format = "%Y-%m-%d %H:%M:%S",
window = 3, buffer = 1000, n.cg = 4, rl.backup = 20, attach = FALSE)
Arguments
dat |
Object returned by |
columns |
Character vector giving the names of the two columns that shall be taken from |
calib |
|
format |
Character string specifying the format of dates in |
window |
Integer value. Hours. Window around the date and time (if available) of measurement of the field greenhouse gas concentrations at the measurement device (e.g. a GC) that shall be considered for the inclusion of calibration gas measurements. If no times are given |
buffer |
Numeric. Concentration buffer around the range of concentration measurements in |
n.cg |
Integer. Number of calibration gas concentrations in |
rl.backup |
Numeric value. Range limit backup value that is used in situations where no range limit can be derived from the calibration measurements. See details. Defaults to a quite reasonable 20. Deprecated. |
attach |
Logical. If TRUE the range limits are attached to the original data. |
Details
The function automatically detects the single species of calibration gases that have been measured. It calculates the standard deviations of the measurements per calibration gas species and than gives back an average of the calculated range limit values if there are more than one calibration gas concentrations covered by the range within the field concentration measurements per chamber placement. However, this is rather academic because a chamber measurement for which concentrations develop over the range of two or more calibration concentrations will typically not have a range limit problem.
In its actual form it is possible that there are no valid calibration measurements found for certain chamber data because the range of the chamber data (even with range extension) does not cover any of the calibration gas concentrations. In this case, the minimum range limit is assigned if rl.backup
= NULL.
Value
Returns a named vector with the range limits of the measurement device (as needed within flux
) per chamber measurement or attaches the range limits to the original data tables that are in x
and returns the altered x
.
Author(s)
Gerald Jurasinski <gerald.jurasinski@uni-rostock.de>
See Also
Examples
## load example data
data(tt.pre)
## extract field concentration measurements
gcd <- tt.pre[tt.pre$sampletype_a=="P",]
## partition the data into data tables per chamber measurement
gcd.parts <- chop(gcd, factors = c("date", "spot", "veg"),
nmes = c("date", "veg", "spot"))
## calculate range limits according to the data and the accompanying
## calibration gas measurements
# extract and prepare calibration measurements
cal <- tt.pre[tt.pre$sampletype_a=="E",c("date_gc", "CH4ppb", "CH4Code",
"CO2ppm", "CO2Code", "N2Oppb", "N2OCode")]
names(cal)[1] <- "date"
cal$date <- "2011-03-16"
# calculate the range limits per gas (makes no real sense with such
# a small dataset).
# CH4 range limits
CH4.lims <- flux.calib(gcd.parts, columns = c("date", "CH4ppb"),
calib = cal, format="%Y-%m-%d", window=48, attach=FALSE, buffer=1100)
# N2O range limits
N2O.lims <- flux.calib(gcd.parts, columns = c("date", "N2Oppb"),
calib = cal, format="%Y-%m-%d", window=48, attach=FALSE, buffer=1100)
# CO2 range limits
CO2.lims <- flux.calib(gcd.parts, columns = c("date", "CO2ppm"),
calib = cal, format="%Y-%m-%d", window=48, attach=FALSE, buffer=1100)
## attach the range limits to the original data
gcd.parts.cal <- flux.calib(gcd.parts, columns = c("date", "CH4ppb"),
calib = cal, format = "%Y-%m-%d", attach = TRUE, window=48, buffer=1100)