Standardising colour ramp for NDVI

Kia ora - hello from Aotearoa New Zealand
I was very fortunate to meet Grega Milcinski when he spoke at the “What on Earth” colloquium held at Te Papa, Wellington recently. Before he showed the use of the Sentinel-Playground, I had been downloading whole scenes from the US Geological Survey’s EarthExplorer, then processing layers through a geospatial raster calculator (in Quantum GIS) to then return a Normalised Difference Vegetation Index (NDVI) product. The Sentinel Playground is a real step up in democratising earth observation data; full credit to the Sinergise team.

I asked Grega if the colours of the NDVI product could be standardised - “have I got my colours correct?” [I also ask as some gentlemen are colour-blind, so I need to ensure that the graphic is telling the true story about the data]. Grega’s informative reply included this piece of code, which it’s straightforward to use (Thank you Grega!)

"Code:


let ndvi = (B08 - B04) / (B08 + B04);
if (ndvi<-0.2) return [0,0,0];
else if (ndvi<-0.1) return [1,0,0];
else if (ndvi<0) return [0.5,0.6,0,0];
else if (ndvi<0.1) return [0.4,0,0];
else if (ndvi<0.2) return [1,1,0.2];
else if (ndvi<0.3) return [0.8,0.8,0.2]; else if (ndvi<0.4) return [0.4,0.4,0]; else if (ndvi<0.5) return [0.2,1,1]; else if (ndvi<0.6) return [0.2,0.8,0.8]; else if (ndvi<0.7) return [0,0.4,0.4]; else if (ndvi<0.8) return [0.2,1,0.2]; else if (ndvi<0.9) return [0.2,0.8,0.2]; else return [0,0.4,0];


You can find some other visualisation options for NDVI here:
https://github.com/sentinel-hub/custom-scripts/blob/master/sentinel-2/ndvi/script.js"

Ngā mihi
Gordon

Thanks for sharing this.
Were the colors then OK? Or would you prefer some other scale?

Yes! They were great! We’ve still a need to calibrate plant health of specific orchards and ground cover types, but this does “good enough” to show what is going on; and where intervention is required. Thank you Grega!!
Kind regards, Gordon