Check is product on edge of swath

Hi,

For my application, I would like to download only S2 tiles that are fully covered by image data. I am looking for a way to avoid S2 products that are on the edge of the swath, and for which the tile is only partially covered by image data and contains nodata pixels.

I have taken a look on the API search query guideline, but I haven’t found any keyword specifying if the product is on the edge of the swatch.

I have also taken a brief look at some examples of metadata “MTD_MSIL1C.xml” files, but haven’t found such parameters there either.

Is such a parameter available, for the search query or in the metadata, that I would have missed?

Or is there another way to check if a product is on the edge of the swath, that I wouldn’t have thought of? Maybe a threshold on the product’s size?

By the way, I am using the sentinelsat library to download products.

Many thanks !

Thibaut

If you have access to the MTD_MSIL2A.xml rather than the L1C one
e.g. https://finder.creodias.eu/files/Sentinel-2/MSI/L2A/2021/08/11/S2A_MSIL2A_20210811T101031_N0301_R022_T32TNL_20210811T160521.SAFE/MTD_MSIL2A.xml
then there is a field

<Image_Content_QI>
  <NODATA_PIXEL_PERCENTAGE>0.0</NODATA_PIXEL_PERCENTAGE>
...
</Image_Content_QI>

Where I think the 0.0 can be read as: there are no NODATA pixels

2 Likes

Hello @tvoirand

Would it not be possible to search via filesize?

You could maybe make a check for Products close to the full Tile size.

https://sentinel.esa.int/web/sentinel/user-guides/sentinel-2-msi/product-types

Cheers

Jan

1 Like

Thank you @gbrelstaff and @Jan for your answers.

I followed gbrelstaff suggestion to use the NODATA_PIXEL_PERCENTAGE entry in the L2A product metadata. I am working on L1C products, but I added a function in my application to query corresponding L2A products metadata, and check for products with 0.0 value for this entry. It is working well, so far only products for which the tile is fully covered have passed the check.

Jan’s suggestion sounds easier to implement (need only to copy and paste the two lines from the Github issue that you linked), and it’s what I was also thinking of when writing my question. But I’ll have to investigate exactly which file size to use as threshold for my check. When/if I do I will let you know the results here.

I’m guessing that in theory this file size is only determined by the presence of nodata pixels in the product. But I am not 100% confident of that: what if some update of the data format or compression algorithm changes the filesize? Overall I think checking the metadata entry sounds more robust.

But again thank you both for your answers !

1 Like