
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(
object,
path = object@path,
embed_model = NULL,
embed_datasets = NULL,
mode = NULL,
format = get_storage_format(),
overwrite = TRUE,
clean_start = FALSE,
write_log = TRUE,
verbose = isVerbose(),
thin = FALSE
)Arguments
- object
scenario object.
- path
character. Path to scenario directory.
- embed_model
NULL(default: bymode),TRUE, orFALSE. Controls whether the model is embedded in the saved scenario or referenced from the model store (seesave_model()).NULL: reference a sealed version holding the model's exact content, embed otherwise.TRUE: always embed (self-contained folder).FALSE: require a sealed version, error otherwise. A referenced save stores only{name, hash, path}and is recorded on the sealed version (list_dependents());load_scenario()resolves it back.- 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.- mode
"ref"or"full"; defaults togetOption("energyRt.save_mode", "ref")."ref"references the model when its exact content is a SEALED version in the model store (seal_model()) and copies it in otherwise;"full"copies the model and the datasets in (a self-contained folder). An explicitembed_model/embed_datasetsoverrides the mode for its level.- 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.
- thin
logical.
TRUEreturns the scenario with the tables it wrote emptied, which is whatto_disk()does.
Details
Saving writes a copy and does not change where the scenario keeps its
tables: one held in memory comes back in memory, one on disk stays on
disk. to_disk() and to_memory() move a scenario between the two.
For a scenario held in memory this is the only writer of a run's modOut/
store: without a save its solution 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. A scenario on
disk is recorded by every stage, and saving it is a checkpoint.