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
py_tools_ds
Commits
ee5aad8a
Commit
ee5aad8a
authored
Dec 14, 2018
by
Daniel Scheffler
Browse files
Added default to SensorMapGeometryTransformer.to_map_geometry. Updated version info.
parent
71b989b1
Pipeline
#3411
passed with stages
in 20 minutes and 1 second
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/geo/raster/reproject.py
View file @
ee5aad8a
...
...
@@ -712,7 +712,7 @@ class SensorMapGeometryTransformer(object):
return
gt
,
prj
def
to_map_geometry
(
self
,
data
,
tgt_prj
,
tgt_extent
=
None
,
tgt_res
=
None
,
area_definition
=
None
):
def
to_map_geometry
(
self
,
data
,
tgt_prj
=
None
,
tgt_extent
=
None
,
tgt_res
=
None
,
area_definition
=
None
):
# type: (np.ndarray, Union[str, int], Tuple[float, float, float, float], Tuple, AreaDefinition) -> ...
"""Transform the input sensor geometry array into map geometry.
...
...
@@ -720,17 +720,24 @@ class SensorMapGeometryTransformer(object):
:param tgt_prj: target projection (WKT or 'epsg:1234' or <EPSG_int>)
:param tgt_extent: extent coordinates of output map geometry array (LL_x, LL_y, UR_x, UR_y) in the tgt_prj
:param tgt_res: target X/Y resolution (e.g., (30, 30))
:param area_definition: an instance of pyresample.geometry.AreaDefinition;
replaces tgt_extent and tgt_res;
saves computation time
:param area_definition: an instance of pyresample.geometry.AreaDefinition;
OVERRIDES tgt_prj, tgt_extent and tgt_res;
saves computation time
"""
if
not
data
.
shape
==
self
.
lons
.
shape
==
self
.
lats
.
shape
:
raise
ValueError
(
data
.
shape
,
'Expected a sensor geometry data array with a shape of %s.'
%
str
(
self
.
lons
.
shape
))
self
.
area_definition
=
area_definition
or
\
self
.
compute_areadefinition_sensor2map
(
# get area_definition
if
area_definition
:
self
.
area_definition
=
area_definition
else
:
if
not
tgt_prj
:
raise
ValueError
(
tgt_prj
,
'Target projection must be given if area_definition is not given.'
)
self
.
area_definition
=
self
.
compute_areadefinition_sensor2map
(
data
,
tgt_prj
=
tgt_prj
,
tgt_extent
=
tgt_extent
,
tgt_res
=
tgt_res
)
# resample
data_mapgeo
=
self
.
_resample
(
data
,
self
.
swath_definition
,
self
.
area_definition
)
out_gt
,
out_prj
=
self
.
_get_gt_prj_from_areadefinition
(
self
.
area_definition
)
...
...
@@ -752,9 +759,11 @@ class SensorMapGeometryTransformer(object):
"""
proj4_args
=
proj4_to_dict
(
get_proj4info
(
proj
=
src_prj
))
# get area_definition
self
.
area_definition
=
AreaDefinition
(
''
,
''
,
''
,
proj4_args
,
data
.
shape
[
1
],
data
.
shape
[
0
],
src_extent
)
# resample
data_sensorgeo
=
self
.
_resample
(
data
,
self
.
area_definition
,
self
.
swath_definition
)
# output validation
...
...
py_tools_ds/version.py
View file @
ee5aad8a
__version__
=
'0.14.
3
'
__versionalias__
=
'20181214_0
1
'
__version__
=
'0.14.
4
'
__versionalias__
=
'20181214_0
2
'
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