
Save scenario object on disk in parquet format using arrow package.
Source: R/arrow.R
save_scenario.RdSave scenario object on disk in parquet format using arrow package.
Usage
save_scenario(
scen,
path = scen@path,
embed_model = NULL,
embed_datasets = NULL,
format = get_storage_format(),
overwrite = TRUE,
clean_start = FALSE,
write_log = TRUE,
verbose = TRUE
)Arguments
- scen
scenario object.
- path
character. Path to scenario directory.
- embed_model
NULL(default),TRUE, orFALSE. Controls whether the model is embedded in the saved scenario or referenced from the model store (seesave_model()).NULL: reference the store entry, saving the model to the store first when nothing is stored under that name; embed when the name is taken by different content (store entries update in place, so writing would replace the version other scenarios reference).TRUE: always embed (self-contained folder).FALSE: require an existing store hit, error otherwise, and never write to the store. A referenced save stores only{name, hash, path};load_scenario()resolves it back via the registry / model store.- embed_datasets
the same choice for the big data tables and maps — the geoscale on
@settingsand, when the model is embedded, its geoscale and its repositories' weather/demand tables (seesave_dataset()).NULL(default) references whatever identical content is already in the dataset store;TRUEalways embeds;FALSErequires a store hit.- format
file format (currently
parquetonly, arrow or feather will be implemented in further releases).- overwrite
logical. Overwrite existing scenario directory.
- clean_start
logical. Clean scenario directory before saving.
- write_log
logical. Write (update) logfile.
- verbose
logical. Print messages.
Details
This is the only writer of a run's modOut/ store: read_solution() leaves
the solution in memory, and without a save it does not survive the session.
The store is written for the ACTIVE run — whichever @misc$run names — so
saving while one run is active does not persist another's solution.
import_solution() does the read and the save in one call.