Commit a5270c1f authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed wring stretching of GeoArray.show() in case image contains np.nan.

parent b1755e6e
...@@ -991,10 +991,11 @@ class GeoArray(object): ...@@ -991,10 +991,11 @@ class GeoArray(object):
palette = cmap if cmap else plt.cm.gray palette = cmap if cmap else plt.cm.gray
if nodataVal is not None and np.std(image2plot) != 0: # do not show nodata if nodataVal is not None and np.std(image2plot) != 0: # do not show nodata
image2plot = np.ma.masked_equal(image2plot, nodataVal) image2plot = np.ma.masked_equal(image2plot, nodataVal)
vmin_auto, vmax_auto = np.percentile(image2plot.compressed(), 2), np.percentile(image2plot.compressed(), 98) vmin_auto, vmax_auto = \
np.nanpercentile(image2plot.compressed(), 2), np.nanpercentile(image2plot.compressed(), 98)
palette.set_bad('aqua', 0) palette.set_bad('aqua', 0)
else: else:
vmin_auto, vmax_auto = np.percentile(image2plot, 2), np.percentile(image2plot, 98) vmin_auto, vmax_auto = np.nanpercentile(image2plot, 2), np.percentile(image2plot, 98)
vmin = vmin if vmin is not None else vmin_auto vmin = vmin if vmin is not None else vmin_auto
vmax = vmax if vmax is not None else vmax_auto vmax = vmax if vmax is not None else vmax_auto
......
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