Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
arosics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel Scheffler
arosics
Commits
92366aca
You need to sign in or sign up before continuing.
Commit
92366aca
authored
6 years ago
by
Daniel Scheffler
Browse files
Options
Downloads
Patches
Plain Diff
Fixed figure of tie point grid broken due to matplotlib 3.0.0/basemap 1.2 incompatibility.
parent
d8efba3a
No related branches found
No related tags found
No related merge requests found
Pipeline
#3288
passed
6 years ago
Stage: test
Stage: deploy
Stage: cleanup
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
arosics/CoReg_local.py
+28
-31
28 additions, 31 deletions
arosics/CoReg_local.py
arosics/version.py
+2
-2
2 additions, 2 deletions
arosics/version.py
with
30 additions
and
33 deletions
arosics/CoReg_local.py
+
28
−
31
View file @
92366aca
...
...
@@ -16,7 +16,8 @@ except ImportError:
pyfftw
=
None
import
numpy
as
np
from
matplotlib
import
pyplot
as
plt
from
mpl_toolkits.axes_grid1
import
make_axes_locatable
from
matplotlib.colorbar
import
ColorbarBase
from
matplotlib.colors
import
Normalize
from
.Tie_Point_Grid
import
Tie_Point_Grid
from
.CoReg
import
COREG
...
...
@@ -338,7 +339,7 @@ class COREG_LOCAL(object):
backgroundIm
=
'
tgt
'
,
hide_filtered
=
True
,
figsize
=
None
,
title
=
''
,
vector_scale
=
1.
,
savefigPath
=
''
,
savefigDPI
=
96
,
showFig
=
True
,
vmin
=
None
,
vmax
=
None
,
return_map
=
False
,
zoomable
=
False
):
# type: (str, str, plt.cm, bool, str, bool, tuple, str, float, str, int, bool, float, float, bool
) -> tuple
# type: (str, str, plt.cm, bool, str, bool, tuple, str, float, str, int, bool, float, float, bool
, bool) -> ...
"""
Shows a map of the calculated tie point grid with the target image as background.
:param shapes2plot: <str>
'
points
'
: plot points representing values of
'
attribute2plot
'
onto the map
...
...
@@ -372,11 +373,11 @@ class COREG_LOCAL(object):
fig
,
ax
,
map2show
=
backgroundIm
.
show_map
(
figsize
=
figsize
,
nodataVal
=
self
.
nodata
[
1
],
return_map
=
True
,
band
=
self
.
COREG_obj
.
shift
.
band4match
,
zoomable
=
zoomable
)
plt
.
tick_params
(
axis
=
'
both
'
,
which
=
'
major
'
,
labelsize
=
40
)
ax
.
tick_params
(
axis
=
'
both
'
,
which
=
'
major
'
,
labelsize
=
40
)
# ax.tick_params(axis='both', which='minor', labelsize=8)
# fig, ax, map2show = backgroundIm.show_map_utm(figsize=(20,20), nodataVal=self.nodata[1], return_map=True)
plt
.
title
(
title
or
attribute2plot
)
ax
.
set_
title
(
title
or
attribute2plot
)
# transform all points of tie point grid to LonLat
outlierCols
=
[
c
for
c
in
self
.
CoRegPoints_table
.
columns
if
'
OUTLIER
'
in
c
]
...
...
@@ -392,7 +393,7 @@ class COREG_LOCAL(object):
# vmin = min(GDF[GDF[attribute2plot] != self.outFillVal][attribute2plot])
# vmax = max(GDF[GDF[attribute2plot] != self.outFillVal][attribute2plot])
# norm = mpl_normalize(vmin=vmin, vmax=vmax)
palette
=
cmap
if
cmap
is
not
None
else
plt
.
cm
.
RdYlGn_r
palette
=
cmap
if
cmap
is
not
None
else
plt
.
cm
.
get_cmap
(
'
RdYlGn_r
'
)
if
cmap
is
None
and
attribute2plot
==
'
ANGLE
'
:
# import matplotlib.colors as mcolors
# colors1 = plt.cm.RdYlGn_r(np.linspace(0., 1, 128))
...
...
@@ -404,7 +405,7 @@ class COREG_LOCAL(object):
# palette = plt.cm.hsv
import
cmocean
palette
=
cmocean
.
cm
.
delta
palette
=
getattr
(
cmocean
.
cm
,
'
delta
'
)
# GDF['color'] = [*GDF[attribute2plot].map(lambda val: palette(norm(val)))]
# add tie point grid to map
...
...
@@ -427,20 +428,20 @@ class COREG_LOCAL(object):
if
self
.
tieP_filter_level
>
0
:
# flag level 1 outliers
GDF_filt
=
GDF
[
GDF
.
L1_OUTLIER
.
__eq__
(
True
)].
copy
()
plt
.
scatter
(
GDF_filt
[
'
plt_X
'
],
GDF_filt
[
'
plt_Y
'
],
c
=
'
b
'
,
marker
=
marker
,
s
=
250
,
alpha
=
1.0
,
ax
.
scatter
(
GDF_filt
[
'
plt_X
'
],
GDF_filt
[
'
plt_Y
'
],
c
=
'
b
'
,
marker
=
marker
,
s
=
250
,
alpha
=
1.0
,
label
=
'
reliability
'
)
if
self
.
tieP_filter_level
>
1
:
# flag level 2 outliers
GDF_filt
=
GDF
[
GDF
.
L2_OUTLIER
.
__eq__
(
True
)].
copy
()
plt
.
scatter
(
GDF_filt
[
'
plt_X
'
],
GDF_filt
[
'
plt_Y
'
],
c
=
'
r
'
,
marker
=
marker
,
s
=
150
,
alpha
=
1.0
,
label
=
'
SSIM
'
)
ax
.
scatter
(
GDF_filt
[
'
plt_X
'
],
GDF_filt
[
'
plt_Y
'
],
c
=
'
r
'
,
marker
=
marker
,
s
=
150
,
alpha
=
1.0
,
label
=
'
SSIM
'
)
if
self
.
tieP_filter_level
>
2
:
# flag level 3 outliers
GDF_filt
=
GDF
[
GDF
.
L3_OUTLIER
.
__eq__
(
True
)].
copy
()
plt
.
scatter
(
GDF_filt
[
'
plt_X
'
],
GDF_filt
[
'
plt_Y
'
],
c
=
'
y
'
,
marker
=
marker
,
s
=
250
,
alpha
=
1.0
,
ax
.
scatter
(
GDF_filt
[
'
plt_X
'
],
GDF_filt
[
'
plt_Y
'
],
c
=
'
y
'
,
marker
=
marker
,
s
=
250
,
alpha
=
1.0
,
label
=
'
RANSAC
'
)
if
self
.
tieP_filter_level
>
0
:
plt
.
legend
(
loc
=
0
,
scatterpoints
=
1
)
ax
.
legend
(
loc
=
0
,
scatterpoints
=
1
)
# plot all points or vectors on top
if
not
GDF
.
empty
:
...
...
@@ -452,7 +453,7 @@ class COREG_LOCAL(object):
if
shapes2plot
==
'
vectors
'
:
# plot shift vectors
# doc: https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.quiver.html
plt
.
quiver
(
GDF
[
'
plt_X
'
],
GDF
[
'
plt_Y
'
],
ax
.
quiver
(
GDF
[
'
plt_X
'
],
GDF
[
'
plt_Y
'
],
-
GDF
[
'
X_SHIFT_M
'
],
-
GDF
[
'
Y_SHIFT_M
'
],
# invert absolute shifts to make arrows point to tgt
GDF
[
attribute2plot
].
clip
(
vmin
,
vmax
),
# sets the colors
scale
=
1200
/
vector_scale
,
# larger values decrease the arrow length
...
...
@@ -461,25 +462,21 @@ class COREG_LOCAL(object):
cmap
=
palette
,
pivot
=
'
middle
'
# position the middle point of the arrows onto the tie point location
)
mappable
=
None
elif
shapes2plot
==
'
points
'
:
# plot tie points
points
=
plt
.
scatter
(
GDF
[
'
plt_X
'
],
GDF
[
'
plt_Y
'
],
c
=
GDF
[
attribute2plot
],
lw
=
0
,
ax
.
scatter
(
GDF
[
'
plt_X
'
],
GDF
[
'
plt_Y
'
],
c
=
GDF
[
attribute2plot
],
lw
=
0
,
cmap
=
palette
,
marker
=
'
o
'
if
len
(
GDF
)
<
10000
else
'
.
'
,
s
=
50
,
alpha
=
1.0
,
vmin
=
vmin
,
vmax
=
vmax
)
mappable
=
points
else
:
raise
ValueError
(
"
The parameter
'
shapes2plot
'
must be set to
'
vectors
'
or
'
points
'
. Received %s.
"
%
shapes2plot
)
# add colorbar
divider
=
make_axes_locatable
(
plt
.
gca
())
# create axis on the right; size =2% of ax; padding = 0.1 inch
cax
=
divider
.
append_axes
(
"
right
"
,
size
=
"
2%
"
,
pad
=
0.1
)
plt
.
colorbar
(
mappable
,
cax
=
cax
)
p
=
ax
.
get_position
().
get_points
().
flatten
()
# [left, bottom, right, top]
cax
=
fig
.
add_axes
([
p
[
2
]
+
0.02
,
p
[
1
],
0.02
,
p
[
3
]
-
p
[
1
]])
# [left, bottom, width, height]
ColorbarBase
(
cax
,
cmap
=
palette
,
norm
=
Normalize
(
vmin
=
vmin
,
vmax
=
vmax
),
orientation
=
'
vertical
'
)
else
:
if
not
self
.
q
:
...
...
This diff is collapsed.
Click to expand it.
arosics/version.py
+
2
−
2
View file @
92366aca
__version__
=
'
0.8.
8
'
__versionalias__
=
'
2018-1
0
-2
2
_01
'
__version__
=
'
0.8.
9
'
__versionalias__
=
'
2018-1
1
-2
7
_01
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment