Flux calculation

The function goFlux calculates fluxes from a variety of greenhouse gases (CO2, CH4, N2O, NH3, CO, and H2O) using both linear (LM) and non-linear (HM) (Hutchinson & Mosier, 1981) flux calculation methods. The HM model for the chamber concentration \(C_t\) at time \(t > 0\) after deployment is given by:

\[\mathbf{Eqn~1}~~~~~~C_t = \varphi~+~(C_0 - \varphi)e^{-~\kappa~t} \tag{1}\]

Where \(\varphi\) is the assumed concentration of constant gas source below the surface (also known as \(C_i\)), \(C_0\) is the concentration in the chamber at the moment of chamber closure and \(\kappa\) (kappa) determines the curvature of the model. A large kappa returns a strong curvature.

A maximum threshold for this parameter, kappa-max (\(k.max\)), can be calculated from the linear flux estimate (\(LM.flux\)), the minimal detectable flux (\(MDF\)) and the time of chamber closure (\(t\)) (Hüppi et al., 2018).

\[\mathbf{Eqn~2}~~~~~~k.max = \frac{LM.flux}{MDF~\times~t} \tag{2}\]

Where \(LM.flux\) and \(MDF\) have the same units (nmol or µmol·m-2·s-1) and \(t\) is in seconds. Therefore, the units of kappa-max is s-1. This limit of kappa-max is included in the goFlux function, so that the non-linear flux estimate cannot exceed this maximum curvature. See below for more details about the minimal detectable flux (MDF).

All flux estimates, including the MDF, are multiplied by a \(flux.term\) which is used to correct for water vapor inside the chamber, as well as convert the units to obtain a term in nmol or µmol·m-2·s-1:

\[\mathbf{Eqn~3}~~~~~~flux.term = \frac{(1 - H_2O)~V~P}{A~R~T}\]

Where \(H_2O\) is the water vapor in mol·mol-1, \(V\) is the volume inside the chamber in liters, \(P\) is the pressure in kPa, \(A\) is the surface area inside the chamber in m2, \(R\) is the universal gas constant in L·kPa·K-1·mol-1, and \(T\) is the temperature inside the chamber in Kelvin. Each parameters are measured inside the chamber at \(t = 0\).

Usage

Note

Code chunks under Usage sections are not part of the demonstration. They are meant to show you how to use the arguments in the function.

goFlux(
  dataframe,
  gastype,
  H2O_col = "H2O_ppm",
  prec = NULL,
  Area = NULL,
  offset = NULL,
  Vtot = NULL,
  Vcham = NULL,
  Pcham = NULL,
  Tcham = NULL,
  k.mult = 1,
  warn.length = 60,
  k.min = 10^-8
)

Arguments

dataframe a data.frame containing gas measurements (see gastype below), water vapor measurements (see H2O_col below) and the following columns: UniqueID, Etime, Vtot, Area, Pcham, Tcham and flag (see the parameters Vtot, Area, Pcham and Tcham below for more details). chamID may be used instead of UniqueID.
gastype character string; specifies which column should be used for the flux calculations. Must be one of the following: “CO2dry_ppm”, “CH4dry_ppb”, “COdry_ppb”, “N2Odry_ppb”, “NH3dry_ppb” or “H2O_ppm”.
H2O_col character string; specifies which column should be used to subtract the effect of water vapor in the chamber space. Default is H2O_col = "H2O_ppm".
prec numerical value; precision of the instruments. Units must be the same as gastype. With the default prec = NULL, instrument precision for each gas must be provided in dataframe.
Area numerical value; area of the soil surface inside the chamber (cm2). Alternatively, provide the column Area in dataframe if Area is different between samples.
offset (optional) numerical value; height between the soil surface and the chamber (cm). Alternatively, provide the column offset in dataframe if offset is different between samples. offset is only used if Vtot is missing.
Vtot numerical value; total volume inside the chamber, tubes, instruments, etc. (L). Alternatively, provide the column Vtot in dataframe if Vtot is different between samples. If Vtot is missing, the function will calculate it from Area, Vcham and offset.
Vcham (optional) numerical value; volume inside the chamber, tubes and instruments (L). Alternatively, provide the column Vcham in dataframe if Vcham is different between samples. Vhcam is only used if Vtot is missing.
Pcham numerical value; pressure inside the chamber (kPa). Alternatively, provide the column Pcham in dataframe if Pcham is different between samples. If Pcham is not provided, normal atmospheric pressure (101.325 kPa) is used.
Tcham numerical value; temperature inside the chamber (Celsius). Alternatively, provide the column Tcham in dataframe if Tcham is different between samples. If Tcham is not provided, 15°C is used as default.
k.mult numerical value; a multiplier for the allowed kappa-max. Default setting is no multiplier (k.mult = 1). k.mult cannot be negative and must be smaller or equal to 10.
warn.length numerical value; limit under which a measurement is flagged for being too short (nb.obs < warn.length).
k.min numerical value; a lower boundary value for kappa in the HM model. Default is k.min = 10^-8

