Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
geoarray
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel Scheffler
geoarray
Commits
172b79f5
Commit
172b79f5
authored
Aug 09, 2018
by
Daniel Scheffler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfixes. Added tests for get_subset.
parent
1ec5e10c
Pipeline
#3087
passed with stages
in 1 minute and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
geoarray/baseclasses.py
geoarray/baseclasses.py
+3
-3
tests/test_geoarray.py
tests/test_geoarray.py
+18
-0
No files found.
geoarray/baseclasses.py
View file @
172b79f5
...
...
@@ -1530,9 +1530,9 @@ class GeoArray(object):
bNs_out
=
list
(
self
.
bandnames
)
_meta_out
=
self
.
meta
sub_gA
.
_
gt
=
sub_gt
sub_gA
.
_
metadata
=
_meta_out
sub_gA
.
_
bandnames
=
bNs_out
sub_gA
.
gt
=
sub_gt
sub_gA
.
metadata
=
_meta_out
sub_gA
.
bandnames
=
bNs_out
sub_gA
.
filePath
=
self
.
filePath
if
xslicing
or
yslicing
:
sub_gA
.
_footprint_poly
=
None
# reset footprint_poly -> has to be updated
...
...
tests/test_geoarray.py
View file @
172b79f5
...
...
@@ -489,6 +489,24 @@ class Test_GeoarrayFunctions(unittest.TestCase):
reset_bandnames
=
True
)
self
.
assertTrue
(
list
(
sub_gA
.
bandnames
),
[
'B1'
])
# test arrays are equal
sub_gA
=
self
.
testtiff
.
get_subset
(
xslice
=
slice
(
2
,
5
),
yslice
=
slice
(
None
,
3
),
zslice
=
slice
(
1
,
2
))
sub_testtiff_arr
=
self
.
testtiff
[:
3
,
2
:
5
,
1
:
2
]
self
.
assertTrue
(
np
.
array_equal
(
sub_gA
[:],
sub_testtiff_arr
))
# test deepcopied arrays (modification of sub_gA.arr must not affect self.testtiff.arr)
sub_gA
[:
2
,
:
2
]
=
99
self
.
assertTrue
(
np
.
array_equal
(
sub_gA
[:
2
,
:
2
],
np
.
full
((
2
,
2
,
1
),
99
,
self
.
testtiff
.
dtype
)))
self
.
assertNotEqual
(
np
.
mean
(
sub_testtiff_arr
[:
2
,
:
2
]),
99
)
self
.
assertNotEqual
(
np
.
std
(
sub_testtiff_arr
[:
2
,
:
2
]),
0
)
# test metadata
self
.
assertEqual
(
sub_gA
.
meta
.
bands
,
1
)
self
.
assertEqual
(
len
(
list
(
sub_gA
.
meta
.
band_meta
.
values
())[
0
]),
1
)
self
.
assertEqual
(
len
(
list
(
sub_gA
.
bandnames
.
keys
())),
1
)
self
.
assertNotEqual
(
sub_gA
.
gt
,
self
.
testtiff
.
gt
)
self
.
assertEqual
(
sub_gA
.
prj
,
self
.
testtiff
.
prj
)
# test not to return GeoArray
out
=
self
.
testtiff
.
get_subset
(
xslice
=
slice
(
2
,
5
),
yslice
=
slice
(
None
,
3
),
zslice
=
slice
(
1
,
2
),
return_GeoArray
=
False
)
...
...
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