From 2c48002b17a05f874505d23bac3ce16d3299dbc7 Mon Sep 17 00:00:00 2001 From: Daniel Scheffler Date: Fri, 10 Mar 2023 17:45:46 +0100 Subject: [PATCH 1/5] Correctly pass through the creationOptions. Signed-off-by: Daniel Scheffler --- arosics/DeShifter.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arosics/DeShifter.py b/arosics/DeShifter.py index 0e8782e..d0d8a08 100644 --- a/arosics/DeShifter.py +++ b/arosics/DeShifter.py @@ -364,9 +364,6 @@ def correct_shifts(self) -> collections.OrderedDict: self.GeoArray_shifted = out_geoArr - if self.path_out: - out_geoArr.save(self.path_out, fmt=self.fmt_out) - else: # FIXME equal_prj==False ist noch NICHT implementiert """RESAMPLING NEEDED""" # FIXME avoid reading the whole band if clip_extent is passed @@ -411,8 +408,8 @@ def correct_shifts(self) -> collections.OrderedDict: self.is_shifted = True self.is_resampled = True - if self.path_out: - out_geoArr.save(self.path_out, fmt=self.fmt_out, creationOptions=self.out_creaOpt) + if self.path_out: + out_geoArr.save(self.path_out, fmt=self.fmt_out, creationOptions=self.out_creaOpt) # validation if not is_coord_grid_equal(self.updated_gt, *self.out_grid, tolerance=1.e8): From 07b828876059c3c66fbfaa2968cf6b156a6222a1 Mon Sep 17 00:00:00 2001 From: Daniel Scheffler Date: Fri, 10 Mar 2023 17:47:50 +0100 Subject: [PATCH 2/5] Add test for the out_crea_options parameter. Signed-off-by: Daniel Scheffler --- tests/test_COREG.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_COREG.py b/tests/test_COREG.py index 690a42f..5e4cc48 100644 --- a/tests/test_COREG.py +++ b/tests/test_COREG.py @@ -36,6 +36,7 @@ from .cases import test_cases from arosics import COREG from geoarray import GeoArray +from osgeo import gdal from py_tools_ds.geo.projection import EPSG2WKT From 3466fdcf68074599db7961f856e5424024bf538d Mon Sep 17 00:00:00 2001 From: Daniel Scheffler Date: Fri, 10 Mar 2023 17:49:17 +0100 Subject: [PATCH 3/5] Update HISTORY.rst. Signed-off-by: Daniel Scheffler --- HISTORY.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 2300738..dd5364b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,12 @@ History ======= +1.8.1 (2023-03-10) +------------------ + +* Fixed https://github.com/GFZ/arosics/issues/20 (out_crea_options has no effect). + + 1.8.0 (2022-12-02) ------------------ From 4651f9d03d720e72c8b2c7eae2c9583e1df83fd1 Mon Sep 17 00:00:00 2001 From: Daniel Scheffler Date: Fri, 10 Mar 2023 17:55:13 +0100 Subject: [PATCH 4/5] Add missing test. Signed-off-by: Daniel Scheffler --- tests/test_COREG.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_COREG.py b/tests/test_COREG.py index 5e4cc48..bcf5fc1 100644 --- a/tests/test_COREG.py +++ b/tests/test_COREG.py @@ -378,6 +378,21 @@ def test_correct_shifts_with_resampling(self): self.assertFalse(np.array_equal(CR.shift[:], CR.deshift_results['arr_shifted'])) self.assertTrue(np.array_equal(np.array(CR.shift.gt), np.array(CR.deshift_results['updated geotransform']))) + def test_correct_shifts_gdal_creation_options(self): + """Test if the out_crea_options parameter works.""" + kw = self.coreg_kwargs.copy() + kw['fmt_out'] = "GTiff" + kw['out_crea_options'] = ["COMPRESS=DEFLATE", "BIGTIFF=YES", "ZLEVEL=9", "BLOCKXSIZE=512", "BLOCKYSIZE=512"] + + # in case the output data is not resampled + self.run_shift_detection_correction(self.ref_path, self.tgt_path, **kw) + self.assertTrue('COMPRESSION=DEFLATE' in gdal.Info(kw['path_out'])) + + # in case the output data is resampled + kw['align_grids'] = True + self.run_shift_detection_correction(self.ref_path, self.tgt_path, **kw) + self.assertTrue('COMPRESSION=DEFLATE' in gdal.Info(kw['path_out'])) + if __name__ == '__main__': import pytest From 01f2341b6f4205c6d4437f7e2802f39684aa9554 Mon Sep 17 00:00:00 2001 From: Daniel Scheffler Date: Fri, 10 Mar 2023 18:38:22 +0100 Subject: [PATCH 5/5] Fix copy/paste error. Signed-off-by: Daniel Scheffler --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 3d1a3b5..0c56d65 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,7 +6,7 @@ History ------------------ * Fixed https://github.com/GFZ/arosics/issues/20 (out_crea_options has no effect) (!32). -* Replaced CentOS CI container with an Ubuntu-based one (!33). +* Updated copyright (!33). 1.8.0 (2022-12-02)