Added env_paths option in system.run, added path to superbuild install directory for odm_dem module, fixed lidar2dems install

Former-commit-id: ad47dd9fd4
pull/1161/head
Piero Toffanin 2017-06-29 10:55:43 -04:00
rodzic 8285397c59
commit 7e7a6de09c
4 zmienionych plików z 17 dodań i 9 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ ExternalProject_Add(${_proj_name}
#--Download step--------------
DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}/${_proj_name}
URL https://github.com/OpenDroneMap/lidar2dems/archive/master.zip
URL_MD5 ba3f7da85ae569fe2610646f540d2828
URL_MD5 76ae5d0182f280bec890bdfd156aa538
#--Update/Patch step----------
UPDATE_COMMAND ""
#--Configure step-------------
@ -17,7 +17,7 @@ ExternalProject_Add(${_proj_name}
#--Build step-----------------
BUILD_COMMAND ""
#--Install step---------------
INSTALL_COMMAND "${SB_SOURCE_DIR}/${_proj_name}/install.sh"
INSTALL_COMMAND "${SB_SOURCE_DIR}/${_proj_name}/install.sh" "${SB_INSTALL_DIR}"
#--Output logging-------------
LOG_DOWNLOAD OFF
LOG_CONFIGURE OFF

Wyświetl plik

@ -8,6 +8,7 @@ scripts_path = os.path.abspath(os.path.dirname(__file__))
root_path, _ = os.path.split(scripts_path)
superbuild_path = os.path.join(root_path, 'SuperBuild')
superbuild_bin_path = os.path.join(superbuild_path, 'install', 'bin')
tests_path = os.path.join(root_path, 'tests')
tests_data_path = os.path.join(root_path, 'tests/test_data')

Wyświetl plik

@ -17,10 +17,16 @@ def get_ccd_widths():
return dict(zip(map(string.lower, sensor_data.keys()), sensor_data.values()))
def run(cmd):
def run(cmd, env_paths=[]):
"""Run a system command"""
log.ODM_DEBUG('running %s' % cmd)
retcode = subprocess.call(cmd, shell=True)
env = None
if len(env_paths) > 0:
env = os.environ.copy()
env["PATH"] = env["PATH"] + ":" + ":".join(env_paths)
retcode = subprocess.call(cmd, shell=True, env=env)
if retcode < 0:
raise Exception("Child was terminated by signal {}".format(-retcode))

Wyświetl plik

@ -27,11 +27,12 @@ class ODMDEMCell(ecto.Cell):
args = self.inputs.args
tree = self.inputs.tree
las_model_found = io.file_exists(tree.odm_georeferencing_model_las)
env_paths = [tree.superbuild_bin_path]
# Just to make sure
l2d_module_installed = True
try:
system.run('l2d_classify --help > /dev/null')
system.run('l2d_classify --help > /dev/null', env_paths)
except:
log.ODM_WARNING('lidar2dems is not installed properly')
l2d_module_installed = False
@ -65,8 +66,8 @@ class ODMDEMCell(ecto.Cell):
summary_file_path = os.path.join(odm_dem_root, 'odm_georeferenced_model.summary.json')
boundary_file_path = os.path.join(odm_dem_root, 'odm_georeferenced_model.boundary.json')
system.run('pdal info --summary {0} > {1}'.format(tree.odm_georeferencing_model_las, summary_file_path))
system.run('pdal info --boundary {0} > {1}'.format(tree.odm_georeferencing_model_las, boundary_file_path))
system.run('pdal info --summary {0} > {1}'.format(tree.odm_georeferencing_model_las, summary_file_path), env_paths)
system.run('pdal info --boundary {0} > {1}'.format(tree.odm_georeferencing_model_las, boundary_file_path), env_paths)
pc_proj4 = ""
pc_geojson_bounds_feature = None
@ -131,7 +132,7 @@ class ODMDEMCell(ecto.Cell):
system.run('l2d_classify {0} --decimation {1} '
'{2} {3}'.format(
l2d_params, args.dem_decimation,
approximate, tree.odm_georeferencing))
approximate, tree.odm_georeferencing), env_paths)
else:
log.ODM_INFO("Will skip classification, only DSM is needed")
copyfile(tree.odm_georeferencing_model_las, os.path.join(odm_dem_root, 'bounds-0_l2d_s{slope}c{cellsize}.las'.format(**kwargs)))
@ -163,7 +164,7 @@ class ODMDEMCell(ecto.Cell):
'--maxsd {maxsd} --maxangle {maxangle} '
'--resolution {resolution} --radius {radius_steps} '
'{decimation} '
'{gapfill} '.format(**demargs))
'{gapfill} '.format(**demargs), env_paths)
# Rename final output
if product == 'dsm':