Editable inputs vs. computed outputs#
pyiwfm reads two distinct categories of model data, and they have different round-trip stories:
Editable model inputs — files the user authored (mesh, stratigraphy, aquifer parameters, time-series boundary conditions, etc.). pyiwfm reads them, lets you mutate them in Python, and writes them back so IWFM can re-run the model. Every input has both a reader and a writer.
Computed outputs / analysis modules — files IWFM produces (heads, hydrographs, subsidence, budgets) and Python-side analysis results (drawdown reports, stream depletion). These are read-only by design: if you want different outputs, edit the inputs and re-run IWFM.
The audit on which this distinction is based is documented in CHANGELOG v1.3.0; the table below is the canonical reference.
Editable model inputs#
Every component that loads from disk also writes back to disk. The
mutation helpers on IWFMModel are the
documented Python API for editing them; see Mutating loaded models for
end-to-end examples.
Component |
Reader / Writer |
Mutation helper |
One-liner |
|---|---|---|---|
Mesh (nodes, elements) |
|
direct on |
|
Stratigraphy |
|
|
|
Aquifer parameters (Kh, Kv, Ss, Sy, aquitard_kv) |
|
|
|
Initial heads |
|
direct on |
|
GW boundary conditions / pumping / tile drains |
|
direct on |
|
GW observation wells (hydrograph locations) |
|
|
|
Stream network (reaches, nodes, diversions, bypasses, inflows) |
|
direct on |
|
Lakes |
|
direct on |
|
Root zone (crop types, soil, land use) |
|
direct on |
|
Small watersheds |
|
direct on |
|
Unsaturated zone |
|
direct on |
|
Time series (pumping schedules, BCs, inflows, climate) |
|
direct on the relevant time-series object |
|
Supply adjustment specification |
|
direct on |
|
Simulation main file (dates, solver options) |
|
direct on the simulation config |
(configure before re-running with |
To save a mutated model:
from pyiwfm.io import save_complete_model
save_complete_model(model, output_dir="modified_model")
Computed outputs / analysis modules#
These modules read data IWFM produced or analysis pyiwfm computes. They have no writer for the canonical output format — that would be a parallel write path that drifts from the source of truth. Where users need a stakeholder-friendly export (CSV, JSON, Excel, plot, GeoJSON), the module exposes dedicated report writers that don’t pretend to be IWFM input.
If you want different outputs, edit the inputs (above) and re-run IWFM
via IWFMRunner.
Module |
Source |
Available report exports |
|---|---|---|
|
IWFM HDF5 ( |
none — see web-viewer download endpoints in |
|
IWFM hydrograph output (.out) |
same |
|
IWFM |
same |
|
IWFM |
|
|
IWFM |
none (read for diagnostics) |
|
cached HDF5 produced by the rootzone pipeline |
none — the canonical input path is |
|
internal SQLite cache for the web viewer |
not user-facing |
|
computes drawdown by comparing two model runs |
tabular CSV / JSON / Excel writers (planned, Phase 2.2.a) |
|
computes stream depletion by comparing two model runs |
tabular CSV / JSON / Excel writers + plots + maps (planned, Phase 2.2.a) |
Why this distinction matters#
A user editing LazyHeadDataLoader-loaded heads on disk and saving
them would see no change in the next IWFM run — IWFM would overwrite
the heads HDF5 with whatever new heads the simulation produces. The
model-update path is always: edit the inputs, re-run IWFM, read the new
outputs.