knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(dplyr)
library(glimmr)

TRAVIS <- !identical(tolower(Sys.getenv("TRAVIS")), "true")
knitr::opts_chunk$set(purl = TRAVIS)

glimmr is an R package that makes it easier to process and handle data from dynamic flux measurements and provides functions to use with the boundary layer Equation (BLE).

(Dynamic-) chamber measurements

Approach

During applications of dynamic chambers, typically two kinds of datasets are created: One continous dataset, provided by the gas analyzer, containing the gas mixing ratios and one metadataset with information about the single chamber applications. Typically this contains an ID of the spot location, time of the measurement start (and end) and maybe the chamber temperature.

glimmr reads both datasets, slices the concentration data into chunks defined by the metadata and fits linear and robust linear models (robust::lmRob) for the actual flux calculation.

The datastructure of the recorderd data can be widely defined, hence glimmr is not restriced to a speceific device. Nevertheless, wrapper functions are included for GASMET and LosGatos gas analizers.

Read data

GASMET and LosGatos records can be directly loaded:

gasmet <- read_gasmet("path/to/gasmet_file.csv")

losgatos <- read_losgatos("path/to/losgatos/dir")
losgatos <- read_losgatos("path/to/losgatos_file.txt")

Single LosGatos files, as well as directories containing zips and txt files are supported. See read_losgatos() for details.

The structure of corresponding metdata is defined as follows:

meta_gasmet

meta_losgatos

Process fluxes

To use any arbitrary device all columns containing used information need to be defined.

# setup analyzer
custom_analyzer <- analyzer(
  #define datastructure
  time_stamp = "Time",
  conc_columns = c(CH4 = "[CH4]_ppm", CO2 = "[CO2]_ppm"),
  pressure = "GasP_torr",
  pressure_factor = 1.33322,
  temperature = "AmbT_C",
  trimmer = trim_time,
  # define metadata structure
  plot = "plot",
  date = "date",
  start = "start",
  end = "end",
  #define chamber dimensions
  V = 0.01461,
  A = 0.098
)

# compute fluxes
process_chamber(
  # specify data
  data = losgatos, 
  meta = meta_losgatos,
  #specify analyzer
  analyzer = custom_analyzer
)

For simplification, GASMET and LosGatos can be called via convenient wrapper functions:

process_losgatos(losgatos, meta_losgatos)

process_gasmet(gasmet, meta_gasmet)

While the start of single measurements is (usually) defined by a known point in time, the end can be defined in different ways. See process_chamber() for details.



tekknosol/glimmr documentation built on Oct. 17, 2020, 1:39 a.m.