hydromodpy.results.geographic_cache#

Workspace-level content-addressable geographic cache.

A catchment may be re-used across hundreds of simulations (e.g. calibration runs sweeping hydraulic parameters on a fixed domain). The geographic artefacts - DEM raster, geology raster, watershed polygon, river network - are identical across all those runs and do not need to be duplicated inside each simulations/<basename>.zarr.

This module provides GeographicCache, a deterministic, read-through cache keyed by a SHA-256 fingerprint computed from the resolved spatial inputs:

  • DEM path + file SHA-256 + bounding box + resolution;

  • geology path + file SHA-256;

  • CRS, bbox, delineation options.

Simulations store only the fingerprint string (via simulations.geographic_fingerprint); the actual arrays live once per unique input set under workspace/geographic/<fingerprint>/.

Portable packages (.hmp) rematerialise the cache directory on export and redeposit it on import, keeping the archive self-contained without giving up the deduplication benefit inside the workspace.

Module attributes

CACHE_DIRNAME

Sub-directory under workspace/ that hosts the shared cache.

MANIFEST_FILENAME

Attribute key written on each <fingerprint>/ directory to tie a fingerprint back to its input descriptor for debugging and audit.

Classes

GeographicCache(workspace_path)

Read-through cache of geographic artefacts at workspace/geographic/.

GeographicInputs([dem_path, dem_sha256, ...])

Normalized, fingerprintable description of spatial inputs.