bloc.plotting.network_mermaid#
Render a STONE model’s network topology as a Mermaid flowchart.
Derives the diagram straight from a model’s YAML network: (or staged
stages:) section – the same source Boulder’s Cytoscape graph reads –
instead of hand-drawing a diagram that would need to be kept in sync by
hand. Only structural fields are read (node/connector id and kind,
source, target): no operating parameters, so the output is safe to
commit even for proprietary models.
CLI:
python -m bloc.plotting.network_mermaid models/SPRING_A4B/SPRING_A4B_BG.yaml
prints a ```` `mermaid `` fenced block ready to paste into a README.
Add --sync-readme to instead write it into that model’s README.md,
between auto-generated markers – rerunning updates only that section.
Functions#
|
Return Mermaid |
|
Write/replace the auto-generated diagram section in the model's README. |
|
Module Contents#
- bloc.plotting.network_mermaid.generate_mermaid(yaml_path, direction='LR')#
Return Mermaid
flowchartsource for the network inyaml_path.Staged configs (
stages:+ per-stage entry lists) render onesubgraphper stage; a flatnetwork:renders unwrapped.
- bloc.plotting.network_mermaid.sync_readme(yaml_path)#
Write/replace the auto-generated diagram section in the model’s README.
Looks for
README.mdnext toyaml_path. Idempotent: a section already bounded by_DIAGRAM_START/_DIAGRAM_ENDis replaced in place; otherwise the section is appended at the end of the file.
- bloc.plotting.network_mermaid.main(argv=None)#