Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
arosics
Commits
0449ff41
Commit
0449ff41
authored
Nov 28, 2018
by
Daniel Scheffler
Browse files
Fixed exception in case Tie_Point_Grid.to_PointShapefile() is called with skip_nodata=False.
parent
92366aca
Pipeline
#3290
failed with stages
in 3 minutes and 35 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
arosics/Tie_Point_Grid.py
View file @
0449ff41
...
...
@@ -609,11 +609,16 @@ class Tie_Point_Grid(object):
"""
GDF
=
self
.
CoRegPoints_table
GDF2pass
=
GDF
if
not
skip_nodata
else
GDF
[
GDF
[
skip_nodata_col
]
!=
self
.
outFillVal
]
if
skip_nodata
:
GDF2pass
=
GDF
else
:
GDF2pass
=
GDF
[
GDF
[
skip_nodata_col
]
!=
self
.
outFillVal
].
copy
()
GDF2pass
.
LAST_ERR
=
GDF2pass
.
apply
(
lambda
GDF_row
:
repr
(
GDF_row
.
LAST_ERR
),
axis
=
1
)
# replace boolean values (cannot be written)
GDF2pass
=
GDF2pass
.
replace
(
False
,
0
)
# replace
all
booleans where column dtype is not np.bool but np.object
GDF2pass
=
GDF2pass
.
replace
(
True
,
1
)
GDF2pass
=
GDF2pass
.
replace
(
False
,
0
)
.
copy
()
# replace booleans where column dtype is not np.bool but np.object
GDF2pass
=
GDF2pass
.
replace
(
True
,
1
)
.
copy
()
for
col
in
GDF2pass
.
columns
:
if
GDF2pass
[
col
].
dtype
==
np
.
bool
:
GDF2pass
[
col
]
=
GDF2pass
[
col
].
astype
(
int
)
...
...
arosics/version.py
View file @
0449ff41
__version__
=
'0.8.
9
'
__versionalias__
=
'2018-11-2
7
_01'
__version__
=
'0.8.
10
'
__versionalias__
=
'2018-11-2
8
_01'
tests/test_tie_point_grid.py
View file @
0449ff41
...
...
@@ -74,6 +74,11 @@ class Test_Tie_Point_Grid(unittest.TestCase):
self
.
TPG
.
to_PointShapefile
(
outpath
)
self
.
assertTrue
(
os
.
path
.
isfile
(
outpath
))
with
tempfile
.
TemporaryDirectory
()
as
tmpdir
:
outpath
=
os
.
path
.
join
(
tmpdir
,
'test_out_shapefile_incl_nodata.shp'
)
self
.
TPG
.
to_PointShapefile
(
outpath
,
skip_nodata
=
False
)
self
.
assertTrue
(
os
.
path
.
isfile
(
outpath
))
def
test_to_vectorfield
(
self
):
with
tempfile
.
TemporaryDirectory
()
as
tmpdir
:
outpath
=
os
.
path
.
join
(
tmpdir
,
'test_vectorfield.bsq'
)
...
...
Write
Preview
Supports
Markdown
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