Import raw data

The package contains a wide range of functions that let the user import raw data from a variety of instruments:

There are two ways to import raw data files into R:

import2RData

Import all raw gas measurement files contained in a folder using the function import2RData. Adapted to multiple greenhouse gas analyzers and other instruments:

  • LI-COR: LI-6400, LI-7810, LI-7820, LI-8100, LI-8200 (smart chamber), LI-8250 (Multiplexer)
  • Los Gatos Research (LGR): ultra-portable GGA (GLA132 series), micro ultra-portable GGA (GLA131 series) and N2OM1 (GLA151 series)
  • GAIA2TECH (DMR) automated chamber ECOFlux
  • Picarro: G2508 and G4301
  • Gasmet: DX4015 and GT5000
  • PP-Systems: EGM-5
  • Aeris Technologies: N2O/CO2 high accuracy analyzer and CH4/C2H6 natural gas detection system
  • GasmetPD: Custom multiplexer from the University of Padova, Italy

Usage

Note

Code chunks under Usage sections are not part of the demonstration. They are meant to show you how to use the arguments in the function.

import2RData(
  path,
  instrument,
  date.format,
  timezone = "UTC",
  keep_all,
  prec,
  ...
)

Arguments

path character string; a folder path containing all files to be imported. Ideally, to avoid any errors, the folder should only contain the files to be imported.
instrument character string; specifies which instrument was used to generate the files contained in the folder path. Choose one of the following: “DX4015”, “EGM5”, “G2508”, “G4301” “GAIA”, “GasmetPD”, “GT5000”, “LI-6400”, “LI-7810”, “LI-7820”, “LI-8100”, “LI-8200”, “LI-8250”, “N2OM1”, “uCH4”, “uN2O”, “UGGA”. For more information about an instrument, see the section “See Also” below.
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas. Look at the examples below, or the help for each import function of each instrument, to know what values to use.
proc.data.field numeric value; select the process data field used with the EGM-5. See import.EGM5 for more details.
pivot character string; either “long” or “wide”. If pivot = "long", each column containing information about Tsoil, Tcham, SWC, PAR and operating status (Op.stat) will be saved in a single column per parameter. If pivot = "wide", the default display of one column per chamber per parameter will be used.
active logical; if active = TRUE, preserve data for active chambers only.
flag numeric vector; indicates the operating status that should be used for the flux calculation. Default is flag = c(7,11), where 7 indicates “Chamber Idle Closed Clear” and 11 indicates “Chamber Idle Closed Dark”.
background logical; if background = FALSE, removes all data from activ.cham == "Background".
Op.stat.col, PAR.col, Tcham.col, Tsoil.col, SWC.col, CH.col character string; a pattern to match the columns that fit the corresponding parameter. See import.GAIA or import.LI8250 for more details.
inst1, inst2, inst3 character strings; a pattern to match the columns containing the name of each instrument. See import.GAIA or import.LI8250 for more details.
gas1, gas2, gas3 character vectors; a pattern to match the columns containing each gas measurement. See import.GAIA or import.LI8250 for more details.
prec1, prec2, prec3 numerical vectors; the precision of the instrument for each gas mentioned in gas1 and gas2. See import.GAIA or import.LI8250 for more details. Note that the order in the arguments precX must match the order of the arguments in gasX.
dry1, dry2, dry3 logical; are the gas measurements compensated for water vapor (dry fraction)? If dryX = TRUE (default), the gases are compensated for water vapor, and will be named accordingly. See import.GAIA or import.LI8250 for more details.
sep character string defining the field separator character. Values on each line of the file are separated by this character. By default, sep = "\t" for tabulation.
skip integer; the number of lines of the data file to skip before beginning to read data. By default, skip = 1.

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For most instruments, the date is one of the columns in the raw data file:

  • DX4015: column Date
  • EGM5: column Date
  • G2508: column DATE
  • G4301: column DATE
  • GAIA: column Titles:
  • GasmetPD: column Date
  • GT5000: column Date
  • LI-6400: (see comment below)
  • LI-7810: column DATE
  • LI-7820: column DATE
  • LI-8100: column Date
  • LI-8200: (see comment below)
  • N2OM1: column Time
  • uCH4: column Time Stamp
  • uN2O: column Time Stamp
  • UGGA: column Time

For the instrument LI-6400, the date is found in one of the first lines in a format containing abbreviations, for example “Thr Aug 6 2020”, which would be the date format “mdy”. For the instrument LI-8200, the date is found under one of the measurements, next to ‘“Date”:’. For the instrument LI-8250, the date format is in the file name.

The argument proc.data.field is used with the PP-Sytems EGM-5 instrument only. Look up the EGM-5 Operation Manual at page 90 for more details about the different Process Data Fields (proc.data.field).

The arguments active, pivot, flag, background, CH.col, PAR.col, Tcham.col, Op.stat.col, inst3, gas3, prec3, dry3, sep and skip are used with the function import.GAIA only. The arguments Tsoil.col, SWC.col, inst1, inst2, gas1, gas2, prec1, prec2, dry1, dry2, are used with both the function import.GAIA and the function import.LI8250.

