run_parameter_scan: Parameter Scan

View source: R/parameter_scan.R

run_parameter_scanR Documentation

Parameter Scan

Description

Run ModVege for a different sets of parameters.

Usage

run_parameter_scan(environment, param_values, force = FALSE, outfilename = "")

Arguments

environment

Either a ModvegeEnvironment instance with all the site, management and weather inputs expected by ModvegeSite⁠$run()⁠ or a string representing the name of a config file to read in order to generate the ModvegeEnvironment with read_config(). Note that, in the latter case, only the first found configuration is used if there are more than one valid uncommented lines in the config file.

param_values

A named list where each key stands for a ModVege parameter, i.e. a member of ModvegeParameters⁠$parameter_names⁠. Each list entry then has to be a vector containing the allowed values for the respective parameter. All possible allowed combinations of these parameter values are then generated and fed into a ModVege run.

force

Boolean. By default (force = FALSE), the function first counts the number of parameter combinations that need to be run and asks the user, if it should proceed. This can be suppressed by letting force = TRUE.

outfilename

String. If nonempty, the results are stored as an rds file with filename outfilename using the saveRDS() function.

Value

results A list containing an entry for each supplied parameter set in param_values. Each entry is itself a list containing the following keys:

params

The parameter set that was used to run ModVege for this entry.

data

A list containing for each simulated year a ModvegeSite object which was run for the respective year and therefore carries the respective results.

Note

Special care has to be taken in the creation of the param_values argument. It's possible to choose values that do not allow for any valid combination. Confer create_combinations().

See Also

ModvegeParameters, saveRDS(), create_combinations()

Examples

env = create_example_environment()
# We're creating a trivial list of parameters to explore here in order to 
# prevent the example from requiring a long time to execute. See 
# [create_combinations()] for more realistic uses of param_values.
param_values = list(w_FGA = c(0, 1), w_FGB = c(0, 1))
run_parameter_scan(env, param_values, force = TRUE)


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