Runs Stics simulations for the USMs found in usms_workspace (a text workspace as generated by gen_workspace_from_sms), and saves the resulting simulation and observation data as .rds files in output_dir. The saved files can later be reused as sim_rds/ref_sim_rds and obs_rds by evaluate or balance_closure_test, bypassing the need to run simulations or extract observations again.

run_simulations(
  stics_exe,
  usms_workspace,
  metadata_file,
  output_dir,
  usms_files = NULL,
  vars = NULL,
  parallel = FALSE,
  cores = NA
)

Arguments

stics_exe

path to the Stics executable

usms_workspace

path to the Stics text workspace containing the USMs to simulate

metadata_file

path to the metadata CSV file describing USM rotations (successive USMs)

output_dir

directory where the simulation results (simulations.rds) and observation data (observations.rds) will be written. Created if it doesn't exist.

usms_files

character vector of one or more paths to text files, each containing one USM name per line. If NULL (default), all USMs found in usms_workspace are simulated.

vars

character vector of variable names to simulate. If NULL (default), the variables are derived automatically from the observation files found in usms_workspace. Pass this explicitly to simulate variables that aren't observed, e.g. the balance closure variables consumed by balance_closure_test.

parallel

Boolean. Is the computation to be done in parallel ?

cores

Number of cores to use for parallel computation

Value

invisibly, a list with two elements: sim and obs, each a list of results (one tibble per USM), as returned by SticsOnR::stics_wrapper and SticsRFiles::get_obs respectively