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
fe8d8d23
Commit
fe8d8d23
authored
Jun 16, 2017
by
Daniel Scheffler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Passed metadata through to GeoArray subset that comes out of GeoArray.get_subset()
parent
8465e516
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
geoarray/baseclasses.py
geoarray/baseclasses.py
+8
-2
No files found.
geoarray/baseclasses.py
View file @
fe8d8d23
...
...
@@ -657,7 +657,6 @@ class GeoArray(object):
:return:
"""
# TODO add support for global domain metadata
if
not
self
.
_gdalDataset_meta_already_set
:
assert
self
.
filePath
ds
=
gdal
.
Open
(
self
.
filePath
)
...
...
@@ -669,6 +668,7 @@ class GeoArray(object):
self
.
_dtype
=
gdal_array
.
GDALTypeCodeToNumericTypeCode
(
ds
.
GetRasterBand
(
1
).
DataType
)
self
.
_geotransform
=
ds
.
GetGeoTransform
()
self
.
_projection
=
EPSG2WKT
(
WKT2EPSG
(
ds
.
GetProjection
()))
# temp conversion to EPSG needed because GDAL seems to modify WKT string when writing file to disk (e.g. using gdal_merge) -> conversion to EPSG and back undos that
if
not
'nodata'
in
self
.
_initParams
or
self
.
_initParams
[
'nodata'
]
is
None
:
band
=
ds
.
GetRasterBand
(
1
)
self
.
_nodata
=
band
.
GetNoDataValue
()
# FIXME this does not support different nodata values within the same file
...
...
@@ -678,6 +678,10 @@ class GeoArray(object):
band
=
ds
.
GetRasterBand
(
b
+
1
)
self
.
metadata
[
b
]
=
GeoSeries
(
band
.
GetMetadata
())
# read global domain metadata
# TODO add support for global domain metadata
ds
=
band
=
None
self
.
_gdalDataset_meta_already_set
=
True
...
...
@@ -1240,7 +1244,9 @@ class GeoArray(object):
zslice
if
zslice
else
slice
(
None
)]
# band
sub_ulXY
=
imXY2mapXY
((
xslice
.
start
,
yslice
.
start
),
self
.
gt
)
sub_gt
=
(
sub_ulXY
[
0
],
self
.
gt
[
1
],
self
.
gt
[
2
],
sub_ulXY
[
1
],
self
.
gt
[
4
],
self
.
gt
[
5
])
sub_gA
=
GeoArray
(
sub_arr
,
sub_gt
,
self
.
prj
)
sub_gA
=
GeoArray
(
sub_arr
,
sub_gt
,
self
.
prj
,
bandnames
=
list
(
self
.
bandnames
.
keys
()),
nodata
=
self
.
nodata
,
progress
=
self
.
progress
,
q
=
self
.
q
)
sub_gA
.
meta
=
self
.
meta
return
sub_gA
if
return_GeoArray
else
(
sub_arr
,
sub_gt
,
self
.
prj
)
...
...
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