Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Daniel Scheffler
geoarray
Commits
c4d70219
Commit
c4d70219
authored
Oct 06, 2017
by
Daniel Scheffler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added parameters 'pmax' and 'pmin' to GeoArray.show(). Updated version info.
parent
a6e86ebd
Pipeline
#1295
passed with stages
in 11 minutes and 45 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
geoarray/__init__.py
geoarray/__init__.py
+2
-2
geoarray/baseclasses.py
geoarray/baseclasses.py
+12
-9
setup.py
setup.py
+1
-1
No files found.
geoarray/__init__.py
View file @
c4d70219
...
...
@@ -12,8 +12,8 @@ from .masks import CloudMask # noqa: E402
__author__
=
"""Daniel Scheffler"""
__email__
=
'danschef@gfz-potsdam.de'
__version__
=
'0.6.
8
'
__versionalias__
=
'v20171006.0
1
'
__version__
=
'0.6.
9
'
__versionalias__
=
'v20171006.0
2
'
__all__
=
[
'GeoArray'
,
'BadDataMask'
,
'NoDataMask'
,
...
...
geoarray/baseclasses.py
View file @
c4d70219
...
...
@@ -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
=
np
.
ma
.
masked_equal
(
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
)
else
:
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):
else
:
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
.
nan
percentile
(
data
,
1
)
vmax
=
vmax
if
vmax
is
not
None
else
np
.
nan
percentile
(
data
,
99
)
image2plot
=
data
plt
.
figure
(
figsize
=
figsize
)
...
...
@@ -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
.
nan
percentile
(
data
,
2
))
print
(
'98 % percentile:'
,
np
.
nan
percentile
(
data
,
98
))
def
clip_to_footprint
(
self
):
"""Clip the GeoArray instance to the outer bounds of the actual footprint."""
...
...
setup.py
View file @
c4d70219
...
...
@@ -23,7 +23,7 @@ test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutpu
setup
(
name
=
'geoarray'
,
version
=
'0.6.
8
'
,
version
=
'0.6.
9
'
,
description
=
"Fast Python interface for geodata - either on disk or in memory."
,
long_description
=
readme
+
'
\n\n
'
+
history
,
author
=
"Daniel Scheffler"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment