read_config: Read simulation run configurations from file

View source: R/utilities.R

read_configR Documentation

Read simulation run configurations from file

Description

The format of the configuration file is expected to contain 6 space-separated columns representing, in order:

site_name

Name of simulated site. This is used, for example, when an output file is created.

run_name

Name of this simulation run. Used to differentiate between different runs at the same site. Can be - to indicate no particular name, in which case nothing will be appended in the resulting output file.

year(s)

Specification of years to be simulated. Either a single number or a sequence in R's : notation, i.e. 2013:2022 to indicate all years from 2013 to (including) 2022.

param_file

Filename (not full path) of parameter file to use. The file is assumed to be located in input_dir (confer documentation for that parameter).

weather_file

Filename (not full path) of weather file. See also param_file.

management_file

Filename (not full path) of management file. See also param_file. Can be set to high, middle, low or - if no management data is to be used and the autocut routine shall be employed to simulate cutting events.

Rows starting with a ⁠#⁠ are skipped.

Usage

read_config(config_file, input_dir = NULL)

Arguments

config_file

Path to the configuration file to be read.

input_dir

Path to directory where input files are located. Defaults to getOptions("growR.input_dir", default = file.path("input")).

Value

A list of ModvegeEnvironment instances corresponding to the configurations in the order they appear in config_file.

Examples

# First, we set up the expected directory structure in a temporary place
tmp = file.path(tempdir(), "test-read_config")
dir.create(tmp)

# We need `force = TRUE` here in order to make the example work in 
# non-interactive settings.
setup_directory(root = tmp, include_examples = TRUE, force = TRUE)

# Now we can test `read_config`.
read_config(file.path(tmp, "example_config.txt"),
            input_dir = file.path(tmp, "input"))



growR documentation built on May 29, 2024, 9:12 a.m.