Examples

All files contained in the folder path specified are saved in a newly created folder “RData” in your working directory.

Note

In all examples, an example file from the package goFlux is retrieved using the function system.file to be used in the example. However, to use the function with your own data, the argument path must be the folder path containing your files:

import2RData(path = "your_raw_data_folder", instrument = "DX4015", 
             date.format = "ymd", prec = c(1.6, 23, 13, 2, 23, 33))

Gasmet

DX4015

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/DX4015", package = "goFlux")
import2RData(path = file.path, instrument = "DX4015",
             date.format = "ymd", prec = c(1.6, 23, 13, 2, 23, 33))

GT5000

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/GT5000", package = "goFlux")
import2RData(path = file.path, instrument = "GT5000",
             date.format = "ymd", prec = c(1.6, 23, 13, 2, 23, 33))

PP-Systems

EGM-5

The argument proc.data.field is used with the PP-Sytems EGM-5 instrument only. Look up the EGM-5 Operation Manual at page 90 for more details about the different Process Data Fields (proc.data.field), or the PP-Systems EGM-5 instrument under the “Single file import” section for more details about other arguments used with this instrument.

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/EGM5", package = "goFlux")
# The argument proc.data.field is used with the PP-System EGM-5 instrument only.
import2RData(path = file.path, instrument = "EGM5",
             date.format = "dmy", prec = c(3, 1, 500), proc.data.field = 2)

Picarro

G2508

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/G2508", package = "goFlux")
import2RData(path = file.path, instrument = "G2508",
             date.format = "ymd", prec = c(0.24, 0.3, 5, 0.16, 500))

G4301

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/G4301", package = "goFlux")
import2RData(path = file.path, instrument = "G4301",
             date.format = "ymd", prec = c(0.025, 0.1, 10))

GAIA2TECH

Automated chamber ECOFlux

Note that with this instrument, keep_all is not a valid argument. However, several other arguments can be used: active, pivot, flag, background, etc. Look up the GAIA2TECH ECOFlux instrument under the “Single file import” section for more details.

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/GAIA", package = "goFlux")
import2RData(path = file.path, instrument = "GAIA", date.format = "ymd",
             pivot = "long", active = TRUE, flag = c(7,11),
             background = FALSE,
             CH.col = "COM5A0",
             SWC.col = "1C08_Soil Moisture",
             Tsoil.col = "1C07_Soil Temperature",
             Tcham.col = "2C07_Chamber Temperature",
             PAR.col = "3C07_Sunlight",
             Op.stat.col = "0C06_OperatingStatus",
             inst1 = "XT2C00_Instrument",
             inst2 = "XT3C00_Instrument",
             gas1 = c("XT2C04_CH4", "XT2C05_CO2", "XT2C06_H2O"),
             gas2 = c("XT3C04_N2O", "XT3C05_H2O"),
             prec1 = c(0.6, 3.5, 45),
             prec2 = c(0.4, 45))

GasmetPD

Custom made multiplexer linked with the Gasmet DX4015

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/GasmetPD", package = "goFlux")
import2RData(path = file.path, instrument = "GasmetPD",
             date.format = "ymd", prec = c(1.6, 13, 2, 23, 33))

LGR

UGGA (GLA132 series)

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/UGGA", package = "goFlux")
import2RData(path = file.path, instrument = "UGGA",
             date.format = "dmy", prec = c(0.2, 1.4, 50))

MGGA (GLA131 series)

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/UGGA", package = "goFlux")
import2RData(path = file.path, instrument = "UGGA",
             date.format = "dmy", prec = c(0.35, 0.9, 200))

N2OM1 (GLA151 series)

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/N2OM1", package = "goFlux")
import2RData(path = file.path, instrument = "N2OM1",
             date.format = "dmy", prec = c(0.5, 2, 50))

LI-COR

LI-6400

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/LI6400", package = "goFlux")
import2RData(path = file.path, instrument = "LI-6400",
             date.format = "mdy", prec = c(0.15, 20))

LI-7810

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/LI7810", package = "goFlux")
import2RData(path = file.path, instrument = "LI-7810",
             date.format = "ymd", prec = c(3.5, 0.6, 45))

LI-7820

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/LI7820", package = "goFlux")
import2RData(path = file.path, instrument = "LI-7820",
             date.format = "ymd", prec = c(0.4, 45))

LI-8100

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/LI8100", package = "goFlux")
import2RData(path = file.path, instrument = "LI-8100",
             date.format = "ymd", prec = c(1, 10))

LI-8200 (Smart Chamber)

Note that with this instrument, keep_all and prec are not valid arguments.

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/LI8200", package = "goFlux")
import2RData(path = file.path, instrument = "LI-8200", date.format = "ymd")

