Spectral Indices

Warning

This is a new experimental API, subject to change.

Easily calculate spectral indices (vegetation, water, urban etc.).

Supports the indices defined in the Awesome Spectral Indices project by David Montero Loaiza.

New in version 0.9.1.

openeo.extra.spectral_indices.append_and_rescale_indices(datacube, index_dict)[source]

Computes a list of indices from a datacube and appends them to the existing datacube

Parameters:
  • datacube (DataCube) – input data cube

  • index_dict (dict) –

    a dictionary that contains the input- and output range of the collection on which you calculate the indices as well as the indices that you want to calculate with their responding input- and output ranges It follows the following format:

    {
        "collection": {
            "input_range": [0,8000],
            "output_range": [0,250]
        },
        "indices": {
            "NDVI": {
                "input_range": [-1,1],
                "output_range": [0,250]
            },
        }
    }
    

    See list_indices() for supported indices.

Return type:

DataCube

Returns:

data cube with appended indices

Warning

this “rescaled” index helper uses an experimental API (e.g. index_dict argument) that is subject to change.

openeo.extra.spectral_indices.append_index(datacube, index)[source]

Compute a single spectral index and append it to the given data cube.

Parameters:
  • cube – input data cube

  • index (str) – name of the index to compute and append. See list_indices() for supported indices.

Return type:

DataCube

Returns:

data cube with appended index

openeo.extra.spectral_indices.append_indices(datacube, indices)[source]

Compute multiple spectral indices and append them to the given data cube.

Parameters:
  • datacube (DataCube) – input data cube

  • indices (List[str]) – list of names of the indices to compute and append. See list_indices() for supported indices.

Return type:

DataCube

Returns:

data cube with appended indices

openeo.extra.spectral_indices.compute_and_rescale_indices(datacube, index_dict, append=False)[source]

Computes a list of indices from a data cube

Parameters:
  • datacube (DataCube) – input data cube

  • index_dict (dict) –

    a dictionary that contains the input- and output range of the collection on which you calculate the indices as well as the indices that you want to calculate with their responding input- and output ranges It follows the following format:

    {
        "collection": {
            "input_range": [0,8000],
            "output_range": [0,250]
        },
        "indices": {
            "NDVI": {
                "input_range": [-1,1],
                "output_range": [0,250]
            },
        }
    }
    

    If you don’t want to rescale your data, you can fill the input-, index- and output-range with None.

    See list_indices() for supported indices.

Return type:

DataCube

Returns:

the datacube with the indices attached as bands

Warning

this “rescaled” index helper uses an experimental API (e.g. index_dict argument) that is subject to change.

openeo.extra.spectral_indices.compute_index(datacube, index)[source]

Compute a single spectral index from a data cube.

Parameters:
  • datacube (DataCube) – input data cube

  • index (str) – name of the index to compute. See list_indices() for supported indices.

Return type:

DataCube

Returns:

data cube containing the index as band

openeo.extra.spectral_indices.compute_indices(datacube, indices, append=False)[source]

Compute multiple spectral indices from the given data cube.

Parameters:
  • datacube (DataCube) – input data cube

  • indices (List[str]) – list of names of the indices to compute and append. See list_indices() for supported indices.

Return type:

DataCube

Returns:

data cube containing the indices as bands

openeo.extra.spectral_indices.list_indices()[source]

List names of supported spectral indices

Return type:

List[str]