diff --git a/lastools.py b/lastools.py index d46b264..e3dfcf0 100644 --- a/lastools.py +++ b/lastools.py @@ -2,7 +2,7 @@ import os import subprocess -def call_lastools(tool_name, las_in, las_out=None, args=None): +def call_lastools(tool_name, las_in, las_out=None, args=None, verbose=True): """Send commands to the lastools library. Requires lastools in system path. @@ -12,6 +12,7 @@ def call_lastools(tool_name, las_in, las_out=None, args=None): las_in: bytes from stdout, or path to input point cloud las_out: '-stdout' to pipe output, or path to output point cloud args: list of additional arguments, formatted for lastools + verbose: show all warnings and messages from lastools (boolean) Returns: bytes of output las, if las_out='-stdout' @@ -24,7 +25,7 @@ def call_lastools(tool_name, las_in, las_out=None, args=None): args=['-parse', 'sxyz']) # Clip las_data with a shapefile, and save to a new las file - call_lastools('lascrop', las_in=las_data, las_out='points.las', + call_lastools('lasclip', las_in=las_data, las_out='points.las', args=['-poly', 'boundary.shp']) """ @@ -66,6 +67,10 @@ def call_lastools(tool_name, las_in, las_out=None, args=None): os.path.basename(las_in))) print(stderr.decode()) + elif verbose: + # Print addional messages if verbose mode is being used + print(stderr.decode()) + # Output piped stdout if required if las_out == '-stdout': return stdout