diff --git a/opendm/dem/commands.py b/opendm/dem/commands.py index a53ce55c..6dbec686 100644 --- a/opendm/dem/commands.py +++ b/opendm/dem/commands.py @@ -26,7 +26,7 @@ def classify(lasFile, smrf=False, slope=1, cellsize=3, maxWindowSize=10, maxDist def create_dems(filenames, demtype, radius=['0.56'], gapfill=False, - outdir='', suffix='', resolution=0.1, **kwargs): + outdir='', suffix='', resolution=0.1, max_workers=None, **kwargs): """ Create DEMS for multiple radii, and optionally gapfill """ fouts = [] @@ -34,7 +34,7 @@ def create_dems(filenames, demtype, radius=['0.56'], gapfill=False, filenames, demtype, outdir=outdir, suffix=suffix, resolution=resolution, **kwargs) - with get_reusable_executor(timeout=None) as e: + with get_reusable_executor(max_workers=max_workers, timeout=None) as e: fouts = list(e.map(create_dem_for_radius, radius)) fnames = {} diff --git a/opendm/mesh.py b/opendm/mesh.py index 44b190ae..d282acab 100644 --- a/opendm/mesh.py +++ b/opendm/mesh.py @@ -9,7 +9,7 @@ from opendm import context from scipy import signal, ndimage import numpy as np -def create_25dmesh(inPointCloud, outMesh, dsm_resolution=0.05, depth=8, samples=1, maxVertexCount=100000, verbose=False): +def create_25dmesh(inPointCloud, outMesh, dsm_resolution=0.05, depth=8, samples=1, maxVertexCount=100000, verbose=False, max_workers=None): # Create DSM from point cloud # Create temporary directory @@ -32,7 +32,8 @@ def create_25dmesh(inPointCloud, outMesh, dsm_resolution=0.05, depth=8, samples= outdir=tmp_directory, resolution=dsm_resolution, products=['idw'], - verbose=verbose + verbose=verbose, + max_workers=max_workers ) dsm_points = dem_to_points(os.path.join(tmp_directory, 'mesh_dsm.tif'), os.path.join(tmp_directory, 'dsm_points.ply')) diff --git a/scripts/odm_dem.py b/scripts/odm_dem.py index 5a42331d..44690638 100644 --- a/scripts/odm_dem.py +++ b/scripts/odm_dem.py @@ -106,7 +106,8 @@ class ODMDEMCell(ecto.Cell): maxsd=args.dem_maxsd, maxangle=args.dem_maxangle, decimation=args.dem_decimation, - verbose=args.verbose + verbose=args.verbose, + max_workers=args.max_concurrency ) if args.crop > 0: diff --git a/scripts/odm_meshing.py b/scripts/odm_meshing.py index 51c422ef..bc46c254 100644 --- a/scripts/odm_meshing.py +++ b/scripts/odm_meshing.py @@ -84,7 +84,8 @@ class ODMeshingCell(ecto.Cell): dsm_resolution=float(1.0 / args.orthophoto_resolution), depth=self.params.oct_tree, maxVertexCount=self.params.max_vertex, - verbose=self.params.verbose) + verbose=self.params.verbose, + max_workers=args.max_concurrency) else: log.ODM_WARNING('Found a valid ODM 2.5D Mesh file in: %s' % tree.odm_25dmesh)