Scenarios & CLI¶
Build a simulation from a JSON scenario, or run one from the command line with
python -m mesoltm scenario.json. For the JSON schema and a worked example, see
Running a scenario.
Scenario I/O¶
build_scenario
¶
build_scenario(data: dict, base_path: Path | None = None) -> Simulation
Build a :class:Simulation from a parsed scenario dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
The scenario dictionary (see module docstring for the schema). |
required |
base_path
|
Path | None
|
Directory used to resolve relative output file paths. |
None
|
Returns:
| Type | Description |
|---|---|
Simulation
|
A configured simulation ready to :meth: |
load_scenario
¶
load_scenario(path: str | Path) -> Simulation
Load a JSON scenario file and build its simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the |
required |
Returns:
| Type | Description |
|---|---|
Simulation
|
A configured :class: |
save_scenario
¶
Write a scenario dictionary to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
The scenario dictionary. |
required |
path
|
str | Path
|
Destination path. |
required |
Command line¶
main
¶
Run the mesoltm CLI.
Parses a scenario path, runs the simulation, and writes any configured link/trip CSV outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
Sequence[str] | None
|
Optional argument list (defaults to |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Process exit code ( |