Skip to main content

Hello!


I have shape and I want to get the two last available NDVI images for them and run calculation on these two images, to get in the end 1 image.

For that I have used the “orbit” mosaic,

as following:


VERSION=3
function setup() {
return {
input: u"B04", "B08", "CLM"],
output: {
bands: 1,
mosaicking: "ORBIT"
sampleType: "FLOAT32"
}
};
}

function evaluatePixel(sample) {
if (sample.CLM == 1) {
return unull]
}
let date1=index(samplem0].B08, samplem0].B04);
let date2=index(samplem1].B08, samplem1].B04);
let difference=index(date1,date2)
return udifference];
}
'''

My questions are:


  1. I use date range (‘2022-05-31’,‘2022-06-16’). How do I know which dates are taken? I know that there are three images between these two dates.

  2. which date is earlier? the samples 0] or samples]1]?

thanks 🙂

The order of samples depends on the mosaickingOrder parameter in your request. If you use mostRecent, samples[0] will represent latest observation, samples[1] the before-latest, and so on.


To get the actual date, you can make use of the scenes meta-data parameters. Note, however, that this functionality is somehow experimental.


Reply