LI-8250 (Multiplexer)

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/LI8250", package = "goFlux")
import2RData(path = file.path, instrument = "LI-8250", date.format = "ymd",
             inst1 = "LI-7810", gas1 = c("CO2_DRY", "CH4_DRY", "H2O"),
             prec1 = c(3.5, 0.6, 45), SWC.col = "SWC_1", Tsoil.col = "TS_1")

Aeris Technologies

MIRA Ultra CH4/ C2H6 analyzer

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/uCH4", package = "goFlux")
import2RData(path = file.path, instrument = "uCH4",
             date.format = "mdy", prec = c(1, 0.5, 15))

MIRA Ultra N2O/ CO2 analyzer

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata/uN2O", package = "goFlux")
import2RData(path = file.path, instrument = "uN2O",
             date.format = "mdy", prec = c(0.2, 0.2, 15))

Single file import

Each instrument has a unique function for single file import. The advantage of using this function is that a file can be saved in the environment in an object instead of being saved as an .RData file in the working directory. Just like the import2RData function, there is a function adapted to multiple greenhouse gas analyzers and other instruments:

Gasmet

DX4015

Import single raw gas measurement files from the Gasmet DX4015 gas analyzer (CO, CO2, CH4, N2O, NH3 and H2O) with the function import.DX4015.

Usage

import.DX4015(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(1.6, 23, 13, 2, 23, 33)
)

Arguments

inputfile character string; the name of a file with the extension .TXT
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, “COdry_ppb”, CH4dry_ppb”, “N2Odry_ppb”, “NH3dry_ppb” and H2O_ppm”. The default is prec = c(1.6, 23, 13, 2, 23, 33).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument DX4015, the date is found in the column “Date”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2, CO, CH4, N2O and NH3
  • vol-% for H2O
  • mbar for pressure
  • Celsius for temperature

If your Gasmet DX4015 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1 ppb for CH4, CO N2O and NH3) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones provided by the manufacturer upon request, for the latest model of this instrument available at the time of the creation of this function (11-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "DX4015/DX4015.TXT", package = "goFlux")

# Import in the environment
imp.DX4015 <- import.DX4015(inputfile = file.path)

# Or save in a RData folder in the working directory
import.DX4015(inputfile = file.path, save = TRUE)

GT5000

Import single raw gas measurement files from the Gasmet GT5000 gas analyzer (CO, CO2, CH4, N2O, NH3 and H2O) with the function import.GT5000.

Usage

import.GT5000(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(1.6, 23, 13, 2, 23, 33)
)

Arguments

inputfile character string; the name of a file with the extension .TXT
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, “COdry_ppb”, “CH4dry_ppb”, “N2Odry_ppb”, “NH3dry_ppb” and “H2O_ppm”. The default is prec = c(1.6, 23, 13, 2, 23, 33).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument GT5000, the date is found in the column “Date”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2, CO, CH4, N2O and NH3
  • vol-% for H2O
  • mbar for pressure
  • Celsius for temperature

If your Gasmet GT5000 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1 ppb for CH4, CO N2O and NH3) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones provided by the manufacturer upon request, for the latest model of this instrument available at the time of the creation of this function (08-2024).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "GT5000/GT5000.TXT", package = "goFlux")

# Import in the environment
imp.GT5000 <- import.GT5000(inputfile = file.path)

# Or save in a RData folder in the working directory
import.GT5000(inputfile = file.path, save = TRUE)

PP-Systems

EGM-5

Import single raw gas measurement files from the PP-Systems EGM-5 Portable CO2 Gas Analyzer, with the function import.EGM5.

Usage

import.EGM5(
  inputfile,
  date.format = "dmy",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(3, 1, 500),
  proc.data.field = NULL
)

Arguments

inputfile character string; the name of a file with the extension .TXT
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “dmy”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, “O2dry_pct” and H2O_ppm”. The default is prec = c(3, 1, 500).
proc.data.field numeric value; select the process data field used with the EGM-5. There are 5 different modes available: (1) Measure mode; (2) SRC or Custom mode; (3) CPY mode; (4) Injection mode; or (5) Static mode. If no value is specified, the parameters will be named “param1”, “param2”, “param3”, “param4” and “param5”.

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument EGM5, the date is found in the column “Date”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2
  • % for O2 (pct)
  • mb for H2O
  • mb for pressure
  • Celsius for temperature

If your PP-Systems EGM-5 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1% for O2) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones provided by the manufacturer upon request, for the latest model of this instrument available at the time of the creation of this function (11-2023).

Look up the EGM-5 Operation Manual at page 90 for more details about the different Process Data Fields (proc.data.field).

Note that the default file extension for this instrument is .TXT, however, it is also possible to use with a .csv file format.

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "EGM5/EGM5.TXT", package = "goFlux")

# Import in the environment
imp.EGM5 <- import.EGM5(inputfile = file.path)

# Or save in a RData folder in the working directory
import.EGM5(inputfile = file.path, save = TRUE)

Picarro

