read_config: Read an LPJmL configuration file

View source: R/read_config.R

read_configR Documentation

Read an LPJmL configuration file

Description

Reads a configuration (config) file (compilable csjon/js file or json file) and turns it into a nested list object.

Usage

read_config(filename, from_restart = FALSE, macro = "")

Arguments

filename

Character string representing path (if different from current working directory) and filename.

from_restart

Logical defining whether config files should be read as from_restart (transient run) or without (spinup run). Defaults to FALSE (spinup run). Used only if file is not pre-compiled (no json).

macro

Optional character string to pass one or several macros to the pre-compiler, e.g. ("-DFROM_RESTART"). Used only if file is not pre-compiled (no json).

Value

A nested list object representing the LPJmL configuration read from filename.

Examples

## Not run: 
 config <- read_config(filename = "config_spinup.json")

 config[["version"]]
 # [1] "5.3"

 config[["pftpar"]][[1]][["name"]]
 # [1] "tropical broadleaved evergreen tree"

 config[["input"]][["coord"]][["name"]]
 # [1] "input_VERSION2/grid.bin"

 # visualize configuration as tree view
 View(config)

## End(Not run)

lpjmlkit documentation built on March 31, 2023, 9:35 p.m.