smif.cli package¶
Module contents¶
A command line interface to the system of systems framework
This command line interface implements a number of methods.
- setup creates a new project folder structure in a location
- run performs a simulation of an individual sector model, or the whole
- system of systems model
- validate performs a validation check of the configuration file
Folder structure¶
When configuring a system-of-systems model for the CLI, the folder structure
below should be used. In this example, there is one sector model, called
water_supply:
/main_config.yaml
/timesteps.yaml
/water_supply.yaml
/data/all/inputs.yaml
/data/water_supply/
/data/water_supply/inputs.yaml
/data/water_supply/outputs.yaml
/data/water_supply/assets/assets1.yaml
/data/water_supply/planning/
/data/water_supply/planning/pre-specified.yaml
The data folder contains one subfolder for each sector model.
The sector model implementations can be installed independently of the model run configuration. The main_config.yaml file specifies which sector models should run, while each set of sector model config
-
smif.cli.build_model_run(model_run_config)[source]¶ Builds the model run
Parameters: model_run_config (dict) – A valid model run configuration dict with objects Returns: Return type: smif.modelrun.ModelRun
-
smif.cli.confirm(prompt=None, response=False)[source]¶ Prompts for a yes or no response from the user
Parameters: Returns: True for yes and False for no.
Return type: Notes
response should be set to the default value assumed by the caller when user simply types ENTER.
Examples
>>> confirm(prompt='Create Directory?', response=True) Create Directory? [y]|n: True >>> confirm(prompt='Create Directory?', response=False) Create Directory? [n]|y: False >>> confirm(prompt='Create Directory?', response=False) Create Directory? [n]|y: y True
-
smif.cli.get_model_run_definition(args)[source]¶ Builds the model run
Returns: The complete sos_model_run configuration dictionary with contained ScenarioModel, SosModel and SectorModel objects Return type: dict
-
smif.cli.get_narratives(handler, narratives)[source]¶ Load the narrative data from the sos model run configuration
Parameters: - handler (
smif.data_layer.DataInterface) – - narratives (list) – A list of narrative_set, narrative_list/narrative pairs
Returns: A list of
smif.parameter.Narrativeobjects populated with dataReturn type: - handler (
-
smif.cli.load_interval_sets(handler)[source]¶ Loads the time-interval sets into the project registries
Parameters: handler ( smif.data_layer.DataInterface) –
-
smif.cli.load_region_sets(handler)[source]¶ Loads the region sets into the project registries
Parameters: handler ( smif.data_layer.DataInterface) –
-
smif.cli.parse_arguments()[source]¶ Parse command line arguments
Returns: Return type: argparse.ArgumentParser