Typically it will be most convenient to use flux
on objects returned by chop
(i.e. on lists of data tables that contain all necessary data per chamber measurement including supporting information). flux
simply wraps flux.odae
and flux.conv
applied on lists of chamber measurement data tables into one function. Thus, the data of a one day field campaign or a year of chamber measurements can easily be handled by simply running two functions (chop
and flux
) consecutively to estimate ghg fluxes for all three common ghg gases. See example.Probably the most important argument is var.par
. It specifies the variables (by referring to the names of the data columns) from x
and parameters (fixed values that are constant for all chamber placements) that are used for the flux estimations. For simple handling it is expecting a named list.
For flux
the obligatory list items are: One item that refers to a column in x
containing ghg concentrations (see next paragraph for details); time
– chamber closing time in minutes; volume
– chamber volume during placement (in cbm); area
– chamber area (in sqm); t.air
– air temperature inside chamber during concentration measurements (in °C); p.air
– air pressure during concentration measurements (in Pa).
The list items that are used to specify the ghg for which flux estimation is carried out have to be specified by using the named list items CH4
– $CH_4$ concentrations; CH4.gcq
– $CH_4$ GC quality flag; CO2
– $CO_2$ concentrations; CO2.gcq
– $CO_2$ GC quality flag; N2O
– $N_2O$ concentrations; N2O.gcq
– $N_2O$ GC quality flag. Fluxes are estimated for all ghg for which concentration data are given. Thus, at least one ghg should be specified. GC quality flags are optional. If you don't provide a reference to a column in x
the function assumes that all GC measurements were OK.
All these list items can either be given as a variable (name of a column in x
) or as a fixed parameter (a numeric value). This makes no sense for the ghg
s and time
, but in many cases chamber volume
and area
will be constant across measurements. Another likely candidate for a fixed parameter is p.air
because air pressure is often not logged during chamber measurements. All additional list items should be of type ‘variable‘ and refer to further columns in x
if you want those data handed through the function and be part of the result tables (for having all data in one place for further analyses). You are free to choose appropriate names. Fixed parameters will not be relayed.
If the flux estimation is carried out in two steps it will typically be carried out on a list structure as returned by chop
. Therefore, it is used within a lapply
call. For details see examples. However, the functions flux.odae
and flux.conv
are designed to be carried out on single data tables (data.frame
) per chamber measurement.
First flux.odae
is run. It simply tries to find the best model fit for the series of concentration measurements that are given in dat
. This data.frame
has to consist of five columns that give (in that order): gas concentration, closing time of the chamber in minutes, gas concentration quality flag, chamber volume, temperature within the chamber headspace during measurements (may change during chamber placement). See example data.
At the moment the optimization bases on linear regression. All possible models with n (= total number of concentration measurements per chamber placement) to min.allowed
number of concentration measurements are fitted and the best fit is evaluated in a stepwise procedure. The normalized root mean square error is used as the quality criterion for the outlier detection and elimination procedure. All model fits with a nrmse <= max.nrmse are extracted and ranked according to the number of concentration measurements (decreasing) and to the nrmse (increasing). The first ranked model is stored along with the original data table and some other information. Therefore a model with e.g. a nrmse of 0.081 constructed from 5 concentration measurements wins against a model with a nrmse of 0.07 with only 4 concentration measurements. This reflects the idea that models with nrmse <= max.nrmse already represent a sufficient fit and do not have "outliers" that must be eliminated. =>=>
In case no model has a nrmse <= max.nrmse, the models are simply ranked according to their nrmse and the model with the lowest nrmse wins and is stored. In that way outliers are detected and exluded. flux.odae
returns a complex object that contains most of the necessary information for the flux.conv
function and also carries information that is later needed for the plot functions (plot.flux
and plot.fluss
). =>
The flux calculation is then carried out with the function flux.conv
. It takes the object returned by flux.odae
and additional information (chamber area, gas species, several quality settings and in- as well as output units) and calculates the flux rates. Further several quality checks (r2 check, range check, nrmse check, nomba check; for details see Value) are carried out and quality flags are reported along with the fluxes in the output. It is best when all quality flags are returned TRUE
. Depending on the application quality requirements might vary. Therefore, per default the function reports soft quality flags (despite for range). However, this can be changed via hardflag
.
The idea behind co2ntrol
in flux
is that the $CO_2$ concentration measurements might serve as a further check on the integrity of the chamber measuremnt in the field. When co2ntrol
is set, the function first carries out an outlier procedure on the $CO_2$ concentration data (the respective columns have to be in x
of course). Further, the slope of the $CO_2$ concentration change over time is checked. When it is negative, chamber leakage is assumed and a respective quality flag (leak.flag
) is reported FALSE. The leak.flag
cannot be hard flagged.