Strange result from API

Hello!

I am using SentinelHUB python API to get the data for AOI. The result is strange as follow:

I wonder if I am doing something wrong or what?! I should also mention that for other areas the result is OK.

Interestingly, others have done for the same area with the same interval and the result is fine.
evalscript_true_color = “”"
//VERSION=3
function setup() {
return {
input: [{
bands: [“B02”,“B03”,“B04”,“dataMask”]
}],
output: {
bands: 3
}
};
}

let minVal = 0.0;
let maxVal = 0.4;

let viz = new HighlightCompressVisualizer(minVal, maxVal);

function evaluatePixel(samples) {
    let val = [samples.B04, samples.B03, samples.B02];
    val = viz.processList(val);
    val.push(samples.dataMask);
    return val;
}
"""
request_true_color = SentinelHubRequest(
    data_folder='./outputs',
    evalscript=evalscript_true_color,
    input_data=[
        SentinelHubRequest.input_data(
            data_source=DataSource.SENTINEL2_L2A,
            time_interval=('2020-04-01', '2020-06-30'),
            mosaicking_order='leastCC'
        )
    ],
    responses=[
        SentinelHubRequest.output_response('default', MimeType.TIFF)
    ],
    bbox=betsiboka_bbox,
    size=betsiboka_size,
    config=config
)

Thanks in advance for your help.

Kind regards,
Behzad

Hi Bezhad,

There is nothing wrong with your script. What you are seeing in the left part of your image is snow on the ground mixed with a few clouds. It looks a bit strange because you are using the HighlightCompressVisualizer, a linear function that compresses highlights.

At the location you are querying, there is an overlap in the tiles, and you have selected the leastCC option, which selects the least cloudy image of the overlapping tiles. Snow is not considered as clouds, and since your time range covers April (where there is snow on the ground), you get the result you posted. If you were to select the mostRecent mosaicking option in association with a lower cloud cover threshold (say 10%), you would get an image without snow:

There are many options you can specify when fetching data, it all depends on what you actually want.

PS: you are working in a very cloudy area, so results will not be perfect.

Hello Maxim (@maxim.lamare)!

Thank you for the response - My aim is get less cloudy image, so I made some changes:

time_interval=('2020-06-01', '2020-06-30'),
mosaicking_order='leastCC',
maxcc=0.1

The result is the same as yours, but when I change it to

time_interval=('2020-06-01', '2020-06-30'),
mosaicking_order='leastRecent',
maxcc=0.1

I reach the better result

Based on the documents here, I found out that leastRecent similar to mostRecent but in reverse order. So it should give more cloudy. AM I right?

I am sorry for bothering you. I believe that there should be some definitions which are not clear for me.

Kind regards,
Behzad

Hi @bvs,

The parameter settings mostRecent and leastRecent are time-related and are not taking cloud cover metadata into account. So if you use mostRecent, the request will return the latest imagery in your time interval that meets the other criteria you specified, e.g. maximum cloud cover. On the other hand, leastRecent will return the “oldest” image data depending on the given time interval.

In order to filter for the least cloudy image tiles, you would have to use leastCC which filters the tiles based on metadata of the respective acquisition. Please note that this information is provided for the whole tile of 12,000 sqkm and does not mean that this is necessarily the best option for your area of interest.

I hope this makes it a bit clearer.

Best regards, Max

Hello Max (@maxim.lamare )!

Based on what you said, I found out that as we have smaller tiles we can get better result. In this case, eo-learn is a better choice to make least cloudy mosaic image since we can determine the size of the tiles.

Thank you for your help.
Behzad :slight_smile: