Skip to main content Link Menu Expand (external link) Document Search Copy Copied

NDVI difference between two dates

Download Script

Evaluate and visualize

Note: The default output in the script is the visualisation layer for the EO Browser generated via the ColorRampVisualizer which interpolates the range of NDVI difference from -2 to 2 with the color ramps defined below. The actual value of the NDVI difference can be obtained from the output index.

NDVI difference HTLM color code Color
-2 #d01c8b
-1 #f1b6da
0 #f7f7f7
1 #b8e186
2 #4dac26

General description

This script aims to obtain the diffence of NDVI between the latest acquisition and the acquisition 10-day prior to the latest on within a specified time period. Multi-temporal analysis is common in the Earth Observation field. Here we take NDVI as an example and demonstrate how to calculate the difference of NDVI between two acquisitions using mosaicking: ORBIT and preProcessScenes in one single request.

To implement multi-temporal analysis in the Evalscript, we apply ORBIT mosaicking to query daily mosaic in the specified time period. Then, by using the optional preProcessScenes function, we find out the acquisition acquired on the date closest to the date 10-day prior to the latest acquisition and filter the out the other unused acquisitions to save Processing Units. Last but not least, in the evaluatePixel function we initialise a combined mask to ensure the difference of NDVI between two acquisitions exists only if there is data on both dates.

Note: The example script is used to obtain the raw value of NDVI difference. For visualisation purpose, please follow the EO Browser link in the Evaluate and visualize section. The visualisation script contains 4 outputs: default, index, eobrowserStats and dataMask. The default layer is a visualisation layer to visualise NDVI difference in EO Browser. The index layer is the actual value of the NDVI difference. The eobrowserStats and the dataMask layer is configured to activate statistical features on EO Browser. Please see the FAQ for more details.

Author of the script

Chung-Xiang Hong

Description of representative images

The following image shows the NDVI difference between the latest acquisition and the acquisition 10-day prior to the latest one during the time period from 29th of June, 2023 to 29th July, 2023. NDVI difference example