diff --git a/las_manipulation.py b/las_manipulation.py index 7fc5357..7f3adbf 100644 --- a/las_manipulation.py +++ b/las_manipulation.py @@ -387,25 +387,22 @@ def process(yaml_file): # Get base name of input las las_basename = os.path.splitext(os.path.basename(input_las))[0] - # Crop to beach boundary + # # Crop to beach boundary print('Clipping...') - las_data = call_lastools('lasclip', input=input_las, output='-stdout', + las_clipped_name = os.path.join(tmp_dir, las_basename + '_clipped.las') + call_lastools('lasclip', input=input_las, output=las_clipped_name, args=['-poly', initial_crop_poly], verbose=False) # Classify ground points print('Classifying ground...') - las_data = call_lastools('lasground_new', input=las_data, output='-stdout', + las_classified_name = os.path.join(las_dir, las_basename + '.las') + call_lastools('lasground_new', input=las_clipped_name, output=las_classified_name, args=['-step', lasground_step], verbose=False) - # Save classified point cloud - las_name = os.path.join(las_dir, las_basename + '.las') - with open (las_name, 'wb') as f: - f.write(las_data) - # Interpolate point cloud onto a grid print('Interpolating to grid...') xyz_name = os.path.join(tmp_dir, las_basename + '.xyz') - call_lastools('las2dem', input=las_data, output=xyz_name, + call_lastools('las2dem', input=las_classified_name, output=xyz_name, args=['-step', 1], verbose=False) # Make runup clipping mask from gridded point cloud