Skip to content

Commit

Permalink
ENH: Guard against S1 COG format, not yet handled by SNAP.
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-braun committed Nov 14, 2023
1 parent a2cc0e1 commit cb88924
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions eoreader/products/sar/s1_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions eoreader/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit cb88924

Please sign in to comment.