diff --git a/las_manipulation.py b/las_manipulation.py index 5be453f..becacb5 100644 --- a/las_manipulation.py +++ b/las_manipulation.py @@ -353,32 +353,27 @@ def main(): # read the parameters file and scroll through it input_file = args.input_file - # input_file = 'Parameter Files/las manipulation survey2.xlsx' + input_file = 'Parameter Files/las-manipulation-survey-2.xlsx' params_file=pd.read_excel(input_file, sheet_name="PARAMS") for i, row in params_file.iterrows(): print("Starting to process %s" % row['Beach']) - input_las1 = row['INPUT LAS1'] + input_las = row['INPUT LAS'] initial_crop_poly = row['INITIAL CROP POLY'] - # temp_las1 = row['TEMP LAS1'] - # temp_las2 = row['TEMP LAS2'] - lasground_step = row['STEP VEG'] - # temp_las3 = row['TEMP LAS3'] - step_build = row['STEP BUILD'] - temp_xyz = row['TEMP XYZ'] + lasground_step = row['LASGROUND STEP'] zone_MGA = row['ZONE MGA'] check_value = row['CHECK VALUE'] direct = row['DIRECTION'] check_distance = row['CHECK DISTANCE'] - polygon_name = row['POLYGON NAME'] - path_2_poly = row['PATH TO POLYGON'] - # temp_las4 = row['TEMP LAS4'] - picture = row['PICTURE'] + shp_dir = row['SHP SWASH FOLDER'] tmp_dir = row['TMP FOLDER'] + # Get base name of input las + las_basename = os.path.splitext(os.path.basename(input_las))[0] + # Crop to beach boundary print('Clipping...') - las_data = call_lastools('lasclip', input=input_las1, output='-stdout', + las_data = call_lastools('lasclip', input=input_las, output='-stdout', args=['-poly', initial_crop_poly], verbose=False) # Classify ground points @@ -388,13 +383,14 @@ def main(): # Interpolate point cloud onto a grid print('Interpolating to grid...') - call_lastools('las2dem', input=las_data, output=temp_xyz, + xyz_name = os.path.join(tmp_dir, las_basename + '.xyz') + call_lastools('las2dem', input=las_data, output=xyz_name, args=['-step', 1], verbose=False) # Make runup clipping mask print('Calculating runup clipping mask...') - shp_name = os.path.join(path_2_poly, polygon_name) - polygon_wave_runup(temp_xyz, direct, shp_name, check_value, check_distance, zone_MGA) + shp_name = os.path.join(shp_dir, las_basename + '.shp') + polygon_wave_runup(xyz_name, direct, shp_name, check_value, check_distance, zone_MGA) #NOTE THAT YOU NEED TO CHECK THE OUTPUT SHP FILE AND ADJUST AS REQUIRED #delete the temp files