I would like to compute vegetation indices like GCVI or EVI and wanted to see how I can adapt the script below (taken from Sentinel Hub Batch Statistical — Sentinel Hub 3.9.1 documentation):
ndvi_evalscript = """
//VERSION=3
function setup() {
return {
input: [
{
bands: [
"B04",
"B08",
"dataMask"
]
}
],
output: [
{
id: "ndvi",
bands: 1
},
{
id: "dataMask",
bands: 1
}
]
}
}
function evaluatePixel(samples) {
return {
ndvi: [index(samples.B08, samples.B04)],
dataMask: [samples.dataMask]
};
}
"""
What I am unclear about here is the ndvi: [index(samples.B08, samples.B04)],
line, how is NDVI being calculated there? I thought there would be an explicit formula.
The formula for GCVI is:
(band[‘b08’] / band[‘b03’]) - 1.
thanks!