hydromodpy.data.sidecars#

JSON sidecars carrying upstream provenance for data/<var>/raw/ inputs.

Every physical input file (DEM, GeoPackage, NetCDF, etc.) sits next to a JSON sidecar that describes its origin and content fingerprint. The sidecar lives at <file_path>.json and is meant to be regenerated automatically by hmp data fetch and edited by the user when refining provenance.

Specification: reports_db/99_master.md §5.3.

Module attributes

DETERMINISTIC_FETCHED_AT_ENV

Env var that, when set to "1", forces fetched_at to None for every remote source.

Functions

compute_sha256(path[, chunk_size])

Return the streaming SHA-256 hex digest of path.

load_sidecar(file_path)

Load and validate the sidecar next to file_path.

resolve_fetched_at(source, *[, now])

Return the fetched_at value for a sidecar.

sidecar_path_for(file_path)

Return the sidecar path for file_path (foo.tif -> foo.tif.json).

write_sidecar(file_path, sidecar)

Write a JSON sidecar next to file_path.