Ingests data for a single site and one specific data type, specified by argument source.

ingest_bysite(
  sitename,
  source,
  getvars = c(),
  dir = NULL,
  settings = NULL,
  timescale = "d",
  year_start = NA,
  year_end = NA,
  lon = NA,
  lat = NA,
  elv = NA,
  verbose = FALSE
)

Arguments

sitename

A character string used as site identification. When data is extracted from global files or remote servers, sitename is simply used as a label and any string can be provided. When data is extraced from site-specific files (e.g. source = "fluxnet"), then sitename is used to identify the file from which data is read.

source

A character used as identifiyer for the type of data source (e.g., "fluxnet"). See vignette for a full description of available options.

getvars

A named list of characters specifying the variable names in the original source dataset and the variable names in the ingested data frame. Use, e.g., getvars = list("gpp" = "GPP_NT_VUT_REF") to read the variable "GPP_NT_VUT_REF" from the original file and convert its name to "gpp" in the ingested data frame.

dir

A character specifying the directory where the data is located.

settings

A list of additional, source-specific settings used for reading and processing original files. Defaults to an empty list which triggers the use of default settings (see e.g., get_settings_fluxnet) for source = "fluxnet".

timescale

A character or vector of characters, specifying the time scale of data used from the respective source (if multiple time scales are available, otherwise is disregarded). Implemented time scales are c("d", "m", "y") for daily, monthly, and yearly, respectively. Defaults to "d".

year_start

An integer specifying the first year for which data is to be ingested.

year_end

An integer specifying the last year for which data is to be ingested (full years are read, i.e. all days, or hours, or months in each year).

lon

A numeric value specifying the longitude for which data is extraced from global files or remote data servers. If source = "fluxnet", this is not required and set ot NA.

lat

A numeric value specifying the longitude for which data is extraced from global files or remote data servers. If source = "fluxnet", this is not required and set ot NA.

elv

A numeric value specifying the elevation of the site in m a.s.l., This is only required for source = "watch_wfdei", where the ingested data for atmospheric pressure (patm) is bias-corrected by elevation using the adiabatic lapse rate (implemented by calc_patm).

verbose

if TRUE, additional messages are printed. Defaults to FALSE.

Value

A data frame (tibble) containing the time series of ingested data.

Examples

if (FALSE) inputdata <- ingest_bysite()