Commit 8d5220f5 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Merge branch 'bugfix/fix_missing_mp_init' into 'enhancement/migrate_to_pytest'

Bugfix/fix missing mp init

See merge request !61
parents 8a18eb61 3c216818
Pipeline #36363 passed with stage
in 17 minutes and 21 seconds
......@@ -541,6 +541,15 @@ class RPC_Geolayer_Generator(object):
global_dem_sensorgeo: Optional[GeoArray] = None
def _initialize_mp(elevation: Union[float, np.ndarray]):
"""Declare global variables needed for RPC_3D_Geolayer_Generator._compute_geolayer_for_unique_coeffgroup().
:param elevation: elevation - either as average value (float) or as a numpy array
"""
global global_dem_sensorgeo
global_dem_sensorgeo = elevation
class RPC_3D_Geolayer_Generator(object):
"""Class for creating band- AND pixel-wise longitude/latitude arrays based on rational polynomial coeff. (RPC)."""
......@@ -650,7 +659,7 @@ class RPC_3D_Geolayer_Generator(object):
# FIXME: pickling back large lon/lat arrays to the main process may be an issue on small machines
# -> results could be temporarily written to disk in that case
# NOTE: With the small test dataset pickling has only a small effect on processing time.
with Pool(self.CPUs) as pool:
with Pool(self.CPUs, initializer=_initialize_mp, initargs=[self.elevation]) as pool:
results = list(pool.imap_unordered(self._compute_geolayer_for_unique_coeffgroup, kwargs_list))
pool.close() # needed for coverage to work in multiprocessing
pool.join()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment