Ive been working on a Sentinel-2 median dataset at the country level using Open Data Cube. While my methodology works fine for the majority of areas, it performs poorly where there is an overlap of S-2 granules (between 2-5 depending on orbit).To bypass this problem, I've been using load_ard with a combination of "group_by", "min_gooddata" and "predicate" flags to filter granules so that the returned imagery completely contains the AOI is contained (thus only returning a single granule i.e. "01GEM").

My issue is that for the remaining AOIS, the overlap is still causing issues, particularly in bands with less range in DN. Top image is 32bit RGB (S2 bands 432) and bottom image is false colour (S2 bands 132).

RGB (Bands 4 3 2 False Colour (bands 1 3 2)

I suspect this effect is caused as granules can occur on different dates and filtered out depending on cloud cover. Ive also tried the same AOIs but excluded the min_gooddata flag so all images are used in the median. Unfortunately this had a similar result.

For those interested a cutdown version of the code is here

Any ideas on a potential solution? Or how I could reduce the effect of this problem? It must be fairly common.

  • Hi Kurt! This is a little tricky to diagnose without looking at the individual images that go into the composites - one thing that's relevant here is that load_ard currently includes nodata pixels in the "good data" calculation as well as cloudy pixels, so setting it to a high value can cause scenes that only partially overlap with your query bounds to drop out of your dataset. That said, you say you've tried it with min_gooddata=0, so it doesn't seem like that's the problem. Sep 14, 2022 at 2:11
  • A question for now: what cloud mask are you using for this? One challenge with S2 data can be that cloud masks are often generated at the granule level using inputs from the distribution of values within the specific granule, which can result in sometimes significant discontinuities along granule boundaries. It might be worth loading up some of the raw data for the two neighbouring granules above, and comparing the cloud masks to see if they are continuous across the granule boundary. Sep 14, 2022 at 2:16
  • Cheers Robbi for those suggestions. My next plan was to extract the raw data for that AOI and look at it. Will report back with my results!
    – Kurt
    Sep 15, 2022 at 22:32


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.