flux_fitting {fluxible} | R Documentation |
Fitting a model to concentration data and estimating the slope
Description
fits gas concentration over time data with a model (exponential, quadratic or linear) and provides the slope later used to calculate gas fluxes with flux_calc
Usage
flux_fitting(
conc_df,
start_cut = 0,
end_cut = 0,
start_col = "f_start",
end_col = "f_end",
datetime_col = "f_datetime",
conc_col = "f_conc",
fluxid_col = "f_fluxID",
t_window = 20,
cz_window = 15,
b_window = 10,
a_window = 10,
roll_width = 15,
t_zero = 0,
fit_type
)
Arguments
conc_df |
dataframe of gas concentration over time |
start_cut |
time to discard at the start of the measurements (in seconds) |
end_cut |
time to discard at the end of the measurements (in seconds) |
start_col |
column with datetime when the measurement started |
end_col |
column with datetime when the measurement ended |
datetime_col |
column with datetime of each concentration measurement |
conc_col |
column with gas concentration data |
fluxid_col |
column with ID of each flux |
t_window |
enlarge focus window before and after tmin and tmax (exponential fit) |
cz_window |
window used to calculate Cz, at the beginning of cut window (exponential fit) |
b_window |
window to estimate b. It is an interval after tz where it is assumed that the model fits the data perfectly (exponential fit) |
a_window |
window at the end of the flux to estimate a (exponential fit) |
roll_width |
width of the rolling mean for CO2 when looking for tz, ideally same as cz_window (exponential fit) |
t_zero |
time at which the slope should be calculated (for quadratic fit) |
fit_type |
exponential, quadratic or linear. Exponential is using the exponential model from Zhao et al (2018) |
Value
a dataframe with the slope at t zero, and parameters of a model of gas concentration over time
References
Zhao, P., Hammerle, A., Zeeman, M., Wohlfahrt, G., 2018. On the calculation of daytime CO2 fluxes measured by automated closed transparent chambers. Agricultural and Forest Meteorology 263, 267–275. https://doi.org/10.1016/j.agrformet.2018.08.022
Examples
data(co2_conc)
flux_fitting(co2_conc, fit_type = "exp")
flux_fitting(co2_conc, fit_type = "quadratic", t_zero = 10, end_cut = 30)