cfp_dat: Model input data

View source: R/cfp_dat.R

cfp_datR Documentation

Model input data

Description

cfp_dat is the essential object class that binds all necessary input data to run a ConFluxPro model. It automatically combines the different datasets and checks them for validity. It may split soilphys layers to correspond with layers_map and gasdata depths.

Usage

cfp_dat(gasdata, soilphys, layers_map)

as_cfp_dat(x)

## S3 method for class 'cfp_dat'
as_cfp_dat(x)

Arguments

gasdata

A cfp_gasdata object created by running cfp_gasdata().

soilphys

A cfp_soilphys object created by running cfp_soilphys().

layers_map

A cfp_layers_map object created by running cfp_layers_map.

x

An object of class cfp_dat

Value

A cfp_dat object with the following parameters:

gasdata

The gasdata object with added column "gd_id" that is unique for each profile.

soilphys

The soilphys object with added columns "sp_id" that is unique for each profile, "step_id" indicating the position of each step from the bottom up, "height" in m of each layer, "pmap" indicating which layer it belongs to from the bottom up. Potentially, some original steps were split to account for the depths within gasdata or layers_map.

layers_map

The layers_map object with added column "group_id" indicating each unique group of the same layer parameterization set by layers_map.

profiles

A data.frame where each row indicates one unique profile that is characterised by all id_cols present in the original input as well as the corresponding "gd_id", "sp_id", and "group_id". Each row has a unique identifier "prof_id".

id_cols

A character vector of all columns that identify a profile uniquely.

See Also

Other data formats: cfp_gasdata(), cfp_layered_profile(), cfp_layers_map(), cfp_profile(), cfp_soilphys()

Examples

gasdata <- cfp_gasdata(
  ConFluxPro::gasdata,
  id_cols = c("site", "Date"))
soilphys <- cfp_soilphys(
  ConFluxPro::soilphys,
  id_cols = c("site", "Date"))
layers_map <-
 cfp_layers_map(
   ConFluxPro::layers_map,
   gas = "CO2",
   lowlim = 0,
   highlim = 1000,
   id_cols = "site")
base_dat <- cfp_dat(gasdata, soilphys, layers_map)

### filter similar to dplyr::fliter
filter(base_dat, site == "site_a")
filter(base_dat, prof_id %in%  1:5)

valentingar/ConFluxPro documentation built on Dec. 1, 2024, 9:35 p.m.