eoio.processors.units.drivers.planetscope module#

eoio.processors.units.drivers.planetscope - unit conversion for PlanetScope products

class eoio.processors.units.drivers.planetscope.PlanetScopeUnitDriver[source]#

Bases: BaseUnitConversionDriver

PlanetScope unit conversion driver.

Intended scope: - radiance -> reflectance, using attributes available in the product - reflectance -> radiance, using attributes available in the product - reflectance -> DNs, using attributes available in the product - radiance -> DNs, using attributes available in the product

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

Notes

PlanetScope unit conversion depends on: - per-band reflectance coefficients

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

convert(ds: Dataset, to: str, 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 (reflectance coefficient, radiometric scale factor) 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 PlanetScope dataset, otherwise False.

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

Return supported conversion pairs.

Returns:

Set of supported (from_unit, to_unit) pairs.