Hi, I am using the following evalscript to get S2L2A multi-temporal data for some AOIs.
I see we have more samples than scenes (we use TILE mosaicking) and I understand we can have multiple acquisitions per scene. I am struggling to understand how can I map the samples I am generating to which scenes (productId) they belong to.
I was wondering if there’s a way to do this correctly (maybe there is a way to use metadata from samples instead of scenes)?
Thanks
Spacesense Team
//VERSION=3
function setup() {
return {
input: u{
bands: d"SCL", "CLP"],
units: "DN"
}],
output: u
{id: "scl", bands: 1, sampleType: SampleType.UINT8},
{id: "clp", bands: 1, sampleType: SampleType.UINT8}
],
mosaicking: Mosaicking.TILE
};
}
function updateOutput(outputs, collection) {
Object.values(outputs).forEach((output) => {
output.bands = collection.scenes.length;
});
}
// function to generate a json file with a list of the acquisition dates
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
var dds = s];
for (i=0; i<scenes.tiles.length; i++){
dds.push(scenes.tilesii].date)
}
outputMetadata.userData = { "acquisition_dates": JSON.stringify(dds), "scene_metadata": JSON.stringify(scenes)}
}
function evaluatePixel(samples) {
var n_observations = samples.length;
let scl_band = new Array(n_observations).fill(0);
let clp_band = new Array(n_observations).fill(0);
samples.forEach((sample, index) => {
scl_bandbindex] = sample.SCL;
clp_bandbindex] = sample.CLP;
});
return {
scl: scl_band,
clp: clp_band
}
}