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

Added parameters 'pmax' and 'pmin' to Updated version info.

parent a6e86ebd
Pipeline #1295 passed with stages
in 11 minutes and 45 seconds
......@@ -12,8 +12,8 @@ from .masks import CloudMask # noqa: E402
__author__ = """Daniel Scheffler"""
__email__ = ''
__version__ = '0.6.8'
__versionalias__ = 'v20171006.01'
__version__ = '0.6.9'
__versionalias__ = 'v20171006.02'
__all__ = ['GeoArray',
......@@ -973,7 +973,8 @@ class GeoArray(object):
return image2plot, gt, prj
def show(self, xlim=None, ylim=None, band=None, boundsMap=None, boundsMapPrj=None, figsize=None,
interpolation='none', vmin=None, vmax=None, cmap=None, nodataVal=None, res_factor=None, interactive=False):
interpolation='none', vmin=None, vmax=None, pmin=2, pmax=98, cmap=None, nodataVal=None,
res_factor=None, interactive=False):
"""Plots the desired array position into a figure.
:param xlim: [start_column, end_column]
......@@ -984,8 +985,10 @@ class GeoArray(object):
:param boundsMapPrj:
:param figsize:
:param interpolation:
:param vmin:
:param vmax:
:param vmin: darkest pixel value to be included in stretching
:param vmax: brightest pixel value to be included in stretching
:param pmin: percentage to be used for excluding the darkest pixels from stretching (default: 2)
:param pmax: percentage to be used for excluding the brightest pixels from stretching (default: 98)
:param cmap:
:param nodataVal:
:param res_factor: <float> resolution factor for downsampling of the image to be plotted in order to save
......@@ -1008,10 +1011,10 @@ class GeoArray(object):
if nodataVal is not None and np.std(image2plot) != 0: # do not show nodata
image2plot =, nodataVal)
vmin_auto, vmax_auto = \
np.nanpercentile(image2plot.compressed(), 2), np.nanpercentile(image2plot.compressed(), 98)
np.nanpercentile(image2plot.compressed(), pmin), np.nanpercentile(image2plot.compressed(), pmax)
palette.set_bad('aqua', 0)
vmin_auto, vmax_auto = np.nanpercentile(image2plot, 2), np.nanpercentile(image2plot, 98)
vmin_auto, vmax_auto = np.nanpercentile(image2plot, pmin), np.nanpercentile(image2plot, pmax)
vmin = vmin if vmin is not None else vmin_auto
vmax = vmax if vmax is not None else vmax_auto
......@@ -1266,8 +1269,8 @@ class GeoArray(object):
data = self[band]
vmin = vmin if vmin is not None else np.percentile(data, 1)
vmax = vmax if vmax is not None else np.percentile(data, 99)
vmin = vmin if vmin is not None else np.nanpercentile(data, 1)
vmax = vmax if vmax is not None else np.nanpercentile(data, 99)
image2plot = data
......@@ -1279,8 +1282,8 @@ class GeoArray(object):
if not self.q:
print('STD:', np.std(data))
print('MEAN:', np.mean(data))
print('2 % percentile:', np.percentile(data, 2))
print('98 % percentile:', np.percentile(data, 98))
print('2 % percentile:', np.nanpercentile(data, 2))
print('98 % percentile:', np.nanpercentile(data, 98))
def clip_to_footprint(self):
"""Clip the GeoArray instance to the outer bounds of the actual footprint."""
......@@ -23,7 +23,7 @@ test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutpu
description="Fast Python interface for geodata - either on disk or in memory.",
long_description=readme + '\n\n' + history,
author="Daniel Scheffler",
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