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
1627f92a
Commit
1627f92a
authored
Mar 21, 2019
by
Daniel Scheffler
Browse files
Replaced get_area_def by AreaDefinition.
parent
476f1578
Changes
2
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/geo/raster/reproject.py
View file @
1627f92a
...
...
@@ -18,7 +18,6 @@ except ImportError:
# NOTE: In case of ImportError: dlopen: cannot load any more object with static TLS,
# one could add 'from pykdtree.kdtree import KDTree' here (before pyresample import)
from
pyresample.geometry
import
AreaDefinition
,
SwathDefinition
from
pyresample
import
get_area_def
from
pyresample.bilinear
import
resample_bilinear
from
pyresample.kd_tree
import
resample_nearest
,
resample_gauss
,
resample_custom
...
...
@@ -677,14 +676,14 @@ class SensorMapGeometryTransformer(object):
out_extent
=
xmin
,
ymin
,
xmax
,
ymax
# get area_definition
area_definition
=
get_area_def
(
area_id
=
''
,
area_name
=
''
,
proj_id
=
''
,
proj
4_args
=
get_proj4info
(
proj
=
tgt_prj
),
width
=
x_size
,
height
=
y_size
,
area_extent
=
list
(
out_extent
),
)
# type: AreaDefinition
area_definition
=
AreaDefinition
(
area_id
=
''
,
description
=
''
,
proj_id
=
''
,
proj
ection
=
get_proj4info
(
proj
=
tgt_prj
),
width
=
x_size
,
height
=
y_size
,
area_extent
=
list
(
out_extent
),
)
return
area_definition
...
...
tests/test_geo/test_raster/test_reproject.py
View file @
1627f92a
...
...
@@ -50,6 +50,7 @@ class Test_SensorMapGeometryTransformer(TestCase):
dem_sensors_geo
=
SMGT
.
to_sensor_geometry
(
self
.
dem_map_geo
,
src_prj
=
32632
,
src_extent
=
self
.
dem_area_extent_coarse_subset_utm
)
self
.
assertIsInstance
(
dem_sensors_geo
,
np
.
ndarray
)
self
.
assertFalse
(
np
.
array_equal
(
np
.
unique
(
dem_sensors_geo
),
np
.
array
([
0
])))
self
.
assertEquals
(
dem_sensors_geo
.
shape
,
(
150
,
1000
))
def
test_to_map_geometry_lonlat
(
self
):
...
...
@@ -66,6 +67,7 @@ class Test_SensorMapGeometryTransformer(TestCase):
rows
=
dem_map_geo
.
shape
[
0
]))
self
.
assertTrue
(
False
not
in
np
.
isclose
(
np
.
array
([
xmin
,
ymin
,
xmax
,
ymax
]),
np
.
array
(
self
.
expected_dem_area_extent_lonlat
)))
self
.
assertFalse
(
np
.
array_equal
(
np
.
unique
(
dem_map_geo
),
np
.
array
([
0
])))
with
self
.
assertRaises
(
ValueError
):
SMGT
.
to_map_geometry
(
self
.
dem_sensor_geo
[:
10
,
:
10
],
tgt_prj
=
4326
)
# must have the shape of lons/lats
...
...
@@ -84,6 +86,7 @@ class Test_SensorMapGeometryTransformer(TestCase):
rows
=
dem_map_geo
.
shape
[
0
]))
self
.
assertTrue
(
False
not
in
np
.
isclose
(
np
.
array
([
xmin
,
ymin
,
xmax
,
ymax
]),
np
.
array
(
self
.
expected_dem_area_extent_utm
)))
self
.
assertFalse
(
np
.
array_equal
(
np
.
unique
(
dem_map_geo
),
np
.
array
([
0
])))
class
Test_SensorMapGeometryTransformer3D
(
TestCase
):
...
...
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