Vegetation indices

remote_sensing_processor.calculate_index(name, folder=None, b1=None, b2=None)[source]

Calculates vegetation indexes.

Parameters:
  • name (string) – Name of index.

  • folder (path to input product as a string (optional)) – If you define path to a supported imagery product and a name of supported index, you do not need to define b1 and b2. Bands needed for index calculation are picked automatically.

  • b1 (path as string (optional)) – Path to band to calculate normalized difference index. If you define bands, you do not need to define folder, but still need to define name - it will be an output file name.

  • b2 (path as string (optional)) – Path to band to calculate normalized difference index. If you define bands, you do not need to define folder, but still need to define name - it will be an output file name.

Returns:

Path where index raster is saved.

Return type:

string

Examples

>>> ndvi = rsp.calculate_index(
...     'NDVI',
...     '/home/rsp_test/mosaics/sentinel/'
... )
>>> print(ndvi)
'/home/rsp_test/mosaics/sentinel/NDVI.tif'
>>> ndvi = rsp.calculate_index(
...     'NDVI',
...     b1='/home/rsp_test/mosaics/sentinel/B8.tif',
...     b2='/home/rsp_test/mosaics/sentinel/B4.tif',
... )
>>> print(ndvi)
'/home/rsp_test/mosaics/sentinel/NDVI.tif'

Table of supported indices and products:

Index

Sentinel-2

Landsat 1-5

Landsat 5-6

Landsat 7

Landsat 8-9

NDVI

+

+

+

+

+