Spectral Indices¶
Let’s see how to compute built-in spectral indices with eemont!
Before anything, let’s import our modules and authenticate in Google Earth Engine:
import ee, eemont
ee.Authenticate()
ee.Initialize()
Now, we are ready to go!
Overview¶
The eemont package extends the ee.Image and ee.ImageCollection classes with the method index()
:
Supported Platforms¶
This method automatically computes spectral indices for the following supported satellite platforms:
Sentinel Missions¶
Landsat Missions¶
Important
It is highly recommended to scale the image (or image collection) before computing spectral indices. See the scale()
method for more info.
List of Indices¶
Vegetation Indices¶
The following table shows the list of built-in vegetation indices:
Index |
Description |
Reference |
---|---|---|
BNDVI |
Blue Normalized Difference Vegetation Index |
|
CIG |
Chlorophyll Index - Green |
|
CVI |
Chlorophyll Vegetation Index |
|
EVI |
Enhanced Vegetation Index |
|
GBNDVI |
Green-Blue Normalized Difference Vegetation Index |
|
GNDVI |
Green Normalized Difference Vegetation Index |
|
GRNDVI |
Green-Red Normalized Difference Vegetation Index |
|
MNDVI |
Modified Normalized Difference Vegetation Index |
|
NDVI |
Normalized Difference Vegetation Index |
|
NGRDI |
Normalized Green Red Difference Index |
|
RVI |
Ratio Vegetation Index |
|
SAVI |
Soil-Adjusted Vegetation Index |
Burn Indices¶
The following table shows the list of built-in burn indices:
Index |
Description |
Reference |
---|---|---|
BAI |
Burned Area Index |
|
BAIS2 |
Burned Area Index for Sentinel 2 |
|
NBR |
Normalized Burn Ratio |
Water Indices¶
The following table shows the list of built-in water indices:
Index |
Description |
Reference |
---|---|---|
MNDWI |
Modified Normalized Difference Water Index |
|
NDWI |
Normalized Difference Water Index |
List of Bands¶
The following table shows the list of bands used for spectral indices computation:
Description |
Name |
Sentinel-2 |
Landsat 8 |
Landsat 4, 5, 7 |
---|---|---|---|---|
Aerosols |
A |
B1 |
B1 |
|
Blue |
B |
B2 |
B2 |
B1 |
Green |
G |
B3 |
B3 |
B2 |
Red |
R |
B4 |
B4 |
B3 |
Red Edge 1 |
RE1 |
B5 |
||
Red Edge 2 |
RE2 |
B6 |
||
Red Edge 3 |
RE3 |
B7 |
||
Red Edge 4 |
RE4 |
B8A |
||
NIR |
N |
B8 |
B5 |
B4 |
SWIR 1 |
S1 |
B11 |
B6 |
B5 |
SWIR 2 |
S2 |
B12 |
B7 |
B7 |
Thermal 1 |
T1 |
B10 |
B6 |
|
Thermal 2 |
T2 |
B11 |
Warning
If the satellite platform doesn’t have the required bands for computing an index, it won’t be computed.
Usage¶
The index()
method computes the specified spectral index and adds it as a new band.
Let’s take the Sentinel-2 SR image collection as example (remember to scale your image or image collection!):
S2 = ee.ImageCollection('COPERNICUS/S2_SR').scale()
By default, the index()
method computes the NDVI:
S2withIndices = S2.index()
S2withIndices.select('NDVI')
If required, any of the above-mentioned indices can be computed by modifying the index
parameter:
S2withIndices = S2.index(index = 'EVI')
S2withIndices.select('EVI')
Specific index-parameters can be changed, for example, the canopy background adjustment L is set to 1.0 for EVI, but for SAVI it can be changed to 0.5:
S2withIndices = S2.index('SAVI',L = 0.5)
S2withIndices.select('SAVI')
If more than one index is required, a list of indices can be used:
S2withIndices = S2.index(['CIG','NBR','NDWI'])
S2withIndices.select('CIG')
S2withIndices.select('NBR')
S2withIndices.select('NDWI')
Indices can also be computed for single images:
S2withIndices = S2.first().index(['GBNDVI','MNDVI','EVI'])
S2withIndices.select('GBNDVI')
S2withIndices.select('MNDVI')
S2withIndices.select('EVI')
All vegetation indices can be computed by setting index = vegetation
:
S2withIndices = S2.index('vegetation')
S2withIndices.select('NDVI')
S2withIndices.select('GNDVI')
S2withIndices.select('RVI')
# ...
All burn indices can be computed by setting index = burn
:
S2withIndices = S2.index('burn')
S2withIndices.select('BAI')
S2withIndices.select('BAIS2')
S2withIndices.select('NBR')
All water indices can be computed by setting index = water
:
S2withIndices = S2.index('water')
S2withIndices.select('NDWI')
S2withIndices.select('MNDWI')
All snow indices can be computed by setting index = snow
:
S2withIndices = S2.index('snow')
S2withIndices.select('NDSI')
If you want to compute all available indices, you can set index = all
:
S2withIndices = S2.index('all')
S2withIndices.select('NDVI')
S2withIndices.select('BAI')
S2withIndices.select('NDWI')
S2withIndices.select('NDSI')
# ...