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
92636c0d
Commit
92636c0d
authored
Mar 22, 2019
by
Daniel Scheffler
Browse files
Force mp_alg = 'tiles' in case SensorMapGeometryTransformer3D is called within a nosetest.
parent
ef68c862
Pipeline
#3812
passed with stages
in 1 minute and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/geo/raster/reproject.py
View file @
92636c0d
...
...
@@ -5,6 +5,7 @@ import multiprocessing
import
os
from
tempfile
import
TemporaryDirectory
from
typing
import
Union
,
Tuple
,
List
,
Any
# noqa: F401
import
inspect
# custom
try
:
...
...
@@ -873,6 +874,13 @@ class SensorMapGeometryTransformer3D(object):
self
.
opts
[
'nprocs'
]
=
opts
.
get
(
'nprocs'
,
multiprocessing
.
cpu_count
())
self
.
mp_alg
=
(
'bands'
if
self
.
lons
.
shape
[
2
]
>=
opts
[
'nprocs'
]
else
'tiles'
)
if
mp_alg
==
'auto'
else
mp_alg
# override self.mp_alg if SensorMapGeometryTransformer3D is called by nosetests
is_called_by_nose
=
any
(
x
[
0
].
f_globals
[
'__name__'
].
startswith
(
'nose.'
)
for
x
in
inspect
.
stack
())
if
self
.
opts
[
'nprocs'
]
>
1
and
self
.
mp_alg
==
'bands'
and
is_called_by_nose
:
warnings
.
warn
(
"mp_alg='bands' causes deadlocks if SensorMapGeometryTransformer3D is called within a "
"nosetest. Using mp_alg='tiles'."
)
self
.
mp_alg
=
'tiles'
@
staticmethod
def
_to_map_geometry_2D
(
kwargs_dict
):
# type: (dict) -> Tuple[np.ndarray, tuple, str, int]
...
...
tests/test_geo/test_raster/test_reproject.py
View file @
92636c0d
...
...
@@ -120,8 +120,8 @@ class Test_SensorMapGeometryTransformer3D(TestCase):
def
test_to_map_geometry_lonlat_3D_geolayer
(
self
):
SMGT
=
SensorMapGeometryTransformer3D
(
lons
=
self
.
lons_3D
,
lats
=
self
.
lats_3D
,
resamp_alg
=
'nearest'
,
mp_alg
=
'
tiles'
# 'bands', i.e., Pool() causes problems with nosetests
#
resamp_alg='nearest',
resa
mp_alg
=
'
bilinear'
,
)
# to Lon/Lat
...
...
@@ -140,7 +140,6 @@ class Test_SensorMapGeometryTransformer3D(TestCase):
SMGT
=
SensorMapGeometryTransformer3D
(
lons
=
self
.
lons_3D
,
lats
=
self
.
lats_3D
,
resamp_alg
=
'nearest'
,
mp_alg
=
'tiles'
# 'bands', i.e., Pool() causes problems with nosetests)
)
dem_sensors_geo
=
SMGT
.
to_sensor_geometry
(
self
.
data_map_geo_3D
,
src_prj
=
32632
,
src_extent
=
self
.
dem_area_extent_coarse_subset_utm
)
...
...
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