hydromodpy.results.run#

Single-simulation view on the results catalog.

What#

Read-only facade over one row of the simulations table. Run lazy-loads its catalog row on first access and exposes typed properties (solver, status, n_layers …), tabular accessors (parameters, metrics, timeseries, budget, mass_balance, provenance), field-array readers (field, mesh, geographic, geographic_raster) and spatial helpers (grid, catchment_mask, dem, outlet). Heavier xarray / UGRID readers (dataset, to_xarray_batch, at) live on the hydromodpy.results.run_array.RunArrayProvider exposed as run.array. Derived catchment views are module-level functions in hydromodpy.results.views (saturated_fraction, drainage_density, persistence, catchment_mean, recharge_forcing).

Why#

Notebook and script users need a stable per-simulation handle that hides the DuckDB / Zarr split. Caching is per-instance to avoid repeated catalog hits inside a session; cross-process freshness is handled by the catalog itself.

The class composes per-concern mixins to stay under the 50-method limit:

  • RunGeographicMixin (geographic features, rasters, grid, mesh, field I/O)

  • RunTimeseriesMixin (parameters, metrics, budgets, timeseries, time index)

  • RunHydrographicMixin (canonical hydrographic-network roles)

Per-cell views (saturated_fraction, drainage_density, persistence, cell_field_*, release_flux_*, catchment_mean) live as module-level functions in hydromodpy.results.views and consume a Run instance as their first argument.

Public API#

  • Run: instantiated by SimulationCatalog resolution methods. Also exposes run.array for xarray / UGRID readers.

  • hydromodpy.results.run_array.RunArrayProvider exposes dataset and to_xarray_batch.

Cross-refs#

  • hydromodpy.results.catalog.SimulationCatalog owns this object’s data.

  • hydromodpy.results.simulation_group.SimulationGroup iterates over Run instances.

  • hydromodpy.results.grid.Grid backs the spatial helpers.

  • hydromodpy.results.derived provides the derived-metric implementations.

Classes

Run(sim_id, catalog)

Read one persisted simulation from a HydroModPy catalog.