hydromodpy.calibration.lumped.ram_cache#

In-memory cache for lumped-model lightweight extraction.

Lumped catchment models (GR4J, …) finish a trial with their full simulated time series already in RAM. Writing them to Parquet/DuckDB for every trial is wasted I/O during calibration: only the metric extractor needs the values, and only the best promoted trial deserves the full catalog row.

LumpedRamCache is a tiny attribute attached to the trial execution registry. A solver run stores its hot series there via stash_series() and the calibration adapter reads them back through load_series().

The cache lives for one trial only. Forking a TrialContext spawns a fresh registry and therefore a fresh cache so trials never see each others’ series.

Functions

load_series(execution, station_id, variable)

Read a hot simulated series from the trial's LumpedRamCache.

stash_series(execution, station_id, ...)

Push a hot simulated series into the trial's LumpedRamCache.

Classes

LumpedRamCache([series])

Per-trial in-memory store of simulated series keyed by (station, variable).