});

custom-scripts

A repository of custom scripts that can be used with Sentinel-Hub services.

NDVI on L2A Vegetation and Natural Colours Script

Show script or download it.

Evaluate and visualize

General description of the script

This script works on Sentinel-2 L2A products, using the Vegetation class from the “Scene Classification map”, to display a colour-coded normalized difference vegetation index, abbreviated NDVI, on pixels classified as vegetation and natural colours of surface reflectance (red = B04, green = B03, blue = B02) otherwise (water, clouds, snow, not-vegetated land pixels).

The normalized difference vegetation index, abbreviated NDVI, is defined as

        NDVI = (B8A - B04) / (B8A + B04).

B8A band at 20 m resolution is used for NDVI computation as B8A spectral response is narrower than band B08 and less impacted by water vapour content.

It is an indicator of live green vegetation as described in [1].

Details of the script

Due to visualization issue with the Scene Classification Map this script performs better when displaying data close to the native pixel size with respect to screen size, therefore when the zoom level on bottom right of your EO Browser web window indicates a scale of 2 km or 3 km.

It works better in vegetated area without too many clouds however the L2A vegetation class is pretty reliable. The natural colours visualisation is obtained with a gain of 3.0 optimized for the visualisation of surface reflectance:

        naturalColour = [3*B04, 3*B03, 3*B02]

Author of the script

Jérôme LOUIS

Description of representative images

1) The two images of forest of Compiègne acquired 6 months apart (early summer vs early winter) show the difference of forest NDVI depending on the season.

The early summer image

Compiègne, France - early summer

The early winter image

Compiègne, France - early winter

2) The borders of the Virunga Park lying across the boundaries of three states (DRC, Ugunda, Rwanda) are clearly visible as the NDVI values differ between the Park and the surrounded areas more influenced by human land-use.

Virunga Park

NDVI color legend

NDVI color legend

References

[1] Wikipedia, Normalized Difference Vegetation Index. Accessed on January 21th 2020.

Credits

This script is inspired by Custom script repository: