Fix repeated shp extension

etta-drone
Dan Howe 6 years ago
parent 78109f0e2d
commit 144f935698

@ -326,7 +326,7 @@ def polygon_wave_runup(xyz_1m, direction, shp_name, set_check_value, distance_ch
# Export polygon as shapefile # Export polygon as shapefile
df = gpd.GeoDataFrame(geometry=[Polygon(for_shape)]) df = gpd.GeoDataFrame(geometry=[Polygon(for_shape)])
df.crs = {'init': 'epsg:283{}'.format(zone), 'no_defs': True} df.crs = {'init': 'epsg:283{}'.format(zone), 'no_defs': True}
df.to_file(shp_name + '.shp', driver='ESRI Shapefile') df.to_file(shp_name, driver='ESRI Shapefile')
return None return None

@ -23,6 +23,8 @@ import xlsxwriter
import math import math
from cycler import cycler from cycler import cycler
from survey_tools import call_lastools
############################################################################### ###############################################################################
########################## FIXED INPUTS ####################################### ########################## FIXED INPUTS #######################################
######### UNCOMMENT THIS SECTION IF YOU WANT TO DEFINE EACH INPUT INDIVIDUALLY ###################### ######### UNCOMMENT THIS SECTION IF YOU WANT TO DEFINE EACH INPUT INDIVIDUALLY ######################
@ -359,17 +361,19 @@ def remove_temp_files(directory):
############################################################################### ###############################################################################
########################### RUN CODE ########################################## ########################### RUN CODE ##########################################
input_file = 'Parameter Files/las-manipulation-survey-2.xlsx'
params_file=pd.read_excel(input_file, sheet_name="PARAMS") params_file=pd.read_excel(input_file, sheet_name="PARAMS")
for i in range(0, len(params_file)): #0, len(params_file) for i in range(0, len(params_file)): #0, len(params_file)
print("Starting to process %s" % params_file['Beach'][i]) print("Starting to process %s" % params_file['Beach'][i])
beach=params_file['Beach'][i] beach=params_file['Beach'][i]
survey_date=params_file['SURVEY DATE'][i] survey_date=params_file['SURVEY DATE'][i]
input_las5=params_file['INPUT LAS4'][i] original_las=params_file['INPUT LAS'][i]
crop_swash_poly=params_file['CROP SWASH POLY'][i] classified_las_dir=params_file['LAS CLASSIFIED FOLDER'][i]
shp_swash_dir=params_file['SHP SWASH FOLDER'][i]
heatmap_crop_poly=params_file['HEATMAP CROP POLY'][i] heatmap_crop_poly=params_file['HEATMAP CROP POLY'][i]
final_las = params_file['FINAL LAS'][i] final_las = params_file['LAS FINAL FOLDER'][i]
heatmap_las = params_file['HEATMAP LAS'][i] # heatmap_las = params_file['HEATMAP LAS'][i]
zone_MGA=params_file['ZONE MGA'][i] zone_MGA=params_file['ZONE MGA'][i]
output_poly_name=params_file['OUTPUT POLY NAME'][i] output_poly_name=params_file['OUTPUT POLY NAME'][i]
path_2_output_poly=params_file['PATH TO OUTPUT'][i] path_2_output_poly=params_file['PATH TO OUTPUT'][i]
@ -383,7 +387,19 @@ for i in range(0, len(params_file)): #0, len(params_file)
tmp_dir=params_file['TEMP DIR'][i] tmp_dir=params_file['TEMP DIR'][i]
int_dir=params_file['INTERIM DIR'][i] int_dir=params_file['INTERIM DIR'][i]
# Get base name of input las
las_basename = os.path.splitext(os.path.basename(original_las))[0]
# Get name of input point cloud
input_las = os.path.join(classified_las_dir, las_basename + '.las')
# Get name of swash cropping polygon
crop_swash_poly = os.path.join(shp_swash_dir, las_basename + '.shp')
# crop and get the output las # crop and get the output las
las_data = call_lastools('lasclip', input=input_las, output='-stdout',
args=['-poly', crop_swash_poly], verbose=False)
crop_las(input_las5, crop_swash_poly, final_las, path_2_lastools) crop_las(input_las5, crop_swash_poly, final_las, path_2_lastools)
#now crop out the heatmap las #now crop out the heatmap las

Loading…
Cancel
Save