eoio.processors.units.processor module#

eoio.processors.units.processor#

Top-level unit conversion processor.

This processor provides a single, stable user-facing interface (units.convert) and delegates product-specific conversion logic to registered unit conversion drivers (e.g. Sentinel-2, Landsat).

User config example#

processors=[

{“name”: “units.convert”, “params”: {“to”: “radiance”, “var_names”: [“B02”, “B03”]}}

]

class eoio.processors.units.processor.UnitsConvert(params: Dict[str, Any] | None = None, context: Dict[str, Any] | None = None)[source]#

Bases: BaseProcessor

Convert measurement variables in a dataset to a requested unit.

This processor: - provides a stable interface across products (Sentinel-2, Landsat, etc.) - selects an appropriate unit conversion driver using driver.matches(ds, context) - delegates conversion details to the selected driver

Processor parameters#

The following parameters can be provided in the params dict:

param to:

Target unit name (e.g. "radiance" or "reflectance"). Must be supported by the selected driver.

param var_names:

Optional list of variable names to convert. If omitted, the driver converts all measurements variables

param on_missing:

Behaviour if required metadata for conversion is missing. Supported values are "error" (default, if omitted) or "skip".

param driver:

Optional explicit driver name to use (e.g. "sentinel2"). If provided, automatic driver matching is bypassed.

Notes

  • This processor is intended to run after reading.

  • Product-specific metadata requirements are owned by the driver.

  • If multiple drivers match, this processor raises a clear error unless the user pins a driver explicitly via the driver param.

name = 'units.convert'#
run(ds: Dataset) Dataset[source]#

Run unit conversion on the dataset.

Parameters:

ds – Input dataset.

Returns:

Output dataset with converted variables (if applicable).

Raises:

ValueError – If no driver matches, multiple drivers match, or conversion is unsupported.

class eoio.processors.units.processor.UnitsConvertConfig(to: str, var_names: Sequence[str] | None = None, on_missing: str = 'error', driver: str | None = None)[source]#

Bases: object

Parameters for the units.convert processor.

driver: str | None = None#
on_missing: str = 'error'#
to: str#
var_names: Sequence[str] | None = None#