G2508

Import single raw gas measurement files from the Picarro G2508 (CO2, CH4, N2O, NH3, and H2O GHG analyzer) with the function import.G2508.

Usage

import.G2508(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(0.24, 0.3, 5, 0.16, 500)
)

Arguments

inputfile character string; the name of a file with the extension .dat
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, CH4dry_ppb”, “N2Odry_ppb”, “NH3dry_ppb” and H2O_ppm”. The default is prec = c(0.24, 0.3, 5, 0.16, 500).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument G2508, the date is found in the column “DATE”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2
  • ppb for CH4, N2O and NH3
  • mmol/mol for H2O
  • Torr for pressure
  • Celsius for temperature

If your Picarro G2508 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1 ppb for CH4, N2O and NH3) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest model of this instrument, available at the time of the creation of this function (11-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "G2508/2022/08/01/G2508.dat", package = "goFlux")

# Import in the environment
imp.G2508 <- import.G2508(inputfile = file.path)

# Or save in a RData folder in the working directory
import.G2508(inputfile = file.path, save = TRUE)

G4301

Import single raw gas measurement files from the Picarro G4301 (CO2, CH4 and H2O GHG analyzer) with the function import.G4301.

Usage

import.G4301(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(0.025, 0.1, 10)
)

Arguments

inputfile character string; the name of a file with the extension .dat
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, CH4dry_ppb” and H2O_ppm”. The default is prec = c(0.025, 0.1, 10).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument G4301, the date is found in the column “DATE”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2
  • ppb for CH4
  • mmol/mol for H2O
  • Torr for pressure
  • Celsius for temperature

If your Picarro G4301 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1 ppb for CH4) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest model of this instrument, available at the time of the creation of this function (11-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "G4301/G4301.dat", package = "goFlux")

# Import in the environment
imp.G4301 <- import.G4301(inputfile = file.path)

# Or save in a RData folder in the working directory
import.G4301(inputfile = file.path, save = TRUE)

GAIATECH

Automated chamber ECOFlux

With the function import.GAIA, import single raw gas measurement files from the automated chamber ECOFlux (GAIA2TECH) linked with up to three gas analyzers. Default settings are set for two LI-COR instruments: LI-7810 (CO2, CH4 and H2O) and LI7820 (N2O and H2O), to match the example data file provided with the package.

Usage

import.GAIA(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  pivot = "long",
  active = TRUE,
  flag = c(7, 11),
  background = FALSE,
  save = FALSE,
  CH.col = "COM5A0",
  SWC.col = "1C08_Soil Moisture",
  Tsoil.col = "1C07_Soil Temperature",
  Tcham.col = "2C07_Chamber Temperature",
  PAR.col = "3C07_Sunlight",
  Op.stat.col = "0C06_OperatingStatus",
  inst1 = "XT2C00_Instrument",
  inst2 = "XT3C00_Instrument",
  inst3 = NULL,
  gas1 = c("XT2C04_CH4", "XT2C05_CO2", "XT2C06_H2O"),
  gas2 = c("XT3C04_N2O", "XT3C05_H2O"),
  gas3 = NULL,
  prec1 = c(0.6, 3.5, 45),
  prec2 = c(0.4, 45),
  prec3 = NULL,
  dry1 = T,
  dry2 = T,
  dry3 = NULL,
  sep = "\t",
  skip = 1
)

Arguments

inputfile character string; the name of a file with the extension .csv
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
pivot character string; either “long” or “wide”. If pivot = "long", each column containing information about Tsoil, Tcham, SWC, PAR and operating status (Op.stat) will be saved in a single column per parameter. If pivot = "wide", the default display of one column per chamber per parameter will be used.
active logical; if active = TRUE, preserve data for active chambers only.
flag numeric vector; indicates the operating status that should be used for the flux calculation. Default is flag = c(7,11), where 7 indicates “Chamber Idle Closed Clear” and 11 indicates “Chamber Idle Closed Dark”.
background logical; if background = FALSE, removes all data from activ.cham == "Background".
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
Op.stat.col, PAR.col, Tcham.col, Tsoil.col, SWC.col, CH.col character string; a pattern to match all columns that fit the corresponding parameter. For example, all columns containing the pattern “3C07_Sunlight” will be renamed with the pattern “_PAR”. Then, if pivot = "long", all columns with the pattern “_PAR” will be merged together.
inst1, inst2, inst3 character strings; a pattern to match the columns containing the name of each instrument. By default, inst1 = "XT2C00_Instrument", inst2 = "XT3C00_Instrument", and inst3 = NULL, to match the example data file provided with the package.
gas1, gas2, gas3 character vectors; a pattern to match the columns containing each gas measurement. By default, gas1 = c("XT2C04_CH4", "XT2C05_CO2", "XT2C06_H2O"), gas2 = c("XT3C04_N2O", "XT3C05_H2O"), and gas3 = NULL, to match the example data file provided with the package.
prec1, prec2, prec3 numerical vectors; the precision of the instrument for each gas mentioned in gas1, gas2 and gas3. By default, prec1 = c(0.6, 3.5, 45), prec2 = c(0.4, 45), and prec3 = NULL, to match the example data file provided with the package. Note that the order in the arguments precX must match the order of the arguments in gasX.
dry1, dry2, dry3 logical; are the gas measurements compensated for water vapor (dry fraction)? If dryX = TRUE (default), the gases are compensated for water vapor, and will be named accordingly. For example, the column “XT2C05_CO2” will become “CO2dry_ppm”.
sep character string defining the field separator character. Values on each line of the file are separated by this character. By default, sep = "\t" for tabulation.
skip integer; the number of lines of the data file to skip before beginning to read data. By default, skip = 1.

