Commit 06c76a01 authored by Daniel Scheffler's avatar Daniel Scheffler

Fixed gray value stretching issue in case of rotated ENVI images without inherent nodata value.

Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 32d84cb9
Pipeline #3927 passed with stages
in 1 minute and 23 seconds
......@@ -1054,7 +1054,10 @@ class GeoArray(object):
transOpt = ['SRC_METHOD=NO_GEOTRANSFORM'] if tuple(gt) == (0, 1, 0, 0, 0, -1) else None
xdim, ydim = None, None
nodataVal = nodataVal if nodataVal is not None else self.nodata
in_nodata = nodataVal if nodataVal is not None else self.nodata
out_nodata = in_nodata if in_nodata is not None else -9999
if not np.can_cast(out_nodata, image2plot.dtype):
image2plot = image2plot.astype(np.int32)
# rotated images always have to be resampled for plotting
if gt[2] or gt[4]:
......@@ -1070,8 +1073,12 @@ class GeoArray(object):
if xdim or ydim or out_prj:
from py_tools_ds.geo.raster.reproject import warp_ndarray
image2plot, gt, prj = warp_ndarray(image2plot, self.geotransform, self.projection,
out_XYdims=(xdim, ydim), in_nodata=nodataVal, out_nodata=nodataVal,
transformerOptions=transOpt, out_prj=out_prj, q=True)
out_XYdims=(xdim, ydim),
in_nodata=in_nodata,
out_nodata=out_nodata,
transformerOptions=transOpt,
out_prj=out_prj,
q=True)
if transOpt and 'NO_GEOTRANSFORM' in ','.join(transOpt):
image2plot = np.flipud(image2plot)
gt = list(gt)
......@@ -1112,7 +1119,7 @@ class GeoArray(object):
band = (band if band is not None else 0) if not interactive else band
# get image to plot
nodataVal = nodataVal if nodataVal is not None else self.nodata
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)
......
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