satorbis_kit.raster.generate_ndvi module

Generate NDVI using OpenEO and create patches from the result.

satorbis_kit.raster.generate_ndvi.generate_ndvi(collection_name: str, spatial_extent: dict, temporal_extent: list, job_title: str | None = None, wait_for_completion: bool = False) openeo.rest.job.BatchJob[source]

Generate NDVI from OpenEO collection using the backend.

This function loads a satellite data collection, calculates NDVI using the NIR (B08) and Red (B04) bands, and processes the data through the OpenEO backend.

Parameters:
  • collection_name (str) – OpenEO collection name to load. Example: “TCX8021”

  • spatial_extent (dict) – Spatial bounding box with keys: west, south, east, north. Example: {“west”: 77.0, “south”: 28.5, “east”: 77.5, “north”: 29.0}

  • temporal_extent (list) – Start and end dates for temporal filtering. Example: [“2021-02-01”, “2021-02-03”]

  • job_title (str, optional) – Custom job title. If None, defaults to “NDVI Patch Generation Job”.

  • wait_for_completion (bool, optional) – If True, blocks until job completes. If False, returns immediately after starting. Defaults to False.

Returns:

OpenEO batch job object that can be monitored

and managed. Use job.status() to check status.

Return type:

openeo.rest.job.BatchJob

Raises:
  • ConnectionError – If unable to connect to OpenEO backend.

  • ValueError – If spatial/temporal extent is invalid or collection doesn’t exist.

Examples

Basic NDVI generation:

>>> from satorbis_kit.raster import generate_ndvi
>>> job = generate_ndvi(
...     collection_name="TCX8021",
...     spatial_extent={"west": 77.0, "south": 28.5, "east": 77.5, "north": 29.0},
...     temporal_extent=["2021-02-01", "2021-02-03"]
... )
>>> print(job.status())

Wait for completion:

>>> job = generate_ndvi(
...     collection_name="TCX8021",
...     spatial_extent={"west": 77.0, "south": 28.5, "east": 77.5, "north": 29.0},
...     temporal_extent=["2021-02-01", "2021-02-03"],
...     wait_for_completion=True
... )
>>> print(f"Generation complete: {job.status()}")

Custom job title:

>>> job = generate_ndvi(
...     collection_name="TCX8021",
...     spatial_extent={"west": 77.0, "south": 28.5, "east": 77.5, "north": 29.0},
...     temporal_extent=["2021-02-01", "2021-02-03"],
...     job_title="My NDVI Analysis",
...     wait_for_completion=True
... )

Note

  • Requires AWS credentials configured for S3 access

  • OpenEO backend accessible via Constants.DEV_URL

  • Collection must have NIR (B08) and Red (B04) bands for NDVI calculation

  • Results can be downloaded using job.download_result() after completion