Details

This function has been designed for the automated chamber ECOFlux (GAIA2TECH) synced with up to 9 chambers and two GHG analyzers from LI-COR (LI-7810: CO2, CH4 and H2O / LI7820: N2O and H2O). If this function could be useful for you, but does not meet your needs, please contact the maintainer of this package for potential adaptations.

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument GAIA the date is found in the column “Titles:”.

The arguments PAR.col, Tcham.col, Tsoil.col and SWC.col correspond to different types of probes linked to the ECOFlux chamber: PAR (sunlight), chamber temperature, soil temperature and soil water content volumetric, respectively. The argument Op.stat.col corresponds to the columns Operating Status of each chamber. The argument CH.col indicates a character string preceding the chamber number for each column of the raw data. For example, the column “COM5A010C06_OperatingStatus” in the raw data file contains the Operating Status for the chamber 1 if CH.col = "COM5A0" and Op.stat.col = "0C06_OperatingStatus". If these columns are absent from the raw data, set arguments to NULL.

Note that this function was designed for the following units in the raw file:

  • kPa for pressure
  • volumetric water content (%) for soil moisture
  • Celsius for air temperature
  • µmol photons m-2s-1 for PAR

For each gas, the units are taken from the second row in the raw file (Units:). If your instruments use different units, either convert the units after import, change the settings on your instruments, or contact the maintainer of this package for support.

Regarding the parameters dryX, in case of uncertainty, either contact your technical support or assume that gases are compensated for water vapor, which is normally the case.

As opposed to the other import functions, there is no option to “keep_all” with this instrument. If you would like to import additional data using this function, please contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1 ppb for CH4 and N2O) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest models of the LI-7810 and LI-7820, available at the time of the creation of this function (11-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "GAIA/GAIA.csv", package = "goFlux")

# Import in the environment
imp.GAIA <- import.GAIA(inputfile = file.path)

# Or save in a RData folder in the working directory
import.GAIA(inputfile = file.path, save = TRUE)

GasmetPD

Custom made multiplexer linked with the Gasmet DX4015

Imports single raw gas measurement files from the GasmetPD, a custom made multiplexer linked with the Gasmet DX4015 (CO2, CH4, N2O, NH3 and H2O)

Usage

import.GasmetPD(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(1.6, 13, 2, 23, 33)
)

Arguments

inputfile character string; the name of a file with the extension .txt
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, “CH4dry_ppb”, “N2Odry_ppb”, “NH3dry_ppb” and “H2O_ppm”. The default is prec = c(1.6, 13, 2, 23, 33).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For this instrument, the date is found in the column “Date”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2, CH4, N2O and NH3
  • percent (%) for H2O
  • mbar for pressure

The function converts ambient pressure to kPa (Pcham), water vapor to ppm, and CH4, N2O and NH3 to ppb. If your instrument uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1 ppb for CH4, N2O and NH3) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones provided by the manufacturer upon request, for the latest model of this instrument available at the time of the creation of this function (07-2024).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "GasmetPD/GasmetPD.txt", package = "goFlux")

# Import in the environment
imp.GasmetPD <- import.GasmetPD(inputfile = file.path, prec = c(1.6, 13, 2, 23, 33))

# Or save in a RData folder in the working directory
import.GasmetPD(inputfile = file.path, prec = c(1.6, 13, 2, 23, 33), save = TRUE)

LGR

UGGA and MGGA

Import single raw gas measurement files from the ultra-portable GHG analyzers (GLA132-UGGA and GLA131-MGGA) from Los Gatos Research (CO2, CH4 and H2O) with the function import.UGGA.

Usage

import.UGGA(
  inputfile,
  date.format = "dmy",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(0.2, 1.4, 50)
)

Arguments

inputfile character string; the name of a file with the extension .txt
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “dmy”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, CH4dry_ppb” and H2O_ppm”. The default is prec = c(0.2, 1.4, 50), which corresponds to the ultra-portable GGA (GLA132 series). For the micro ultra-portable GGA (GLA131 series), use prec = c(0.35, 0.9, 200).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For these instruments, the date is found in the column “Time”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2, CH4 and H2O
  • Torr for pressure
  • Celsius for temperature

