Skip to contents

calculates a flux based on the rate of change of gas concentration over time

Usage

flux_calc(
  slopes_df,
  slope_col,
  datetime_col = "f_datetime",
  conc_unit,
  flux_unit,
  cut_col = c(),
  keep_arg = c(),
  chamber_volume = 24.5,
  tube_volume = 0.075,
  atm_pressure = 1,
  plot_area = 0.0625,
  cols_keep = c(),
  cols_ave = c(),
  fluxid_col = "f_fluxID",
  temp_air_col = "temp_air",
  temp_air_unit = "celsius",
  fit_type = c()
)

Arguments

slopes_df

dataframe of flux slopes

slope_col

column containing the slope to calculate the flux (in ppm*s^(-1))

datetime_col

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.

conc_unit

unit in which the concentration of gas was measured ppm or ppb

flux_unit

unit in which the calculated flux will be mmol outputs fluxes in mmol*m^(-2)h^(-1); micromol outputs fluxes in micromolm^(-2)*h^(-1)

cut_col

column containing cutting information

keep_arg

name in cut_col of data to keep

chamber_volume

volume of the flux chamber in L, default for Three-D project chamber (25x24.5x40cm), can also be a column in case it is a variable

tube_volume

volume of the tubing in L, default for summer 2020 setup, can also be a column in case it is a variable

atm_pressure

atmospheric pressure, assumed 1 atm, can be a constant (numerical) or a variable (column name)

plot_area

area of the plot in m^2, default for Three-D, can also be a column in case it is a variable

cols_keep

columns to keep from the input to the output. Those columns need to have unique values for each flux, as distinct() is applied.

cols_ave

columns with values that should be averaged for each flux in the output. Note that NA are removed in mean calculation.

fluxid_col

column containing the fluxID

temp_air_col

column containing the air temperature used to calculate fluxes. Will be averaged with NA removed.

temp_air_unit

units in which air temperature was measured. Has to be either Celsius, Fahrenheit or Kelvin.

fit_type

(optional) model used in flux_fitting, exponential, quadratic or linear. Will be automatically filled if slopes_df was produced using flux_quality().

Value

a dataframe containing fluxID, fluxes (in mmol*m^(-2)h^(-1) or micromolm^(-2)*h^(-1), depending on the value of flux_unit), temperature average for each flux, slope used for each flux calculation, the model used in flux_fitting, and any columns specified in cols_keep and cols_ave.

Examples

data(slopes0)
flux_calc(slopes0,
slope_col = "f_slope",
conc_unit = "ppm",
flux_unit = "mmol")
#> Averaging air temperature for each flux...
#> Calculating fluxes...
#> R constant set to 0.082057
#> Concentration was measured in ppm
#> Fluxes are in mmol/m2/h
#> # A tibble: 6 × 11
#>   f_fluxID f_slope_calc chamber_volume tube_volume atm_pressure plot_area
#>      <dbl>        <dbl>          <dbl>       <dbl>        <dbl>     <dbl>
#> 1        1        1.56            24.5       0.075            1    0.0625
#> 2        2        0.853           24.5       0.075            1    0.0625
#> 3        3        0.303           24.5       0.075            1    0.0625
#> 4        4        1.13            24.5       0.075            1    0.0625
#> 5        5        1.46            24.5       0.075            1    0.0625
#> 6        6        0.426           24.5       0.075            1    0.0625
#> # ℹ 5 more variables: temp_air_ave <dbl>, datetime <dttm>, volume_setup <dbl>,
#> #   flux <dbl>, model <chr>