Skip to content

Commit 119621e

Browse files
committed
FIX: Fix multi-polarisation SAR data with swaths orthorectified independently (i.e. SAOCOM)
1 parent 757ce18 commit 119621e

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- FIX: Use only the number of range looks to derive the resolution and pixel_size of CSG data [#256](https://github.com/sertit/eoreader/issues/256)
2727
- FIX: Return an empty `lxml.Element` as metadata for S1 RTC ASF products instead of `None` to ensure consistency
2828
- FIX: Set `EPSG:4326` for rasters with empty CRS to be orthorectified with RPCs
29+
- FIX: Fix multi-polarisation SAR data with swaths orthorectified independently (i.e. SAOCOM)
2930
- OPTIM: Use raw band path over default band path to speed up the computation of image information (extent, footprint, CRS, transform) of SAR ortho products
3031
- OPTIM: Allow predictor = 3 with LZW compression when saving SAR intermediate data as SNAP handles it properly now. [#173](https://github.com/sertit/eoreader/issues/173)
3132
- CI: Filter some warnings in pytest

ci/weekly/test_all_sat_end_to_end_on_disk.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import xarray as xr
1010
from lxml import etree
1111
from sertit import AnyPath, path, types
12+
from sertit.types import AnyPathStrType
1213

1314
from ci.scripts_utils import (
1415
CI_EOREADER_S3,
@@ -123,10 +124,10 @@ def _test_core_optical(
123124
_test_core(
124125
pattern,
125126
[opt_path(), get_ci_db_dir().joinpath("more_optical")],
126-
possible_bands,
127-
tmpdir,
128-
dem_path,
129-
debug,
127+
possible_bands=possible_bands,
128+
tmpdir=tmpdir,
129+
dem_path=dem_path,
130+
debug=debug,
130131
**kwargs,
131132
)
132133

@@ -144,16 +145,17 @@ def _test_core_sar(
144145
_test_core(
145146
pattern,
146147
get_ci_db_dir().joinpath("all_sar"),
147-
possible_bands,
148-
dem_path,
149-
debug,
148+
possible_bands=possible_bands,
149+
tmpdir=tmpdir,
150+
dem_path=dem_path,
151+
debug=debug,
150152
**kwargs,
151153
)
152154

153155

154156
def _test_core(
155157
pattern: str,
156-
prod_dirs: str | list,
158+
prod_dirs: AnyPathStrType | list,
157159
possible_bands: list,
158160
tmpdir: Path,
159161
dem_path=None,

eoreader/products/sar/sar_product.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,13 +1192,16 @@ def interp_na(array, dim):
11921192
# Get the .img path(s)
11931193
try:
11941194
imgs = utils.get_dim_img_path(dim_path, f"*{pol}*")
1195+
LOGGER.debug(f"Found {imgs} sub-images (for {pol}).")
11951196
except FileNotFoundError:
1197+
LOGGER.debug(f"No {pol} image found in {dim_path}")
11961198
imgs = utils.get_dim_img_path(dim_path) # Maybe not a good name
1199+
LOGGER.debug(f"Using {imgs} instead")
11971200

11981201
# Manage cases where multiple swaths are ortho independently
11991202
if len(imgs) > 1:
12001203
mos_path, exists = self._get_out_path(
1201-
path.get_filename(dim_path) + "_mos.vrt"
1204+
path.get_filename(dim_path) + f"_mos_{pol}.vrt"
12021205
)
12031206
if not exists:
12041207
# Get .img file path (readable by rasterio)
@@ -1226,8 +1229,6 @@ def interp_na(array, dim):
12261229
arr = rasters.crop(arr, crop_window)
12271230

12281231
# WARNING: Set nodata to 0 here as it is the value wanted by SNAP!
1229-
# SNAP < 10.0.0 fails with classic predictor !!! Set the predictor to the default value (1) !!!
1230-
# Caused by: javax.imageio.IIOException: Illegal value for Predictor in TIFF file
12311232
arr = utils.write_path_in_attrs(arr, out_path)
12321233
utils.write(
12331234
arr,

0 commit comments

Comments
 (0)