Hi Karthik,
As you were using Statistical API, there were two things you were required to change so that it works correctly with Statistical API.
Firstly, in the setup function you are required to use the dataMask as an input and an output. In addition, the outputs of your evalscript need to be explicitly defined separately. Secondly, you also need to define these two outputs in the evaluatePixel function. This is explained in the documentation too.
Below are the adapted setup()
function and the evaluatePixel()
functions that you can insert into the evalscript. Remember this isn’t the whole evalscript for LAI!
function setup() {
return {
input: [{
bands: [
"B03",
"B04",
"B05",
"B06",
"B07",
"B8A",
"B11",
"B12",
"viewZenithMean",
"viewAzimuthMean",
"sunZenithAngles",
"sunAzimuthAngles",
"dataMask"
]
}],
output: [
{
id: "default",
sampleType: "AUTO",
bands: 1
},
{
id: "dataMask",
bands: 1
}
]
}
}
function evaluatePixel(sample, scene, metadata, customData, outputMetadata) {
const result = evaluatePixelOrig([sample], [scene], metadata, customData, outputMetadata);
lai_result = result[Object.keys(result)[0]];
return {
default: [lai_result],
dataMask: [sample.dataMask]
}
}
If this isn’t clear, then don’t hesitate to ask for additional clarification.