If your LGR instrument (UGGA or MGGA) uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1 ppb for CH4) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest model of this instrument available at the time of the creation of this function (11-2023).

Examples

UGGA (GLA132 series)
# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "UGGA/UGGA.txt", package = "goFlux")

# Import in the environment
imp.UGGA <- import.UGGA(inputfile = file.path, prec = c(0.2, 1.4, 50))

# Or save in a RData folder in the working directory
import.UGGA(inputfile = file.path, prec = c(0.2, 1.4, 50), save = TRUE)
MGGA (GLA131 series)
# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "UGGA/UGGA.txt", package = "goFlux")

# Import in the environment
imp.MGGA <- import.UGGA(inputfile = file.path, prec = c(0.35, 0.9, 200))

# Or save in a RData folder in the working directory
import.UGGA(inputfile = file.path, prec = c(0.35, 0.9, 200), save = TRUE)

N2OM1

Import single raw gas measurement files from the N2OM1 GHG analyzers (GLA151 series) from Los Gatos Research (N2O, CH4 and H2O) with the function import.N2OM1.

Usage

import.N2OM1(
  inputfile,
  date.format = "dmy",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(0.5, 2, 50)
)

Arguments

inputfile character string; the name of a file with the extension .txt
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “dmy”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “N2Odry_ppb”, CH4dry_ppb” and H2O_ppm”. The default is prec = c(0.5, 2, 50).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument N2OM1, the date is found in the column “Time”.

Note that this function was designed for the following units in the raw file:

  • ppm for N2O, CH4 and H2O
  • Torr for pressure
  • Celsius for temperature

If your LGR N2OM1 instrument uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for H2O, or 1 ppb for N2O and CH4) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest model of this instrument available at the time of the creation of this function (12-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "N2OM1/N2OM1.txt", package = "goFlux")

# Import in the environment
imp.N2OM1 <- import.N2OM1(inputfile = file.path, prec = c(0.5, 2, 50))

# Or save in a RData folder in the working directory
import.N2OM1(inputfile = file.path, prec = c(0.5, 2, 50), save = TRUE)

LI-COR

LI-6400

Import single raw gas measurement files from the LI-COR 6400 (CO2 and H2O GHG analyzer) with the function import.LI6400.

Usage

import.LI6400(
  inputfile,
  date.format = "mdy",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(0.15, 20)
)

Arguments

inputfile character string; the name of a file with the extension .txt
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “mdy”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm” and H2O_ppm”. The default is prec = c(0.15, 20).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument LI-6400, the date is found in one of the first lines in a format containing abbreviations, for example “Thr Aug 6 2020”, which would be the date format “mdy”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2
  • mmol/mol for H2O
  • kPa for pressure
  • cm3 for volumes
  • Celsius for temperature
  • µmol photons m-2s-1 for PAR

If your LI-COR LI-6400 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones provided by the manufacturer upon request, for the latest model of this instrument available at the time of the creation of this function (11-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "LI6400/LI6400.txt", package = "goFlux")

# Import in the environment
imp.LI6400 <- import.LI6400(inputfile = file.path)

# Or save in a RData folder in the working directory
import.LI6400(inputfile = file.path, save = TRUE)

LI-7810

Import single raw gas measurement files from the LI-COR 7810 (CO2, CH4 and H2O GHG analyzer) with the function import.LI7810.

Usage

import.LI7810(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(3.5, 0.6, 45)
)

Arguments

inputfile character string; the name of a file with the extension .data
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, CH4dry_ppb” and H2O_ppm”. The default is prec = c(3.5, 0.6, 45).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument LI-7810, the date is found in the column “DATE”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2 and H2O
  • ppb for CH4
  • kPa for pressure
  • Celsius for temperature

If your LI-COR LI-7810 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and H2O, or 1 ppb for CH4) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest model of this instrument available at the time of the creation of this function (11-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "LI7810/LI7810.data", package = "goFlux")

# Import in the environment
imp.LI7810 <- import.LI7810(inputfile = file.path)

# Or save in a RData folder in the working directory
import.LI7810(inputfile = file.path, save = TRUE)

LI-7820

Import single raw gas measurement files from the LI-COR 7820 (N2O and H2O GHG analyzer) with the function import.LI7820.

Usage

import.LI7820(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(0.4, 45)
)

Arguments

inputfile character string; the name of a file with the extension .data
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “N2Odry_ppb” and H2O_ppm”. The default is prec = c(0.4, 45).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument LI-7820, the date is found in the column “DATE”.

Note that this function was designed for the following units in the raw file:

  • ppb for N2O
  • ppm for H2O
  • kPa for pressure
  • Celsius for temperature

If your LI-COR LI-7820 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for H2O, or 1 ppb for N2O) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest model of this instrument available at the time of the creation of this function (11-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "LI7820/LI7820.data", package = "goFlux")

# Import in the environment
imp.LI7820 <- import.LI7820(inputfile = file.path)

