From ba8741646bcb2ca053a7b98a4491615ce3a0801c Mon Sep 17 00:00:00 2001 From: BRAUN REMI Date: Fri, 8 Nov 2024 10:27:58 +0100 Subject: [PATCH] FIX: Remove multi-swath workaround for Cosmo products if SNAP > 11.0 --- CHANGES.md | 1 + eoreader/products/sar/cosmo_product.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fd6e55a3..018e0263 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ - FIX: Handle ICEYE products with missing quicklook - FIX: Fix Sentinel-1 name with weird PDFs names (i.e. ending with `.SAFE-report...`) +- FIX: Remove multi-swath workaround for Cosmo products if SNAP > 11.0 - FIX: By default, try to assign a constellation (in a pure dummy way) to any `Product` created - FIX: Add ways of knowing if a constellation is a real one or not (i.e. CUSTOM or template such as Maxar) - FIX: Create TDX and PAZ (completely inherited) classes to disambiguate their constellations diff --git a/eoreader/products/sar/cosmo_product.py b/eoreader/products/sar/cosmo_product.py index 12a9a7fe..d5712255 100644 --- a/eoreader/products/sar/cosmo_product.py +++ b/eoreader/products/sar/cosmo_product.py @@ -34,7 +34,7 @@ from lxml import etree from lxml.builder import E from rasterio import merge -from sertit import AnyPath, path, rasters, rasters_rio, strings, vectors +from sertit import AnyPath, misc, path, rasters, rasters_rio, strings, vectors from sertit.misc import ListEnum from sertit.types import AnyPathStrType from shapely.geometry import Polygon, box @@ -484,12 +484,15 @@ def _pre_process_sar(self, band, pixel_size: float = None, **kwargs) -> str: Returns: str: Band path """ + if misc.compare_version(self.get_snap_version(), "11.0.0", ">="): + return super()._pre_process_sar(band, pixel_size=pixel_size, **kwargs) + with h5netcdf.File(self._img_path, phony_dims="access") as raw_h5: if self.nof_swaths == 1: return super()._pre_process_sar(band, pixel_size, **kwargs) else: LOGGER.warning( - "Currently, SNAP doesn't handle multiswath Cosmo-SkyMed products. This is a workaround. See https://github.com/sertit/eoreader/issues/78" + "SNAP (before version 11.0.0) doesn't handle multiswath Cosmo-SkyMed products. This is a workaround. See https://github.com/sertit/eoreader/issues/78" ) # For every swath, pre-process the swath array alone