eoio.processors.units.drivers.base module#
eoio.processors.units.drivers.base - base class for unit conversion drivers
- class eoio.processors.units.drivers.base.BaseUnitConversionDriver[source]#
Bases:
ABCAbstract base class for unit conversion drivers.
Subclasses implement dataset-specific conversion logic (e.g. Landsat, Sentinel-2) while exposing a common interface to the eoio processor layer.
A driver must: - declare whether it can handle a dataset via
matches()- declare which conversions it supports viasupported()- perform the conversion viaconvert()- abstractmethod convert(ds: Dataset, to: str, var_names: Sequence[str] | None, *, context: Mapping[str, Any]) Dataset[source]#
Convert variables in the dataset to the requested target units.
Implementations are responsible for: - determining the source units of each variable - reading any required metadata (from
dsorcontext) - applying the correct conversion formula - updating variableunitsattributes consistentlyThis method must not mutate the input dataset in-place unless explicitly documented; returning a modified copy is preferred.
- Parameters:
ds – Input dataset.
to – Target unit name (e.g.
"radiance").var_names – Names of variables to convert. If
None, the driver should determine a sensible default (e.g. measurement variables only).context – Processing context provided by eoio (reader metadata, resolved config, etc.).
- Returns:
Dataset with converted variables.
- abstractmethod matches(ds, context) bool[source]#
Determine whether this driver can handle the given dataset.
This method should be cheap and rely on unambiguous indicators, such as normalised eoio metadata (e.g.
ds.attrs["eoio:product"]) or values provided in the processing context.- Parameters:
ds – Input dataset.
context – Processing context provided by eoio (reader metadata, resolved config, etc.).
- Returns:
Trueif this driver can convert units for this dataset, otherwiseFalse.
- name: str = 'base'#