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
|NDVI difference||HTLM color code||Color|
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.
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.