Wrapper function to run STICS simulations and evaluate outputs using observations and/or other model versions.

stics_eval(
  dir.orig = NULL,
  dir.targ = getwd(),
  stics,
  Parameter = NULL,
  Plant = 1,
  obs_name = NULL,
  Out_var = c("lai(n)", "masec(n)", "hauteur"),
  plot_it = T,
  Parallel = T,
  mixed = NULL,
  Title = NULL,
  Erase = TRUE
)

Arguments

dir.orig

Path to the directory from which to copy the simulation files. If NULL (the default), uses the package dummy USM.

dir.targ

Path to the target directory for evaluation. Created if missing.

stics

STICS executable path named list (see details).

Parameter

STICS input parameter named list (see details).

Plant

Integer value of the plant on which to set the parameter if STICS is run on mixed crop (1= Principal, 2= Associated)

obs_name

A vector of observation file name(s). It must have the form c(Dominant,Dominated) for mixed crops. See read_obs() filename parameter for more details.

Out_var

The variables needed as output

plot_it

Boolean. Do the plot has to be pinted ?

Parallel

Are the simulations to be executed in parallel ?

mixed

(optional) Is the simulation made on mixed species (boolean)

Title

A title for the evaluation. This will be used on the ggplot object.

Erase

Should the simulations data be erased upon import (see details)?

Value

A list of three objects:

outputs

A list of data.frame objects corresponding to the simulation for each value in the stics or Parameter arguments. The data.frame is made by a call to eval_output().

gg_object

A summary plot of the simulations outputs returned as a ggplot object. Possibly a comparison between simulations if several values are given to the stics or Parameter arguments.

stats

A data.frame of a set of summary statistics for each simulation, computed by a call to stati_stics().

Details

The function evaluate STICS outputs either along different model versions OR parameter values, not both at the same time. The method is automatically chosen using the stics and Parameter length. The parameter with a length > 1 will be evaluated. The names of the stics or the Parameter list are used for reference in the outputs (data.frames and plots). The names are mandatory for Parameter, but are optionnal for stics. If no names are provided for stics, the function give a dummy name for each model evaluation. The format of both stics or Parameter parameters is the same: a named list of either STICS executable path or a named list of parameters value(s). Please set the Parameter argument to NULL (the default) for no parameter changes. The function run STICS executable in parrallel using all cores from the machine but one.

See also

sensitive_stics() to evaluate STICS sensitivity to parameter(s), and other functions used under the hood: eval_output(), import_usm(), run_stics(), stati_stics(), and set_out_var().

Examples

if (FALSE) { library(sticRs) # Evaluating a change in a parameter: Eval_parameter= stics_eval(dir.orig = "0-DATA/dummy/IC_Wheat_Pea", dir.targ = "2-Simulations/Parameterization", stics = list(EquivDens= "0-DATA/stics_executable/EquDens/stics.exe"), Parameter = list(interrang= c(0.05, 0.25)), obs_name = c("6_IC_Wheat_N02.obs","6_IC_Pea_N02.obs"), Out_var = c("raint", "trg(n)", "rsoleil", "lai(n)", "masec(n)", "hauteur", "cumraint", "fapar", "eai"), Title = "Wheat-Pea Auzeville 2005-2006 N0", plot_it = T) # Evaluating a change in the executable: Eval_stics= stics_eval(dir.orig = "0-DATA/dummy/IC_Wheat_Pea", dir.targ = "2-Simulations/Parameterization", stics = list(EquivDens= "0-DATA/stics_executable/EquDens/stics.exe"), obs_name = c("6_IC_Wheat_N02.obs","6_IC_Pea_N02.obs"), Out_var = c("raint", "trg(n)", "rsoleil", "lai(n)", "masec(n)", "hauteur", "cumraint", "fapar", "eai"), Title = "Wheat-Pea Auzeville 2005-2006 N0", plot_it = T) }