This R-package is dedicated to separation and calculation of diffusive and ebullitive (bubble) fluxes. Determination of ebullitive events is characterized by sudden increase in concentration over a short period of time. Thus, to determine ebullitive events a running variance approach is used. If the running variance is above a user-set threshold value, the data is considered an ebullitive event. Ebullitive events can then be calculated as the difference from the lowest concentration value to either the highest or the last value. Furthermore, correct identification of ebullitive events can be visually inspected when using the function. The functions also allows for several parameters to be changed, for full list of parameters see the R documentation for each function (called by ?function). The function for diffusive flux also looks for ebullitive events, to avoid diffusive flux being calculated post an ebullitive event. This function can likewise be turned off.
For citing this package follow the instructions on https://zenodo.org/doi/10.5281/zenodo.8297153
Self-Made Equipment for Automatic Methane Diffusion and Ebullition Measurements From Aquatic Environments. Sø et al 2024
Sø. J.S. (2023). JonasStage/FluxSeparator: v1.0.0 (v1.0.0). Zenodo. DOI
remotes::install_github('JonasStage/FluxSeparator')
As of now the package consists of four functions and one dataset. A quick walkthrough of the functions is listed here, for more information and examples on usage see the R documentation of each function:
library(FluxSeparator)
# read in model coef
model_coef <- read_csv("model_coef.csv")
# path to DIY sensors files
path_to_files <- list.files(pattern = ".csv")
# create data frame for path, sensor, and station.
data_path <- tibble(path = path_to_files,
sensor = c(1,2,3,4),
station = c(1,2,4,3))
# join with model_coef and calculate CH4 in ppm.
data <- read_CH4_files(data_path,
path)
The read_CH4_files function allows for easy import and transformation of data files measured using the the low-cost methane and carbon dioxide sensors propsed by Sø et al., (2023). The function imports data and uses the individual calibration values from the dataframe model_coef to transform the sensor voltage, temperature and humidity into methane concentration (ppm).
data(DIY_sensor_data)
A dataset is included which holds two runs (PumpCycle), with the first only experiencing diffusive methane flux, whereas the second experiences ebullitive flux. This is data from an older version of the sensor, which has a low analog-to-digital converter, and thus the concentration changes occurs in steps. If using a newer version of the sensor this is not the case.
# Load dataset
DIY_sensor_data <- data(DIY_sensor_data)
ebul_flux <- DIY_sensor_data %>%
ebullitive_flux()
The ebullitive_flux function allows for identification of ebullitive events in multiple data seperated by station and PumpCycle. The function determines ebullitive events based on a running variance approach, in which a user-set threshold values is set (runvar_cutoff). The resulting dataframe is the ebullitive flux based on the ebullitive events determined. The function show plots of all data and areas which are considered ebullitive events, if show_plots is set to TRUE.
# Load dataset
DIY_sensor_data <- data(DIY_sensor_data)
diff_flux <- DIY_sensor_data %>%
diffusive_flux()
The diffusive_flux function allows for calculation of diffusive flux before any ebullitive events or disregarding ebullitive events (look_for_bubbles = FALSE). The diffusive flux is calculated by a linear model and the corresponding slope, R2 and number of observations is the result. The runvar_cutoff for each sensor should be set to the same value as the corresponding ebullitive_flux.
# Using the ebullitive flux function
DIY_sensor_data %>%
ebullitive_flux() %>%
mutate(umol_m2_h1_flux = ppm_to_umol(pressure,
concentration_per_time,
volume,
temp,
area))
# Using the diffusive flux function
DIY_sensor_data %>%
diffusive_flux() %>%
mutate(umol_m2_h1_flux = ppm_to_umol(pressure,
concentration_per_time,
volume,
temp,
area))
The ppm_to_umol function allows for conversion of ppmV h-1 to µmol m-2 h-1. The function is called within the mutate function and atmospheric pressure, volume and area should be given to the function.