diff --git a/CHANGES.md b/CHANGES.md index ddc8d1ae..bc73153f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ - **ENH: Allow to use bands IDs, names and common name added to mapped names when trying to load a spectral band. ([#111](https://github.com/sertit/eoreader/issues/111)** - **ENH: Manage Sentinel-2 as formatted on the cloud (Element84 or Sinergise's way). ([#104](https://github.com/sertit/eoreader/issues/104)** - **ENH: Handle Python 3.12. ([#113](https://github.com/sertit/eoreader/issues/113)** +- **ENH: Guard against S1 COG format, not yet handled by SNAP.** - FIX: Fix jpg, png... quicklooks management when plotting - FIX: Fix an `xarray` issue when trying to compute percentiles when stacking bands - CI: Update pre-commit hooks diff --git a/eoreader/products/sar/s1_product.py b/eoreader/products/sar/s1_product.py index dd26be99..79f14dde 100644 --- a/eoreader/products/sar/s1_product.py +++ b/eoreader/products/sar/s1_product.py @@ -200,6 +200,15 @@ def _pre_init(self, **kwargs) -> None: # Its original filename is its name self._use_filename = True + # Check if COG in name + if "_COG" in self.filename: + raise NotImplementedError( + "These S1 COG products are not yet handled by SNAP. " + "EOReader will handle them when this issue is fixed. " + "See https://forum.step.esa.int/t/handle-sentinel-1-cog-collection/40840. " + "Please use the classical format instead." + ) + # Zipped and SNAP can process its archive self.needs_extraction = False diff --git a/eoreader/reader.py b/eoreader/reader.py index 871ddaad..cb3783e2 100644 --- a/eoreader/reader.py +++ b/eoreader/reader.py @@ -207,7 +207,7 @@ class Constellation(ListEnum): CONSTELLATION_REGEX = { - Constellation.S1: r"S1[AB]_(IW|EW|SM|WV)_(RAW|SLC|GRD|OCN)[FHM_]_[0-2]S[SD][HV]_\d{8}T\d{6}_\d{8}T\d{6}_\d{6}_.{11}", + Constellation.S1: r"S1[AB]_(IW|EW|SM|WV)_(RAW|SLC|GRD|OCN)[FHM_]_[0-2]S[SD][HV]_\d{8}T\d{6}_\d{8}T\d{6}_\d{6}_.{11}(_COG|)", Constellation.S2: r"S2[AB]_MSIL(1C|2A)_\d{8}T\d{6}_N\d{4}_R\d{3}_T\d{2}\w{3}_\d{8}T\d{6}", # Element84 : S2A_31UDQ_20230714_0_L2A, Sinergise: 0 or 1... Constellation.S2_E84: r"S2[AB]_\d{2}\w{3}_\d{8}_\d_L(1C|2A)", @@ -272,7 +272,7 @@ class Constellation(ListEnum): Constellation.S1: { "nested": 1, # File that can be found at any level (product/**/file) - "regex": r".*s1[ab]-(iw|ew|sm|wv)\d*-(raw|slc|grd|ocn)-[hv]{2}-\d{8}t\d{6}-\d{8}t\d{6}-\d{6}-\w{6}-\d{3}\.xml", + "regex": r".*s1[ab]-(iw|ew|sm|wv)\d*-(raw|slc|grd|ocn)-[hv]{2}-\d{8}t\d{6}-\d{8}t\d{6}-\d{6}-\w{6}-\d{3}(-cog|)\.xml", }, Constellation.S2: {"nested": 3, "regex": r"MTD_TL.xml"}, Constellation.S2_E84: rf"{CONSTELLATION_REGEX[Constellation.S2_E84]}\.json",