Calculates a flux based on the rate of change of gas concentration over time
flux_calc(
slopes_df,
slope_col,
f_datetime = f_datetime,
temp_air_col,
chamber_volume = deprecated(),
setup_volume,
atm_pressure,
plot_area,
f_fluxid = f_fluxid,
conc_unit,
flux_unit,
cols_keep = c(),
cols_ave = c(),
cols_sum = c(),
cols_med = c(),
cols_nest = "none",
tube_volume = deprecated(),
temp_air_unit = "celsius",
f_cut = f_cut,
keep_arg = "keep",
cut = TRUE,
fit_type = c()
)a dataframe containing flux IDs, datetime of measurements' starts,
fluxes (f_flux) in the units defined with flux_unit, temperature average
for each flux in the same unit as the input (f_temp_ave), the model used in
flux_fitting, any column specified in
cols_keep, any column specified in cols_ave, cols_med or cols_sum
with their values treated accordingly over the measurement after cuts, and a
column nested_variables with the variables specified in cols_nest.
dataframe of flux slopes
column containing the slope to calculate the flux
column containing the datetime of each gas concentration
measurements in slopes_df. The first one after cutting will be kept as
datetime of each flux in the output.
column containing the air temperature used to calculate fluxes. Will be averaged with NA removed.
volume of the flux chamber and instrument together in L, can also be a column in case it is a variable
atmospheric pressure in atm, can be a constant (numerical) or a variable (column name)
area of the plot in m^2, can also be a column in case it is a variable
column containing the flux IDs
unit in which the concentration of gas was measured
mmol/mol, ppm, ppb, or ppt
desired units for the calculated fluxes. Has to be of the
form amount/surface/time. Amount can be mol, mmol, umol, nmol or
pmol. Time can be d (day), h (hour), mn (minute) or s (seconds).
Surface can be m2, dm2 or cm2.
columns to keep from the input to the output. Those columns need to have unique values for each flux, as distinct is applied.
columns with values that should be averaged
for each flux in the output. Note that NA are removed in mean calculation.
Those columns will get the _ave suffix in the output.
columns with values for which is sum is provided
for each flux in the output. Those columns will get the _sum suffix in the
output.
columns with values for which is median is provided
for each flux in the output. Note that NA are removed in median calculation.
Those columns will get the _med suffix in the output.
columns to nest in nested_variables for each flux in the
output. Can be character vector of column names, "none" (default) selects
none, or "all" selects all the column except those in cols_keep.
units in which air temperature was measured.
Has to be either celsius (default), fahrenheit or kelvin.
column containing cutting information
name in f_cut of data to keep
if 'TRUE' (default), the measurements will be cut according to
'f_cut' before calculating fluxes. This has no influence on the flux itself
since the slope is provided from flux_fitting,
but it will influence the values of the variables in cols_ave, cols_cum,
and cols_med.
(optional) model used in
flux_fitting. Will be automatically filled if
slopes_df was produced using flux_fitting.
data(co2_conc)
slopes <- flux_fitting(co2_conc, conc, datetime, fit_type = "exp_zhao18")
flux_calc(slopes,
f_slope,
datetime,
temp_air,
conc_unit = "ppm",
flux_unit = "mmol/m2/h",
setup_volume = 24.575,
atm_pressure = 1,
plot_area = 0.0625)
Run the code above in your browser using DataLab