Skip to contents

An S3 class cfp_run_map to be used in alternate(). Either create a new run map from a cfp_pfres or cfp_fgres model or extract an existing run_map from an cfp_altres object.

Usage

cfp_run_map(
  x,
  params = list(),
  type = NULL,
  method = NULL,
  n_runs = NULL,
  layers_different = FALSE,
  layers_from = "layers_map",
  layers_altmap = NULL,
  topheight_adjust = FALSE
)

Arguments

x

Either a cfp_pfres or cfp_fgres model result.

params

A named list of numeric vectors. Names indicate column names in soilphys, vectors either distinct values (method permutation) or limits (method random).

type

A vector of length param indicating what the values in params represent. One of

abs

Absolute values that are applied as-is.

factor

Factors to be multiplied with the original values.

addition

Factors to be added to the original values.

method

Either 'random', where a random value is chosen within the bounds set in params or 'permutation', where every permutation of the values in params is added.

n_runs

Integer value of the number of alterations to be done for method = 'random'.

layers_different

Should layers from layers_map be changed individually? If TRUE this allows for different changes at different depths.

layers_from

(character) If layers_different is TRUE, from which source should the layers be created? One of:

layers_map

(default) Use the layers that are defined in layers_map.

soilphys

Use the layers as defined in soilphys

layers_altmap

Use the layers as defined in the provided layers_altmap object.

layers_altmap

An optional layers_map created using layers_map() that defines the layers to be used if layers_different = TRUE.

topheight_adjust

(logical) If the proposed change in topheight is larger than the highest layer in soilphys, should the limits be automatically adjusted per id_cols individually? Default is FALSE, which leads to an error in that case.

Value

An object of type cfp_run_map that can be used within alternate.

Examples

PROFLUX <- ConFluxPro::base_dat |> pro_flux()
# Create a cfp_run_map where TPS is changed between 90 % and 110 %
# of the original value for 50 runs.
cfp_run_map(
  PROFLUX,
  list("TPS" = c(0.9, 1.1)),
  "factor",
  n_runs = 50)
#> 
#> A cfp_run_map to be used in alternate(). 
#> number of runs:  50 
#> parameters to alternate:
#>   param param_id
#> 1   TPS        1
#>    run_id param     value   type gas param_id
#> 1       1   TPS 1.0412868 factor CO2        1
#> 2       2   TPS 1.0897153 factor CO2        1
#> 3       3   TPS 0.9360678 factor CO2        1
#> 4       4   TPS 0.9433800 factor CO2        1
#> 5       5   TPS 1.0360326 factor CO2        1
#> 6       6   TPS 0.9997691 factor CO2        1
#> 7       7   TPS 1.0283359 factor CO2        1
#> 8       8   TPS 1.0320569 factor CO2        1
#> 9       9   TPS 0.9192048 factor CO2        1
#> 10     10   TPS 1.0531200 factor CO2        1
#> 11     11   TPS 1.0539350 factor CO2        1
#> 12     12   TPS 1.0981425 factor CO2        1
#> 13     13   TPS 1.0941042 factor CO2        1
#> 14     14   TPS 0.9778366 factor CO2        1
#> 15     15   TPS 0.9922373 factor CO2        1
#> 16     16   TPS 0.9630484 factor CO2        1
#> 17     17   TPS 0.9349352 factor CO2        1
#> 18     18   TPS 1.0063147 factor CO2        1
#> 19     19   TPS 0.9987274 factor CO2        1
#> 20     20   TPS 1.0558617 factor CO2        1
#> 21     21   TPS 0.9408357 factor CO2        1
#> 22     22   TPS 1.0426795 factor CO2        1
#> 23     23   TPS 0.9130432 factor CO2        1
#> 24     24   TPS 0.9708414 factor CO2        1
#> 25     25   TPS 1.0650399 factor CO2        1
#> 26     26   TPS 0.9547636 factor CO2        1
#> 27     27   TPS 1.0140090 factor CO2        1
#> 28     28   TPS 0.9671438 factor CO2        1
#> 29     29   TPS 1.0192526 factor CO2        1
#> 30     30   TPS 0.9383036 factor CO2        1
#> 31     31   TPS 1.0895528 factor CO2        1
#> 32     32   TPS 1.0084961 factor CO2        1
#> 33     33   TPS 1.0089207 factor CO2        1
#> 34     34   TPS 0.9557194 factor CO2        1
#> 35     35   TPS 0.9893405 factor CO2        1
#> 36     36   TPS 0.9743022 factor CO2        1
#> 37     37   TPS 0.9056122 factor CO2        1
#> 38     38   TPS 0.9931974 factor CO2        1
#> 39     39   TPS 0.9780063 factor CO2        1
#> 40     40   TPS 0.9040130 factor CO2        1
#> 41     41   TPS 0.9753942 factor CO2        1
#> 42     42   TPS 1.0119826 factor CO2        1
#> 43     43   TPS 1.0714167 factor CO2        1
#> 44     44   TPS 0.9769619 factor CO2        1
#> 45     45   TPS 1.0055834 factor CO2        1
#> 46     46   TPS 1.0201275 factor CO2        1
#> 47     47   TPS 0.9522743 factor CO2        1
#> 48     48   TPS 0.9580100 factor CO2        1
#> 49     49   TPS 0.9960150 factor CO2        1
#> 50     50   TPS 1.0840011 factor CO2        1