opendatacube / eo-datasets

Easily write, validate and convert EO datasets and metadata.
Apache License 2.0
49 stars 26 forks source link

Contiguity fix #315

Closed geoscience-aman closed 9 months ago

geoscience-aman commented 9 months ago

Background

Sentinel-2 Level 1C data has a quality issue - “4.5 Striping due to lost source packets (no. 10)”, which is highlighted in ESA's Data Quality Report:

https://sentinels.copernicus.eu/documents/247904/685211/Sentinel-2_L1C_Data_Quality_Report.pdf/6ad66f15-48ca-4e65-b304-59ef00b7f0e0?version=5.0&t=1625665123197

For example, the black squares in the scene below are missing packets. They appear as low values, generally below a 10,000 X scaled surface reflectance of ~50. Importantly, these low values fall through the contiguity logic, which asks if the data > 0 across all bands for a given pixel, but are not usable for any practical purpose, as far as I'm aware.

drawing

This PR

This PR adds the functionality to check whether a scene has missing packets and if so, to mark the affected pixels as nodata (-999) using ESA's missing packet mask. Based on this fix, the contiguity layer should automatically be updated to mark the missing packet pixels as non-contiguous.

Additionally, the contiguity layer creation has been updated to include all Sentinel-2 bands, as originally intended.

Testing For the following scenes, wagl.package() with default parameters has successfully run to completion. The band images and contiguity layer has been visually inspected to ensure the contiguity logic is being followed as expected.

geoscience-aman commented 9 months ago

Thanks for the feedback @jeremyh and @uchchwhash!