For the evalscript
posted below, as shown in evaluatePixel(samples)
method, i would like to know:
1- what samples
is? and what is samples.length
?does sample.length
is the number of acquisition times?
For example, for the following time-series: TS1: 01.02.2024
and TS: 30.05.2024
, if we assumed that withing the aforementioned times-series there were 7 acquisition times, does that mean that sample.length
will return 7?!!
2-for the contents of samples
, does it values of NDVI
with cloude coverage
or without it please?
eval-script:
//VERSION=3
// Script to extract a time series of NDVI values using
// Sentinel 2 Level 2A data and metadata file.
function setup() {
return {
input: [{
bands: ["B04", "B08"],
units: "DN"
}],
output: [
{
id: "default",
bands: 1,
sampleType: "FLOAT32",
nodataValue: NaN,
},
],
mosaicking: Mosaicking.ORBIT
}
}
function updateOutput(output, collection) {
output.default.bands = collection.scenes.length
}
function evaluatePixel(samples) {
// Precompute an array to contain NDVI observations
var n_observations = samples.length;
let ndvi = new Array(n_observations).fill(NaN);
//Fill the array with NDVI values
samples.forEach((sample, index) => {
ndvi[index] = (sample.B08 - sample.B04) / (sample.B08 + sample.B04) ;
});
return ndvi;
}