Details

Flux estimate units are µmol m-2s-1 (if initial concentration is ppm, e.g. CO2dry_ppm) and nmol m-2s-1 (if initial concentration is ppb, e.g. CH4dry_ppb).

The goFlux function calculates flux estimates from the linear model (LM) and the Hutchinson and Mosier model (HM). The HM model is a non-linear model, whose curvature is controlled by the parameter kappa. A large kappa returns a strong curvature. A maximum threshold for this parameter, kappa-max (k.max), can be calculated from the linear flux estimate (LM.flux), the minimal detectable flux (MDF) and the time of chamber closure. This limit of kappa-max is included in the goFlux function, so that the non-linear flux estimate cannot exceed this maximum curvature. Inversely, one can set a minimal threshold for kappa: to allow for a log-like curvature, set k.min below 0 (ex. -1), otherwise it should be just above 0 (ex. 10^-8). k.min cannot be 0 as this would result in a singular gradient.

All flux estimates, including the MDF, are multiplied by a flux.term which is used to correct for water vapor inside the chamber, as well as convert the units to obtain a term in nmol or µmol m-2s-1.

The argument Area is in (cm2), but the output units from the goFlux function are in (m2). This means that there is a factor of 10,000 to convert from (cm2) to (m2). This is important to take into account if one would provide something else than an Area in (cm2) to the function. For example, with incubated soil samples, one may provide an amount of soil (kg) instead of an Area. To get the right units in that case, multiply the kilograms of soil by 10,000 to remove the conversion from (cm2) to (m2).

In gastype, the gas species listed are the ones for which this package has been adapted. Please write to the maintainer of this package for adaptation of additional gases.

warn.length is the limit below which the chamber closure time is flagged for being too short (nb.obs < warn.length). Portable greenhouse gas analyzers typically measure at a frequency of 1 Hz. Therefore, for the default setting of warn.length = 60, the chamber closure time should be approximately one minute (60 seconds). If the number of observations is smaller than the threshold, a warning is printed: e.g. “Low number of observations: UniqueID X has 59 observations”.

Value

The function returns a data frame with 28 columns: a UniqueID per measurement, 11 columns for the linear model results (linear flux estimate (LM.flux), initial gas concentration (LM.C0), final gas concentration (LM.Ct), slope of linear regression (LM.slope), mean absolute error (LM.MAE), root mean square error (LM.RMSE), Akaike’s information criterion corrected for small sample size (LM.AICc), standard error (LM.SE), relative standard error (LM.se.rel), coefficient of determination (LM.r2), and p-value (LM.p.val)), 11 columns for the non-linear model results (non-linear flux estimate (HM.flux), initial gas concentration (HM.C0), the assumed concentration of constant gas source below the surface (HM.Ci), slope at t=0 (HM.slope), mean absolute error (HM.MAE), root mean square error (HM.RMSE), Akaike’s information criterion corrected for small sample size (HM.AICc), standard error (HM.SE), relative standard error (HM.se.rel), coefficient of determination (HM.r2), and curvature (kappa; HM.k), as well as the minimal detectable flux (MDF), the precision of the instrument (prec), the flux term (flux.term), kappa-max (k.max), the g factor (g.fact; g.factor), the number of observations used (nb.obs) and the true initial gas concentration (C0) and final gas concentration (Ct).

Example

data(manID.UGGA)
CO2_flux <- goFlux(manID.UGGA, "CO2dry_ppm")
CH4_flux <- goFlux(manID.UGGA, "CH4dry_ppb")
Tip: Use the function on multiple files at a time

To load multiple RData files at once in your environment and store them all in one object, use the function map_df from the package purrr.

Use the argument pattern to load only the files that match a pattern.

my.files <- list.files(path = "RData", pattern = "imp.RData", full.names = TRUE) %>%
  map_df(~ get(load(.x)))

CO2_flux <- goFlux(my.files, "CO2dry_ppm")

References

Hüppi, Roman, Felber, Raphael, Krauss, Maike, Six, Johan, Leifeld, Jens, & Fuß, Roland. (2018). Restricting the nonlinearity parameter in soil greenhouse gas flux calculation for more reliable flux estimates. PLOS ONE, 13(7), e0200876. https://doi.org/10.1371/journal.pone.0200876
Hutchinson, G. L., & Mosier, A. R. (1981). Improved Soil Cover Method for Field Measurement of Nitrous Oxide Fluxes. Soil Science Society of America Journal, 45(2), 311–316. https://doi.org/10.2136/sssaj1981.03615995004500020017x