# Or save in a RData folder in the working directory
import.LI7820(inputfile = file.path, save = TRUE)

LI-8100

Import single raw gas measurement files from the LI-COR 8100 (CO2 and H2O GHG analyzer) with the function import.LI8100.

Usage

import.LI8100(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(1, 10)
)

Arguments

inputfile character string; the name of a file with the extension .81x
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm” and H2O_ppm”. The default is prec = c(1, 10).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument LI-8100, the date is found in the column “Date”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2
  • mmol/mol for H2O
  • Celsius for temperature

If your LI-COR LI-8100 uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones provided by the manufacturer upon request, for the latest model of this instrument available at the time of the creation of this function (11-2023).

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "LI8100/LI8100.81x", package = "goFlux")

# Import in the environment
imp.LI8100 <- import.LI8100(inputfile = file.path)

# Or save in a RData folder in the working directory
import.LI8100(inputfile = file.path, save = TRUE)

LI-8200 (Smart Chamber)

Import single raw data files from the LI-COR smart chamber (LI-8200) with the function import.LI8200.

Usage

import.LI8200(inputfile, date.format = "ymd", timezone = "UTC", save = FALSE)

Arguments

inputfile character string; the name of a file with the extension .json
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For the instrument LI-8200, the date is found under one of the measurements, next to ‘“Date”:’.

Note that this function was designed for the following units in the raw file:

  • seconds for DeadBand
  • cm for Area and Offset
  • mmol/mol for H2O
  • litters for volumes
  • kPa for pressure
  • Celsius for temperature

If your Smart Chamber uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

In addition, soil temperature and moisture are read with a HydraProbe connected to the Smart Chamber. If you are using a different setup, please contact the maintainer of this package for support.

As opposed to the other import functions, there is no option to “keep_all” with the Smart Chamber. If you would like to import additional data using this function, please contact the maintainer of this package for support.

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "LI8200/LI8200.json", package = "goFlux")

# Import in the environment
imp.LI8200 <- import.LI8200(inputfile = file.path)

# Or save in a RData folder in the working directory
import.LI8200(inputfile = file.path, save = TRUE)

LI-8250 (Multiplexer)

Import single raw data files from the LI-COR Multiplexer (LI-8250) with the function import.LI8250.

Usage

import.LI8250(
  inputfile,
  date.format = "ymd",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  inst1,
  inst2 = NULL,
  gas1,
  gas2 = NULL,
  prec1,
  prec2 = NULL,
  dry1 = T,
  dry2 = T,
  SWC.col,
  Tsoil.col
)

Arguments

inputfile character string; the name of a file with the extension .82z
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “ymd”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
inst1, inst2 character strings; a pattern to match the columns containing the name of each instrument. For example, with a LI-COR LI-7810, inst1 = "LI-7810" and inst2 = NULL, which matches the example data file provided with the package.
gas1, gas2 character vectors; a pattern to match the columns containing each gas measurement. For example, with a LI-COR LI-7810 gas1 = c("CO2_DRY", "CH4_DRY", "H2O") and gas2 = NULL, which matches the example data file provided with the package.
prec1, prec2 numerical vectors; the precision of the instrument for each gas mentioned in gas1 and gas2. For example, with a LI-COR LI-7810, prec1 = c(3.5, 0.6, 45) and prec2 = NULL, which matches the example data file provided with the package. Note that the order in the arguments precX must match the order of the arguments in gasX.
dry1, dry2 logical; are the gas measurements compensated for water vapor (dry fraction)? If dryX = TRUE (default), the gases are compensated for water vapor, and will be named accordingly. For example, the column “CO2_DRY” will become “CO2dry_ppm”.
Tsoil.col, SWC.col character string; a pattern to match the columns that fit the corresponding parameter.

Details

Files with the format .82z are zip archives that include all measurements that occurred at a given port for one observation. Each .82z file includes two files: a data.csv file and a metadata.json file. Raw files names for .82z files are formatted with the instrument serial number and a time stamp (serial-number-YYYYMMDDHHMMSS.82z). In date.format, the date format refers to the date format in the file name. Alternatively, the date format can be found in the data.csv file extracted from the .82z file, under the column “Date”.

Note that this function was designed for the following units in the raw file, according to the data dictionary of the LI-8250 Multiplexer online.

  • % v/v for soil water content (SWC)
  • litters for volumes
  • kPa for pressure
  • Celsius for temperature

For each gas, the units are taken from the third row in the data.csv file. Currently, the function is adapted for use with LI-COR instruments (LI-870 CO2/ H2O Analyzer or LI-78xx Trace Gas Analyzers). If you are using the function with a non-LI-COR instrument, please contact the maintainer of this package for support.

Regarding the parameters dryX, in case of uncertainty, either contact your technical support or assume that gases are compensated for water vapor, which is normally the case.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2, or 1 ppb for CH4) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved.

According to the data dictionary of the LI-8250 Multiplexer online, the column STATE indicates the chamber state, where, for example, 1 = closing and 5 = closed.

