process_tdl_cycle_erml {PhotoGEA}R Documentation

Process cycles from the ERML TDL

Description

Uses the 12C and 13C signal from the calibration lines of a tunable diode laser (TDL) to determine correction factors and apply them to the sample lines. Applicable for a system with a NOAA calibration tank, a nitrogen tank, and three other lines mixing the nitrogen with a CO2 tank in different ratios. This function is designed specifically for the TDL operating in Carl Bernacchi's lab in the Edward R. Madigan Laboratory (ERML) at the University of Illinois, Urbana-Champaign.

Usage

  process_tdl_cycle_erml(
    tdl_cycle,
    noaa_valve,
    calibration_0_valve,
    calibration_1_valve,
    calibration_2_valve,
    calibration_3_valve,
    noaa_cylinder_co2_concentration,
    noaa_cylinder_isotope_ratio,
    calibration_isotope_ratio,
    valve_column_name = 'valve_number',
    raw_12c_colname = 'Conc12C_Avg',
    raw_13c_colname = 'Conc13C_Avg'
  )

Arguments

tdl_cycle

An exdf object representing one cycle of TDL data.

noaa_valve

The valve number that corresponds to the NOAA reference cylinder.

calibration_0_valve

The valve number that corresponds to the calibration valve 0 (the nitrogen cylinder).

calibration_1_valve

The valve number that corresponds to the calibration valve 1 (a mixture of nitrogen gas with a calibrated CO2 source).

calibration_2_valve

The valve number that corresponds to the calibration valve 2 (a mixture of nitrogen gas with a calibrated CO2 source).

calibration_3_valve

The valve number that corresponds to the calibration valve 3 (a mixture of nitrogen gas with a calibrated CO2 source).

noaa_cylinder_co2_concentration

The total CO2 concentration of the NOAA calibration cylinder in ppm; this includes all carbon species, such as 12C18O18O.

noaa_cylinder_isotope_ratio

The isotope ratio of the NOAA calibration cylinder in ppt.

calibration_isotope_ratio

The isotope ratio of the other CO2 cylinder in ppt.

valve_column_name

The name of the column in tdl_cycle that contains the valve number; typically, this is 'valve_number'.

raw_12c_colname

The name of the column in tdl_cycle that contains the 12C signal; typically, this is 'Conc12C_Avg'.

raw_13c_colname

The name of the column in tdl_cycle that contains the 13C signal; typically, this is 'Conc13C_Avg'.

Details

This function applies several corrections to the data in tdl_cycle:

Should there be any equations here? Are there any references to cite?

This function assumes that tdl_cycle represents a single TDL measurement cycle. To process multiple cycles at once, this function is often used along with by.exdf and consolidate.

Value

A list with five elements:

Examples

# Example: reading a TDL file that is included with the PhotoGEA package,
# identifying its measurement cycles, and then processing them.
tdl_file <- read_gasex_file(
  PhotoGEA_example_file_path('tdl_sampling_1.dat'),
  'TIMESTAMP'
)

# This is a large file; for this example, we will truncate to just the first
# 200 rows so it runs faster
tdl_file <- tdl_file[seq_len(200), , TRUE]

# Identify TDL cycles
tdl_file <- identify_tdl_cycles(
  tdl_file,
  valve_column_name = 'valve_number',
  cycle_start_valve = 20,
  expected_cycle_length_minutes = 2.7,
  expected_cycle_num_valves = 9,
  timestamp_colname = 'TIMESTAMP'
)

# Process TDL cycles
processed_tdl <- consolidate(by(
  tdl_file,
  tdl_file[, 'cycle_num'],
  process_tdl_cycle_erml,
  valve_column_name = 'valve_number',
  noaa_valve = 2,
  calibration_0_valve = 20,
  calibration_1_valve = 21,
  calibration_2_valve = 23,
  calibration_3_valve = 26,
  raw_12c_colname = 'Conc12C_Avg',
  raw_13c_colname = 'Conc13C_Avg',
  noaa_cylinder_co2_concentration = 294.996,
  noaa_cylinder_isotope_ratio = -8.40,
  calibration_isotope_ratio = -11.505
))

# The output is a list of five exdf objects; four of them are related to each
# step in the calibration procedure for each TDL cycle
names(processed_tdl)

# The processed TDL data includes new columns for the calibrated CO2
# concentrations
colnames(processed_tdl$tdl_data)

# Make a plot of the raw and calibrated 13C signals across all the TDL cycles.
# Note that the calibrated signal from valve 20 is always exactly zero, since
# this is the line from the nitrogen tank. The calibrated signal from valve 2 is
# also constant since this is the line from the NOAA tank whose concentration is
# known.
lattice::xyplot(
  Conc13C_Avg + calibrated_13c ~ cycle_num | factor(valve_number),
  data = processed_tdl$tdl_data$main_data,
  type = 'l',
  auto = TRUE,
  grid = TRUE,
  xlab = 'TDL cycle',
  ylab = paste0('13C concentration (', processed_tdl$tdl_data$units$Conc13C_Avg, ')')
)

# Make a plot of 12C gain factor against elapsed time
lattice::xyplot(
  gain_12CO2 ~ elapsed_time,
  data = processed_tdl$calibration_12CO2$main_data,
  type = 'b',
  pch = 16,
  grid = TRUE,
  xlab = paste0('Elapsed time (', processed_tdl$calibration_12CO2$units$elapsed_time, ')'),
  ylab = paste0('12C gain factor (', processed_tdl$calibration_12CO2$units$gain_12CO2, ')')
)


[Package PhotoGEA version 1.3.3 Index]