From 2355d79489517f8a11a5bfa3c9e2ded185d449d2 Mon Sep 17 00:00:00 2001 From: Daniel Scheffler <danschef@gfz-potsdam.de> Date: Wed, 16 Mar 2022 23:01:08 +0100 Subject: [PATCH] Fixed #84: Orthorectification fails if L1B data are pseudo-projected/rotated (!62). --- .gitlab-ci.yml | 2 +- HISTORY.rst | 8 +++++++- enpt/processors/orthorectification/orthorectification.py | 4 ++-- enpt/processors/spatial_transform/spatial_transform.py | 4 ++-- enpt/version.py | 4 ++-- requirements.txt | 2 +- setup.py | 2 +- tests/gitlab_CI_docker/context/environment_enpt.yml | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 151e3e7e..9ce088d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ test_enpt: - source /root/mambaforge/bin/activate ci_env # update geoarray and py_tools_ds - # - pip install 'geoarray>=0.8.11' + # - pip install 'geoarray>=0.15.8' # - pip install 'py_tools_ds>=0.14.23' # install sicor and perhaps switch sicor branch diff --git a/HISTORY.rst b/HISTORY.rst index 8756a11b..0d37db61 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,12 +2,18 @@ History ======= +0.18.8 (2022-03-16) +------------------- + +* Fixed #84: Orthorectification fails if L1B data are pseudo-projected/rotated (!62). + + 0.18.7 (2022-03-10) ------------------- * Fixed some style issues. * Replaced deprecated URLs. -* Fix typo in requirements. +* Fixed typo in requirements. * Excluded Python 3.10 intermediately due to debugger issue. * Fixed indentation in Makefile. * Improved error message in case a requirement of ACwater is missing. diff --git a/enpt/processors/orthorectification/orthorectification.py b/enpt/processors/orthorectification/orthorectification.py index 649e7cb9..13764f68 100644 --- a/enpt/processors/orthorectification/orthorectification.py +++ b/enpt/processors/orthorectification/orthorectification.py @@ -109,13 +109,13 @@ class Orthorectifier(object): enmap_ImageL1.logger.info("Orthorectifying VNIR data using '%s' resampling algorithm..." % self.cfg.ortho_resampAlg) GT_vnir = GeoTransformer(lons=lons_vnir, lats=lats_vnir, fill_value=0, **kw_init) - vnir_mapgeo_gA = GeoArray(*GT_vnir.to_map_geometry(enmap_ImageL1.vnir.data[:], **kw_trafo), + vnir_mapgeo_gA = GeoArray(*GT_vnir.to_map_geometry(enmap_ImageL1.vnir.data, **kw_trafo), nodata=0) enmap_ImageL1.logger.info("Orthorectifying SWIR data using '%s' resampling algorithm..." % self.cfg.ortho_resampAlg) GT_swir = GeoTransformer(lons=lons_swir, lats=lats_swir, fill_value=0, **kw_init) - swir_mapgeo_gA = GeoArray(*GT_swir.to_map_geometry(enmap_ImageL1.swir.data[:], **kw_trafo), + swir_mapgeo_gA = GeoArray(*GT_swir.to_map_geometry(enmap_ImageL1.swir.data, **kw_trafo), nodata=0) # combine VNIR and SWIR diff --git a/enpt/processors/spatial_transform/spatial_transform.py b/enpt/processors/spatial_transform/spatial_transform.py index b920bab5..6702ddd8 100644 --- a/enpt/processors/spatial_transform/spatial_transform.py +++ b/enpt/processors/spatial_transform/spatial_transform.py @@ -83,7 +83,7 @@ class Geometry_Transformer(SensorMapGeometryTransformer): area_definition: AreaDefinition = None): data_sensorgeo = GeoArray(path_or_geoarray_sensorgeo) - if data_sensorgeo.is_map_geo: + if data_sensorgeo.is_map_geo and not data_sensorgeo.is_rotated: raise RuntimeError('The dataset to be transformed into map geometry already represents map geometry.') # run transformation (output extent/area definition etc. is internally computed from the geolayers if not given) @@ -135,7 +135,7 @@ class Geometry_Transformer_3D(SensorMapGeometryTransformer3D): ) -> Tuple[np.ndarray, tuple, str]: data_sensorgeo = GeoArray(path_or_geoarray_sensorgeo) - if data_sensorgeo.is_map_geo: + if data_sensorgeo.is_map_geo and not data_sensorgeo.is_rotated: raise RuntimeError('The dataset to be transformed into map geometry already represents map geometry.') # run transformation (output extent/area definition etc. is internally computed from the geolayers if not given) diff --git a/enpt/version.py b/enpt/version.py index afd98bbb..ec490ef3 100644 --- a/enpt/version.py +++ b/enpt/version.py @@ -27,6 +27,6 @@ # You should have received a copy of the GNU Lesser General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. -__version__ = '0.18.7' -__versionalias__ = '20220310.01' +__version__ = '0.18.8' +__versionalias__ = '20220316.01' __author__ = 'Daniel Scheffler' diff --git a/requirements.txt b/requirements.txt index 8ff3560d..c9e6c32e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ arosics>=1.0.0 cerberus -geoarray>=0.9.0 +geoarray>=0.15.8 jsmin lxml matplotlib diff --git a/setup.py b/setup.py index 09384fa8..9187a293 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ with open("enpt/version.py", encoding='utf-8') as version_file: req = [ 'arosics>=1.0.0', 'cerberus', - 'geoarray>=0.9.0', + 'geoarray>=0.15.8', 'jsmin', 'lxml', 'matplotlib', diff --git a/tests/gitlab_CI_docker/context/environment_enpt.yml b/tests/gitlab_CI_docker/context/environment_enpt.yml index 87570ca2..baa03a8b 100644 --- a/tests/gitlab_CI_docker/context/environment_enpt.yml +++ b/tests/gitlab_CI_docker/context/environment_enpt.yml @@ -7,7 +7,7 @@ dependencies: - python<3.10 # issue with PyCharm debugger and Python 3.10 which could not be tracked down so far - pip # avoids that conda uses the wrong pip - arosics>1.0.0 - - geoarray>=0.9.0 + - geoarray>=0.15.8 - lxml - matplotlib - numpy -- GitLab