Update CLAUDE.md with diagnostics module documentation
Add Diagnostics section, mixed package layout details, updated test
counts (148 tests across 8 files), and plotly optional dependency.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
-`python/powersheds/__init__.py` - Package init, re-exports from `_lib`
-`python/powersheds/diagnostics.py` - Interactive diagnostic visualization (see Diagnostics section)
**Three Object Types**:
-**Reservoir**: Pool elevation from storage-elevation curves, head calculation, release/power via bilinear HPF interpolation, storage/capacity constraints
@@ -57,10 +61,32 @@ After any Rust code changes, run `maturin develop` to recompile.
- Power: MW
- HPF flows (`hpf_q`): m³/s (cumecs)
## Diagnostics
The `powersheds.diagnostics` module provides interactive visualization for simulation results. Requires the `viz` optional dependency: `uv pip install -e ".[viz]"`
-`cascade_diagnostics(results, ...)` → Plotly `go.Figure` with dropdown reservoir selector, three linked time series panels (flows, elevation, power), and infeasible power shading
-`network_diagram(cascade_data, ...)` → matplotlib `Figure` with publication-quality static network diagram (trapezoid reservoir nodes, Bezier edges, lag labels)
-`save_diagnostics_html(results, output_path, ...)` → writes standalone HTML file
**Internal helpers** (prefixed with `_`):
-`_build_topology(cascade_data)` - Extract nodes/edges from CascadeData
-`tests/test_cascade.py` - Full cascade integration (13 tests): output structure, multi-reservoir routing, simulation ordering, mass balance, physical invariants, Cumberland NaN check
-`tests/test_simulate_timestep.py` - Per-timestep reservoir constraints (10 tests): below power pool, min/max release, insufficient water, spill, mass balance, unconstrained power equality