dynamical_system: Validating dynamical system inputs

dynamical_systemR Documentation

Validating dynamical system inputs

Description

Utility function for checking inputs to run_biocro without running it

Usage

  validate_dynamical_system_inputs(
      initial_values = list(),
      parameters = list(),
      drivers,
      direct_module_names = list(),
      differential_module_names = list(),
      verbose = TRUE
  )

Arguments

initial_values

Identical to the corresponding argument from run_biocro.

parameters

Identical to the corresponding argument from run_biocro.

drivers

Identical to the corresponding argument from run_biocro.

direct_module_names

Identical to the corresponding argument from run_biocro.

differential_module_names

Identical to the corresponding argument from run_biocro.

verbose

Identical to the corresponding argument from run_biocro.

Details

validate_dynamical_system_inputs accepts the same input arguments as run_biocro with the exception of ode_solver (which is not required to check the validity of a dynamical system).

validate_dynamical_system_inputs checks a set of parameters, drivers, modules, and initial values to see if they can properly define a dynamical system and can therefore be used as inputs to run_biocro. Although the run_biocro function performs the same validity checks, the validate_dynamical_system_inputs includes additional information, such as a list of parameters whose values are not used as inputs by any modules, since in principle these parameters could be removed for clarity.

When using one of the pre-defined crop growth models, it may be helpful to use the with command to pass arguments to validate_dynamical_system_inputs; see the documentation for crop_model_definitions for more information.

Value

A boolean indicating whether or not the inputs are valid.

See Also

run_biocro

Examples

# Example 1: missing a parameter and an initial value
validate_dynamical_system_inputs(
  within(soybean$initial_values, rm(Leaf)),         # remove the initial `Leaf` value
  within(soybean$parameters, rm(leaf_reflectance)), # remove `leaf_reflectance`
  soybean_weather$'2002',
  soybean$direct_modules,
  soybean$differential_modules
)

# Example 2: a valid set of input arguments
validate_dynamical_system_inputs(
  soybean$initial_values,
  soybean$parameters,
  soybean_weather$'2002',
  soybean$direct_modules,
  soybean$differential_modules
)

ebimodeling/biocro documentation built on April 23, 2024, 7:06 p.m.