From d989962a2ae9e03652eef3156c8ff50b55c526fb Mon Sep 17 00:00:00 2001 From: Daniel Scheffler Date: Wed, 16 Mar 2022 21:50:57 +0100 Subject: [PATCH 1/2] Added GeoArray.is_rotated attribute. Bumped version. --- HISTORY.rst | 6 ++++++ geoarray/baseclasses.py | 10 ++++++++-- geoarray/version.py | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 6235005..594bef8 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,12 @@ History ======= +0.15.8 (16.03.2022) +------------------- + +* Added GeoArray.is_rotated attribute to detect pseudo-projections. + + 0.15.7 (13.01.2022) ------------------- diff --git a/geoarray/baseclasses.py b/geoarray/baseclasses.py index 59f2709..5b36be1 100644 --- a/geoarray/baseclasses.py +++ b/geoarray/baseclasses.py @@ -365,12 +365,18 @@ class GeoArray(object): """Return 'True' if the image has a valid geoinformation with map instead of image coordinates.""" return all([self.gt, list(self.gt) != [0, 1, 0, 0, 0, -1], self.prj]) + @property + def is_rotated(self): + # type: () -> bool + """Return 'True' if the image has a rotation in the map info (i.e., is pseudo-projected).""" + return self.gt[2] or self.gt[4] + @property def nodata(self): """Get the nodata value of the GeoArray instance. If GeoArray has been instanced with a file path the metadata of the file on disk is checked for an existing - nodata value. Otherwise (if no value is exlicitly given during object instanciation) an automatic detection + nodata value. Otherwise, (if no value is exlicitly given during object instanciation) an automatic detection based on 3x3 windows at each image corner is run that analyzes the mean and standard deviation of these windows. """ if self._nodata is not None: @@ -1177,7 +1183,7 @@ class GeoArray(object): image2plot = image2plot.astype(int) # rotated images always have to be resampled for plotting - if not ignore_rotation and (gt[2] or gt[4]): + if not ignore_rotation and self.is_rotated: out_prj = out_prj or self.projection if res_factor != 1. and image2plot.shape[0] * image2plot.shape[1] > 1e6: # shape > 1000*1000 diff --git a/geoarray/version.py b/geoarray/version.py index e21841a..482ce67 100644 --- a/geoarray/version.py +++ b/geoarray/version.py @@ -22,5 +22,5 @@ # limitations under the License. -__version__ = '0.15.7' -__versionalias__ = '20220113.01' +__version__ = '0.15.8' +__versionalias__ = '20220316.01' -- GitLab From 604176c860194ec315b9363b4a8c519ef3ddb22d Mon Sep 17 00:00:00 2001 From: Daniel Scheffler Date: Wed, 16 Mar 2022 21:58:42 +0100 Subject: [PATCH 2/2] Fix dead URL. --- AUTHORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 1e160cd..e6a2553 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -6,7 +6,7 @@ Development Lead ---------------- * Daniel Scheffler -** +** Contributors -- GitLab