This function read in the BASE data file downloaded from AmeriFlux. See AmeriFlux web page https://ameriflux.lbl.gov/data/data-processing-pipelines/base-publish/ for details about BASE data product. Use amf_variables to get a list of standard variable names and units.

amf_read_base(file, unzip = TRUE, parse_timestamp = FALSE)

Arguments

file

A BASE data file, either in a zipped file or a comma-separate value (csv) file

unzip

Logical, whether to unzip. The default is TRUE. Set FALSE if reading from a previously unzipped csv file.

parse_timestamp

Logical, whether to parse the time stamp. Set TRUE to parse and add timekeeping columns.

Value

A data frame containing data. See AmeriFlux website

https://ameriflux.lbl.gov/data/aboutdata/data-variables/

for details about file format, variable definition, units, and convention. If parse_timestamp = TRUE, the following six time-keeping columns are added in the returned data frame:

  • YEAR - Year (YYYY)

  • MONTH - Month (MM)

  • DAY - Day of the month (DD)

  • DOY - Day of the year (DDD)

  • HOUR - Hour of the day (HH), based on the middle time of the interval

  • MINUTE - Minute of the hour (mm), based on the middle time of the interval

  • TIMESTAMP - An object of class "POSIXlt" in the UTC time zone, based on the middle time of the interval

Examples

# read the BASE from a zip file, using the example data file
base <- amf_read_base(file = system.file("extdata",
                                         "AMF_US-CRT_BASE-BADM_2-5.zip",
                                          package = "amerifluxr"),
                      unzip = TRUE,
                      parse_timestamp = TRUE)

# read the BASE from a csv file
base <- amf_read_base(file = system.file("extdata",
                                         "AMF_US-CRT_BASE_HH_2-5.csv",
                                          package = "amerifluxr"),
                      unzip = FALSE,
                      parse_timestamp = FALSE)