Commit 3cfd9a28 authored by Daniel Scheffler's avatar Daniel Scheffler

Added ignore_rotation to GeoArray.show(). Updated version info.

Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent d3ec31a5
Pipeline #3962 passed with stages
in 14 minutes and 10 seconds
......@@ -1043,7 +1043,7 @@ class GeoArray(object):
dill.dump(self, outF)
def _get_plottable_image(self, xlim=None, ylim=None, band=None, boundsMap=None, boundsMapPrj=None, res_factor=None,
nodataVal=None, out_prj=None):
nodataVal=None, out_prj=None, ignore_rotation=False):
# handle limits
if boundsMap:
boundsMapPrj = boundsMapPrj if boundsMapPrj else self.prj
......@@ -1064,7 +1064,7 @@ class GeoArray(object):
image2plot = image2plot.astype(np.int32)
# rotated images always have to be resampled for plotting
if gt[2] or gt[4]:
if not ignore_rotation and gt[2] or gt[4]:
out_prj = out_prj or self.projection
if res_factor != 1. and image2plot.shape[0] * image2plot.shape[1] > 1e6: # shape > 1000*1000
......@@ -1095,7 +1095,7 @@ class GeoArray(object):
def show(self, xlim=None, ylim=None, band=None, boundsMap=None, boundsMapPrj=None, figsize=None,
interpolation='none', vmin=None, vmax=None, pmin=2, pmax=98, cmap=None, nodataVal=None,
res_factor=None, interactive=False, ax=None):
res_factor=None, interactive=False, ax=None, ignore_rotation=False):
"""Plots the desired array position into a figure.
:param xlim: [start_column, end_column]
......@@ -1117,6 +1117,8 @@ class GeoArray(object):
:param interactive: <bool> activates interactive plotting based on 'holoviews' library.
NOTE: this deactivates the magic '% matplotlib inline' in Jupyter Notebook
:param ax: <matplotlib.axis> only usable in non-interactive mode
:param ignore_rotation: whether to ignore an image rotation angle included in the GDAL GeoTransform tuple for
plotting (default: False)
:return:
"""
......@@ -1126,7 +1128,7 @@ class GeoArray(object):
nodataVal = nodataVal if nodataVal is not None else self.nodata if self.nodata is not None else -9999
image2plot, gt, prj = \
self._get_plottable_image(xlim, ylim, band, boundsMap=boundsMap, boundsMapPrj=boundsMapPrj,
res_factor=res_factor, nodataVal=nodataVal)
res_factor=res_factor, nodataVal=nodataVal, ignore_rotation=ignore_rotation)
# set color palette
palette = plt.get_cmap(cmap) if cmap and isinstance(cmap, str) else cmap if cmap else plt.get_cmap('gray')
......
__version__ = '0.8.17'
__versionalias__ = '20190510.01'
__version__ = '0.8.18'
__versionalias__ = '20190514.01'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment