Transformations

Spectral indices provide transformations to create data processing pipelines on remote sensing images.

class spectral_indices.transformations.Aggregation(dim: str = 'time', skipna: bool = False)[source]

Base class for aggregations along a dimension (sum, mean etc..).

Parameters:
  • dim (str) – Dimensions to perform aggregation on. Default to ‘time’.

  • skipna (bool) – To perform aggregation with nan or not. Default to False.

class spectral_indices.transformations.ApplyMasking(maskings: ~typing.List[~spectral_indices.transformations.mask.Masking | ~typing.Dict[str, ~typing.Any]] = <factory>)[source]

Wraps multiple masking operations.

planify(array: DataArray) DataArray[source]

Apply masking to data.

Parameters:

array (DataArray) – Array to mask that contain band masks.

Returns:

  • Lazy masked array without band masks.

Return type:

DataArray

class spectral_indices.transformations.Masking(logical_string: str = <factory>, mask: ~spectral_indices.sources.masks.Mask = <factory>)[source]

Wrap masking metadata.

Parameters:
  • logical_string (str) – A string that represent the logical to apply within a xarray.where() method. Use ‘mask’ to represent the mask array. i.e: “mask > 5”.

  • mask – (Mask): Corresponding Mask class.

class spectral_indices.transformations.Max(dim: str = 'time', skipna: bool = False)[source]
planify(array: DataArray)[source]

Lazy transformation on xarray. This function plan some modifications that are added to dask graph.

class spectral_indices.transformations.Mean(dim: str = 'time', skipna: bool = False)[source]
planify(array: DataArray)[source]

Lazy transformation on xarray. This function plan some modifications that are added to dask graph.

class spectral_indices.transformations.Min(dim: str = 'time', skipna: bool = False)[source]
planify(array: DataArray)[source]

Lazy transformation on xarray. This function plan some modifications that are added to dask graph.

class spectral_indices.transformations.SaveRaster(out_path: str, nodata: float = -1000)[source]

Save xarray to a tiff file supporting dask chunk parralle save.

Parameters:
  • out_path (str) – Path to save raster.

  • nodata (float) – Value to fill nodata. Default to -1000

planify(array: DataArray, lock: Any) DataArray[source]

Planify the array saving on a pipeline.

class spectral_indices.transformations.Sum(dim: str = 'time', skipna: bool = False)[source]
planify(array: DataArray)[source]

Lazy transformation on xarray. This function plan some modifications that are added to dask graph.

class spectral_indices.transformations.TemporalInterpolation(method: str = 'linear', gap: timedelta | timedelta64 | Timedelta = None)[source]

Perform temporal interpolation on xarray.

Parameters:
planify(array: DataArray) DataArray[source]

Lazy transformation on xarray. This function plan some modifications that are added to dask graph.

class spectral_indices.transformations.Transformation[source]

Base class for transformations on xarrays.

classmethod from_dict(transformation_dict: Dict[str, Any]) Transformation[source]

Build transformation from attributes dict.

Parameters:

trasnformation_dict (Dict[str, Any]) – Dict of trasnformation attributes.

Returns:

  • Return an instance of transformation.

Return type:

Transformation

property name: str

Return class name.

planify(array: DataArray) DataArray[source]

Lazy transformation on xarray. This function plan some modifications that are added to dask graph.

to_dict() Dict[str, Any][source]

Return attributes as dict.