Skip to contents

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

Examples

gasdata <- cfp_gasdata(
  ConFluxPro::gasdata,
  id_cols = c("site", "Date"))
#> 
#> added 'gas' to id_cols
soilphys <- cfp_soilphys(
  ConFluxPro::soilphys,
  id_cols = c("site", "Date"))
#> 
#> added 'gas' to id_cols
layers_map <-
 cfp_layers_map(
   ConFluxPro::layers_map,
   gas = "CO2",
   lowlim = 0,
   highlim = 1000,
   id_cols = "site")
#> 
#> added 'gas' to id_cols
base_dat <- cfp_dat(gasdata, soilphys, layers_map)
#> 
#> validating datasets
#> id_cols: site, Date, gas
#> 24 unique profiles

### filter similar to dplyr::fliter
filter(base_dat, site == "site_a")
#> 
#> A cfp_dat object to be used as input in ConFluxPro models. 
#> id_cols: site Date gas 
#> number of profiles:  12 
#> number of groups:  1 
#> 
filter(base_dat, prof_id %in%  1:5)
#> 
#> A cfp_dat object to be used as input in ConFluxPro models. 
#> id_cols: site Date gas 
#> number of profiles:  5 
#> number of groups:  2 
#>