write_configxml: Prepare ED2 parameter config file from a parameter list

Description Usage Arguments Value Author(s) Examples

View source: R/config-xml.R

Description

Prepare ED2 parameter config file from a parameter list

Usage

1
write_configxml(param_list, filename = NULL)

Arguments

param_list

Nested list of parameter values, or a data.frame with one row per PFT and parameters in columns (which will be converted to a list with purrr::transpose()).

filename

Name of file to write to. Default (NULL) means don't write to file.

Value

In-memory xml2 document representing the file (invisibly)

Author(s)

Alexey Shiklomanov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
l <- list(pft = list(num = 9, sla = 22), pft = list(num = 10, sla = 30))
write_configxml(l, tempfile())

# If list has no names, assume that each element is a PFT
# So, below command is identical to above.
l2 <- list(list(num = 9, sla = 22), list(num = 10, sla = 30))
write_configxml(l2, tempfile())

# Can also set non-PFT parameters this way
l3 <- list(
  pft = list(num = 9, sla = 22),
  pft = list(num = 10, sla = 30),
  phenology = list(retained_carbon_fraction = 0.5, theta_crit = 0.3)
)
write_configxml(l3, tempfile())

# data.frames are converted to lists with `purrr::transpose()`
df1 <- data.frame(num = c(9, 10), sla = c(22, 30))
write_configxml(df1, tempfile())

FoRTExperiment/ed4forte documentation built on March 21, 2020, 6:54 p.m.