smif.cli package¶
A command line interface to the system of systems framework
This command line interface implements a number of methods.
- setup creates an example project with the recommended folder structure
- 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
- app runs the graphical user interface, opening in a web browser
Folder structure¶
When configuring a project for the CLI, the folder structure below should be used. In this example, there is one system-of-systems model, combining a water supply and an energy demand model:
/config
project.yaml
/sector_models
energy_demand.yml
water_supply.yml
/sos_models
energy_water.yml
/model_runs
run_to_2050.yml
short_test_run.yml
...
/data
/initial_conditions
reservoirs.yml
/interval_definitions
annual_intervals.csv
/interventions
water_supply.yml
/narratives
high_tech_dsm.yml
/region_definitions
/oxfordshire
regions.geojson
/uk_nations_shp
regions.shp
/scenarios
population.csv
raininess.csv
/water_supply
/initial_system
/models
energy_demand.py
water_supply.py
/planning
expected_to_2020.yaml
national_infrastructure_pipeline.yml
The sector model implementations can be installed independently of the model run
configuration. The paths to python wrapper classes (implementing SectorModel)
should be specified in each sector_model/*.yml
configuration.
The project.yaml file specifies the metadata shared by all elements of the
project; sos_models
specify the combinations of sector_models
and
scenarios
while individual model_runs
specify the scenario, strategy
and narrative combinations to be used in each run of the models.
Submodules:
Functions:
confirm |
Prompts for a yes or no response from the user |
list_model_runs |
List the model runs defined in the config |
main |
Parse args and run |
parse_arguments |
Parse command line arguments |
run_app |
Run the client/server application |
run_model_runs |
Run the model runs as requested. |
setup_project_folder |
Setup a sample project |
Data:
USE_WIN32 |
bool(x) -> bool |
Reference¶
-
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.
parse_arguments
()[source]¶ Parse command line arguments
Returns: Return type: argparse.ArgumentParser