Example

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "LI8250/LI8250.82z", package = "goFlux")

# Import in the environment
imp.LI8250 <- import.LI8250(inputfile = file.path, inst1 = "LI-7810",
                            gas1 = c("CO2_DRY", "CH4_DRY", "H2O"),
                            prec1 = c(3.5, 0.6, 45), SWC.col = "SWC_1",
                            Tsoil.col = "TS_1")

# Or save in a RData folder in the working directory
import.LI8250(inputfile = file.path, save = TRUE, inst1 = "LI-7810",
              gas1 = c("CO2_DRY", "CH4_DRY", "H2O"),
              prec1 = c(3.5, 0.6, 45), SWC.col = "SWC_1",
              Tsoil.col = "TS_1")

Aeris Technologies

MIRA Ultra CH4/ C2H6 analyzer

Import single raw data files from the MIRA Ultra CH4/ C2H6 Natural Gas Leak Detection System (with GPS) from Aeris Technologies with the function import.uCH4.

Usage

import.uCH4(
  inputfile,
  date.format = "mdy",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(1, 0.5, 15)
)

Arguments

inputfile character string; the name of a file with the extension .txt
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “mdy”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CH4_ppb”, “C2H6dry_ppb” and “H2O_ppm”. The default is prec = c(1, 0.5, 15). The precision for water vapor is currently unknown, and a default of 1 ppm is used.

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For these instruments, the date is found in the column “Time Stamp”.

Note that this function was designed for the following units in the raw file:

  • ppm for CH4 and H2O
  • ppb for C2H6
  • mbars for pressure
  • Celsius for temperature

If your Aeris instrument (MIRA Ultra CH4/ C2H6 analyzer) uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for C2H6 and CH4, or 1 ppb for H2O) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest model of this instrument available at the time of the creation of this function (01-2024). The precision for water vapor is currently unknown, and a default of 1 ppm is used.

Examples

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "uCH4/uCH4.txt", package = "goFlux")

# Import in the environment
imp.uCH4 <- import.uCH4(inputfile = file.path)

# Or save in a RData folder in the working directory
import.uCH4(inputfile = file.path, save = TRUE)

MIRA Ultra N2O/ CO2 analyzer

Import single raw data files from the MIRA Ultra N2O/ CO2 High Accuracy Analyzer (with GPS) from Aeris Technologies with the function import.uN2O.

Usage

import.uN2O(
  inputfile,
  date.format = "mdy",
  timezone = "UTC",
  save = FALSE,
  keep_all = FALSE,
  prec = c(0.2, 0.2, 15)
)

Arguments

inputfile character string; the name of a file with the extension .txt
date.format character string; specifies the date format found in the raw data file. Choose one of the following: “dmy”, “ymd”, or “mdy”. Default is “mdy”, as it is the date format from the example data file provided.
timezone character string; a time zone in which to import the data to POSIXct format. Default is “UTC”. Note about time zone: it is recommended to use the time zone “UTC” to avoid any issue related to summer time and winter time changes.
save logical; if save = TRUE, saves the file as an .RData file in a RData folder in the current working directory. If save = FALSE, returns the file in the Console, or load in the Environment if assigned to an object.
keep_all logical; if keep_all = TRUE, keep all columns from the raw file. The default is keep_all = FALSE, and columns that are not necessary for gas flux calculation are removed.
prec numerical vector; the precision of the instrument for each gas, in the following order: “CO2dry_ppm”, “N2O_ppb” and “H2O_ppm”. The default is prec = c(0.2, 0.2, 15).

Details

In date.format, the date format refers to a date found in the raw data file, not the date format in the file name. For these instruments, the date is found in the column “Time Stamp”.

Note that this function was designed for the following units in the raw file:

  • ppm for CO2, N2O and H2O
  • mbars for pressure
  • Celsius for temperature

If your Aeris instrument (MIRA Ultra N2O/ CO2 analyzer) uses different units, either convert the units after import, change the settings on your instrument, or contact the maintainer of this package for support.

The precision of the instrument is needed to restrict kappa-max (k.max) in the non-linear flux calculation (HM.flux). Kappa-max is inversely proportional to instrument precision. If the precision of your instrument is unknown, it is better to use a low value (e.g. 1 ppm for CO2 and N2O, or 1 ppb for H2O) to allow for more curvature, especially for water vapor fluxes, or very long measurements, that are normally curved. The default values given for instrument precision are the ones found online for the latest model of this instrument available at the time of the creation of this function (01-2024). The precision for water vapor is currently unknown, and a default of 1 ppm is used.

Examples

# Retrieve file path from example file in the goFlux package
# using the function system.file
file.path <- system.file("extdata", "uN2O/uN2O.txt", package = "goFlux")

# Import in the environment
imp.uN2O <- import.uN2O(inputfile = file.path)

# Or save in a RData folder in the working directory
import.uN2O(inputfile = file.path, save = TRUE)