eoio.processors.units.drivers.l89 module#

eoio.processors.units.drivers.l89 - unit conversion for Landsat 89 L1 products

class eoio.processors.units.drivers.l89.LANDSATC2L1UnitDriver[source]#

Bases: BaseUnitConversionDriver

Landsat 89 L1 unit conversion driver.

Intended scope: - reflectance -> radiance, using metadata available in the product - radiance -> brightness temperature, using metadata available in the product

This driver assumes eoio readers provide enough product identification to allow cheap matching (e.g. ds.attrs[‘eoio:product’] in {“BrightnessTemperatureL1”, “ReflectanceL1”}).

Notes

Landsat 89 L1 unit conversion depends on: - solar zenith angle (or sun elevation) at acquisition time / tile - reflectance/radiance scaling factors - brightness temperature constants, e.g. k1, k2

Where those values live should be standardised in dataset and variable attrs.

convert(ds: Dataset, to: dict, var_names: Sequence[str] | None, *, context: Mapping[str, Any]) Dataset[source]#

Convert selected variables in the dataset to the requested target units, based on supported conversion pairs. If no variables are selected, the default is all measurement vars.

Converts the data using conversion coefficients found in metadata (radiance_mult, radiance_add, etc.) and updates units attributes accordingly.

Parameters:
  • ds – Input dataset.

  • to – Target unit name (e.g. “radiance”).

  • var_names – Variables to convert. If None, default is all measurement vars.

  • context – Processing context provided by eoio, passed to all processors.

Returns:

Dataset with converted variables.

Raises:
  • ValueError – If an unsupported conversion is requested.

  • KeyError – If requested variables are not present.

matches(ds: Dataset, context: Mapping[str, Any]) bool[source]#

Determine whether this driver can handle the given dataset.

Matching should be cheap and unambiguous; avoid heavy inspection.

Parameters:
  • ds – Input dataset.

  • context – Processing context provided by eoio.

Returns:

True if this looks like a Landsat 89 L1 dataset, otherwise False.

name: str = 'landsatc2l1'#
supported() Set[Tuple[str, str]][source]#

Return supported conversion pairs.

Returns:

Set of supported (from_unit, to_unit) pairs.

class eoio.processors.units.drivers.l89.LANDSATC2L2UnitDriver[source]#

Bases: BaseUnitConversionDriver

Landsat 89 L2 unit conversion driver.

Intended scope: - radiance -> brightness temperature, using metadata available in the product

This driver assumes eoio readers provide enough product identification to allow cheap matching (e.g. ds.attrs[‘eoio:product’] in {“BrightnessTemperatureL2”, “ReflectanceL2”}).

Notes

Landsat 89 L2 unit conversion depends on: - brightness temperature constants, e.g. k1, k2

Where those values live should be standardised in dataset and variable attrs.

convert(ds: Dataset, to: dict, var_names: Sequence[str] | None, *, context: Mapping[str, Any]) Dataset[source]#

Convert selected variables in the dataset to the requested target units, based on supported conversion pairs. If no variables are selected, the default is all measurement vars.

Converts the data using conversion coefficients found in metadata (radiance_mult, radiance_add, etc.) and updates units attributes accordingly.

Parameters:
  • ds – Input dataset.

  • to – Target unit name (e.g. “radiance”).

  • var_names – Variables to convert. If None, default is all measurement vars.

  • context – Processing context provided by eoio, passed to all processors.

Returns:

Dataset with converted variables.

Raises:
  • ValueError – If an unsupported conversion is requested.

  • KeyError – If requested variables are not present.

matches(ds: Dataset, context: Mapping[str, Any]) bool[source]#

Determine whether this driver can handle the given dataset.

Matching should be cheap and unambiguous; avoid heavy inspection.

Parameters:
  • ds – Input dataset.

  • context – Processing context provided by eoio.

Returns:

True if this looks like a Landsat 89 L2 dataset, otherwise False.

name: str = 'landsatc2l2'#
supported() Set[Tuple[str, str]][source]#

Return supported conversion pairs.

Returns:

Set of supported (from_unit, to_unit) pairs.