Skip to contents

This function creates database files for all specified scenarios. It can run in parallel and supports saving to different storage options. This function calls create_one_database_file() for each scenario, which runs the model and creates the corresponding database file.

Usage

create_database(
  scenarios = get_scenarios(cfg = cfg),
  parallel = FALSE,
  parallel_strategy = ifelse(.Platform$OS.type == "unix", "multicore", "multisession"),
  parallel_workers = Sys.getenv("OPTIRRIG_PTGE_PARALLEL_WORKERS",
    future::availableCores() - 1),
  force = FALSE,
  write_results = cfg$data$write_results,
  save_to = "nextcloud",
  verbose = FALSE,
  cfg = loadConfig()
)

Arguments

scenarios

data.frame A data frame containing the scenarios to process. See get_scenarios() for details on the required structure.

parallel

logical Whether to run the processing in parallel.

parallel_strategy

character The parallel strategy to use. Defaults to "multicore" on Unix systems and "multisession" on Windows.

parallel_workers

integer The number of parallel workers to use. By default, it uses one less than the number of available cores.

force

logical Whether to force the creation of database files even if they already exist. Defaults to FALSE.

write_results

logical Whether to actually run the model and write the results. If FALSE, the function will skip running the model and creating the database files. Defaults to the value specified in the configuration.

save_to

character The storage option to save the database files to. Options are "nextcloud" or "s3". Defaults to "nextcloud".

verbose

logical Whether to print verbose output during processing.

cfg

a config object. Configuration to use. See loadConfig for details

Value

logical Returns TRUE invisibly if the function completes successfully.