Skip to main content

Hi


When requesting statistics for sentinel 2 bands with aggregation_interval="P1D", but the Evalscript has the default mosaic method SIMPLE , I get statistics response with intervals less than 5 days.

When using mosaic methods ORBIT or TILE I get only NaNs back.


I want to understand why I get intervals of less than 5 days and how to limit the results to one orbit (I guess?).


Thanks


Here is a code example:


evalscript = """
//VERSION=3

function setup() {
return {
input: [{
bands: ["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08", "B8A", "B09", "B11", "B12", "CLM", "dataMask"],
units: "DN"
}],
output: [
{
id: "bands",
bands: 12
},

{
id: "dataMask",
bands: 1
}
],
mosaicking: Mosaicking.SIMPLE
}
}

function evaluatePixel(sample) {
// masking cloudy pixels
let combinedMask = sample.dataMask
if (sample.CLM > 0) {
combinedMask = 0;
}
return {
bands: [sample.B01,sample.B02,sample.B03,sample.B04,sample.B05,sample.B06, sample.B07,sample.B08,sample.B8A, sample.B09, sample.B1972,sample.B12],
dataMask: [combinedMask]
};
}
"""

aggregation = SentinelHubStatistical.aggregation(
evalscript=evalscript,
time_interval= ('2022-02-12', '2022-05-03'),
aggregation_interval='P1D',
resolution=(10, 10)
)

input_data = SentinelHubStatistical.input_data(
DataCollection.SENTINEL2_L2A
)

request = SentinelHubStatistical(
aggregation=aggregation,
input_data=[input_data],
geometry= Geometry(geometry,crs=CRS(geometry.crs)),
config=config
)

Hi,

When you’re using mosaicking SIMPLE with aggregation_interval = "P1D", the statistical API requests statistics for multiple 1-day interval with only one request. When there are no acquisitions during these 1-day interval, you won’t get the result. For more details please take a look at this example which shows the output of the aggregation_interval of P10D.

When you specify ORBIT or TILE, you’ll get all acquisitions within the aggregation_interval, so you need to tell the system how you’d like to choose the sample for mosaicking, Please look at this example showing how to use mosaicking ORBIT or TILE.

In general, please read this paragraph which explains API’s feature and how it works.

Best Regards


Reply