From 63161bf84075a04d048d1e57d97cad529cd1421a Mon Sep 17 00:00:00 2001 From: guillemc23 Date: Wed, 27 Nov 2024 14:21:46 +0100 Subject: [PATCH 1/2] fix: Relative paths for GPT graphs --- CHANGES.md | 5 +++-- eoreader/products/sar/sar_product.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1898b541..8b402d1f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,10 +3,11 @@ ## 0.21.8 (2024-mm-dd) - FIX: Fix stack save_as_int to use updated int values - ENH: Add a new type (`BandsType`) for list of BandType -- FIX: Fixed PAZ Product Regex to properly indentify PAZ ST products as `PAZProduct` @guillemc23 +- FIX: Fixed PAZ Product Regex to properly indentify PAZ ST products as `PAZProduct` - by @guillemc23 +- FIX: Fixed preprocessing graph paths in order to support relative paths in more complex environments or contexts - by @guillemc23 - FIX: Remove useless `_norm_diff` function `indices.py` - DOC: Update `conf.py` (remove useless hunks and set Sphinx 7 as base) -- DOC: Added the [PAZ product guide](https://earth.esa.int/eogateway/documents/20142/37627/PAZ-Image-Products-Guide.pdf) to the PAZ Product documentation instead of the TerraSAR-X one @guillemc23 +- DOC: Added the [PAZ product guide](https://earth.esa.int/eogateway/documents/20142/37627/PAZ-Image-Products-Guide.pdf) to the PAZ Product documentation instead of the TerraSAR-X one - by @guillemc23 ## 0.21.7 (2024-11-08) diff --git a/eoreader/products/sar/sar_product.py b/eoreader/products/sar/sar_product.py index 9d7d8094..ee7b80b9 100644 --- a/eoreader/products/sar/sar_product.py +++ b/eoreader/products/sar/sar_product.py @@ -746,7 +746,7 @@ def _pre_process_sar(self, band: sab, pixel_size: float = None, **kwargs) -> str f"{spt}_{sat}_preprocess_default.xml" ) else: - pp_graph = AnyPath(os.environ[PP_GRAPH]) + pp_graph = AnyPath(os.environ[PP_GRAPH]).absolute() if not pp_graph.is_file() or not pp_graph.suffix == ".xml": FileNotFoundError(f"{pp_graph} cannot be found.") @@ -847,7 +847,7 @@ def _despeckle_sar(self, band: sab, **kwargs) -> str: if DSPK_GRAPH not in os.environ: dspk_graph = utils.get_data_dir().joinpath("sar_despeckle_default.xml") else: - dspk_graph = AnyPath(os.environ[DSPK_GRAPH]) + dspk_graph = AnyPath(os.environ[DSPK_GRAPH]).absolute() if not dspk_graph.is_file() or not dspk_graph.suffix == ".xml": FileNotFoundError(f"{dspk_graph} cannot be found.") From e97f5ee21e60a29540ec1cf68c61dd3a510ad7c0 Mon Sep 17 00:00:00 2001 From: guillemc23 Date: Wed, 27 Nov 2024 16:42:44 +0100 Subject: [PATCH 2/2] FIX: Swapped `absolute()` for `resolve()` --- eoreader/products/sar/sar_product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eoreader/products/sar/sar_product.py b/eoreader/products/sar/sar_product.py index ee7b80b9..48511994 100644 --- a/eoreader/products/sar/sar_product.py +++ b/eoreader/products/sar/sar_product.py @@ -746,7 +746,7 @@ def _pre_process_sar(self, band: sab, pixel_size: float = None, **kwargs) -> str f"{spt}_{sat}_preprocess_default.xml" ) else: - pp_graph = AnyPath(os.environ[PP_GRAPH]).absolute() + pp_graph = AnyPath(os.environ[PP_GRAPH]).resolve() if not pp_graph.is_file() or not pp_graph.suffix == ".xml": FileNotFoundError(f"{pp_graph} cannot be found.") @@ -847,7 +847,7 @@ def _despeckle_sar(self, band: sab, **kwargs) -> str: if DSPK_GRAPH not in os.environ: dspk_graph = utils.get_data_dir().joinpath("sar_despeckle_default.xml") else: - dspk_graph = AnyPath(os.environ[DSPK_GRAPH]).absolute() + dspk_graph = AnyPath(os.environ[DSPK_GRAPH]).resolve() if not dspk_graph.is_file() or not dspk_graph.suffix == ".xml": FileNotFoundError(f"{dspk_graph} cannot be found.")