hypso.io.provenance#

Processing provenance carried in every product.

Each processing step adds a metadata/processing/<step> node (one per step, kept when the product is read and written again, so a file holds its whole lineage) and one line to the global history attribute:

2026-10-26T10:02:11Z: l1c from HYPSO2_HSI.20250612T095802.aeronetvenice.L1B.nc,

hypso-package 26.10.0 (git 25f4c3bf)

Node attributes: date_utc, software / software_version / software_git_commit / software_git_dirty, input_file, the step’s parameters (scalars as attributes, anything else as JSON), and optionally:

  • calibration: package / version / git commit, and <kind>_file + <kind>_sha256 for every coefficient file loaded (versions alone don’t identify coefficients - see docs/versioning.rst);

  • ac: tool, version, git commit, install path, settings_effective (full settings actually used, JSON) and settings_user (only what the user set). Credential-like keys are removed and listed in settings_redacted_keys.

Functions#

ac_attrs(tool[, version, git_commit, install_path, ...])

Provenance attributes for an atmospheric correction tool run.

ac_global_attrs(ac)

The AC provenance attributes that go into a file's global attributes (AC_GLOBAL_ATTRS

add_step(tree, step, *[, input_file, parameters, ...])

Record a processing step on a product tree, in place.

attr_value(value)

A NetCDF-storable attribute value: bools as "true"/"false", None as

calibration_attrs(package, files)

Provenance attributes for the calibration files used.

redact(settings)

Remove credential-like keys (user names, passwords, tokens, secrets, API keys) from settings.

software_attrs()

hypso-package's name, version and git commit, for a provenance step.

utc_now()

The current UTC time, ISO 8601 to the second with a Z suffix.

Module Contents#

hypso.io.provenance.ac_attrs(tool, version=None, git_commit=None, install_path=None, settings_effective=None, settings_user=None, git_dirty=None, components=None)[source]#

Provenance attributes for an atmospheric correction tool run.

Parameters:
  • tool (str) – The tool and how it was installed; the commit is “” when the tool is not a git checkout.

  • version (str) – The tool and how it was installed; the commit is “” when the tool is not a git checkout.

  • git_commit (str) – The tool and how it was installed; the commit is “” when the tool is not a git checkout.

  • install_path – The tool and how it was installed; the commit is “” when the tool is not a git checkout.

  • git_dirty (bool or None) – Uncommitted changes in the tool’s checkout (ac_git_dirty “true”/”false”; “unknown” when a commit is known but its state is not; “” without a commit).

  • components (dict, optional) – Other parts of the tool with their own checkout, {name: (commit, dirty)}, recorded as ac_<name>_git_commit / ac_<name>_git_dirty (e.g. POLYMER’s eoread, which holds the HYPSO reader).

  • settings_effective (dict) – Stored as JSON with credential-like keys removed (redact()).

  • settings_user (dict) – Stored as JSON with credential-like keys removed (redact()).

Return type:

dict

hypso.io.provenance.ac_global_attrs(ac)[source]#

The AC provenance attributes that go into a file’s global attributes (AC_GLOBAL_ATTRS and the extra components’ version, commit and dirty flags); not settings or paths.

Parameters:

ac (dict)

Return type:

dict

hypso.io.provenance.add_step(tree, step, *, input_file=None, parameters=None, calibration=None, ac=None)[source]#

Record a processing step on a product tree, in place.

Adds metadata/processing/<step> and a line to the history attribute.

Parameters:
Return type:

None

hypso.io.provenance.attr_value(value)[source]#

A NetCDF-storable attribute value: bools as “true”/”false”, None as “”, containers as JSON, numbers and strings unchanged.

hypso.io.provenance.calibration_attrs(package, files)[source]#

Provenance attributes for the calibration files used.

Parameters:
  • package (str) – Calibration package, e.g. "hypso2_calibration".

  • files (dict) – {kind: path}, e.g. {"radiometric": ..., "smile": ...}; None entries (a correction not applied) are skipped.

Returns:

The package’s version and commit, and each file’s name and sha256.

Return type:

dict

hypso.io.provenance.redact(settings)[source]#

Remove credential-like keys (user names, passwords, tokens, secrets, API keys) from settings.

Returns:

  • settings (dict) – Without those keys.

  • removed (list of str) – The removed keys, sorted.

Parameters:

settings (dict)

hypso.io.provenance.software_attrs()[source]#

hypso-package’s name, version and git commit, for a provenance step.

Return type:

dict

hypso.io.provenance.utc_now()[source]#

The current UTC time, ISO 8601 to the second with a Z suffix.

Return type:

str