|
|
|
@ -150,69 +150,7 @@ def extract_pts(las_in, cp_in, survey_date, keep_only_ground=True):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def process_tmp_csv(tmp_csv_file, survey_date, out_csv_loc, beach_name):
|
|
|
|
|
#lascontrol does not output in a particularly useful format.
|
|
|
|
|
#this processes its output to something useful
|
|
|
|
|
|
|
|
|
|
tmp_csv=pd.read_csv(tmp_csv_file)
|
|
|
|
|
|
|
|
|
|
profile=tmp_csv['ProfileNum']
|
|
|
|
|
z=tmp_csv['lidar_z']
|
|
|
|
|
x=tmp_csv['Easting']
|
|
|
|
|
y=tmp_csv['Northing']
|
|
|
|
|
chain=tmp_csv['Chainage']
|
|
|
|
|
|
|
|
|
|
data={}
|
|
|
|
|
|
|
|
|
|
i=0
|
|
|
|
|
while i<len(profile):
|
|
|
|
|
profile_now=profile[i]
|
|
|
|
|
data[profile_now]={}
|
|
|
|
|
easting=[]
|
|
|
|
|
northing=[]
|
|
|
|
|
chainage=[]
|
|
|
|
|
elevation=[]
|
|
|
|
|
while i<len(profile) and profile[i]==profile_now:
|
|
|
|
|
easting.append(x[i])
|
|
|
|
|
northing.append(y[i])
|
|
|
|
|
elevation.append(z[i])
|
|
|
|
|
chainage.append(chain[i])
|
|
|
|
|
i=i+1
|
|
|
|
|
data[profile_now]['Easting']=easting
|
|
|
|
|
data[profile_now]['Northing']=northing
|
|
|
|
|
data[profile_now]['Elevation']=elevation
|
|
|
|
|
data[profile_now]['Chainage']=chainage
|
|
|
|
|
|
|
|
|
|
for profile in data.keys():
|
|
|
|
|
print(profile)
|
|
|
|
|
if os.path.isfile("%s//%s.csv" % (out_csv_loc, profile)):
|
|
|
|
|
|
|
|
|
|
#if the file already exists, check if our new date is there (if so, overwrite)
|
|
|
|
|
file_check=pd.read_csv("%s//%s.csv" % (out_csv_loc, profile), dtype={'Date':str}) #
|
|
|
|
|
|
|
|
|
|
if str(survey_date) in [str(file_check['Date'][i]) for i in range(0, len(file_check['Date']))]:
|
|
|
|
|
|
|
|
|
|
file_check=file_check[file_check['Date']!=str(survey_date)]
|
|
|
|
|
file_check.to_csv("%s//%s.csv" % (out_csv_loc,profile), index=False)
|
|
|
|
|
|
|
|
|
|
#if the file exists, just append to the file
|
|
|
|
|
f=open("%s//%s.csv" % (out_csv_loc, profile), 'a')
|
|
|
|
|
else:
|
|
|
|
|
#otherwise make a new file
|
|
|
|
|
f=open("%s//%s.csv" % (out_csv_loc, profile), 'w')
|
|
|
|
|
f.writelines("Beach,Profile,Date,Easting,Northing,Chainage,Elevation\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i in range(0, len(data[profile]['Easting'])):
|
|
|
|
|
if data[profile]['Elevation'][i]=="-":
|
|
|
|
|
z=""
|
|
|
|
|
else:
|
|
|
|
|
z=data[profile]['Elevation'][i]
|
|
|
|
|
|
|
|
|
|
f.writelines("%s,%s,%s,%s,%s,%s,%s\n" % (beach_name, profile,survey_date, data[profile]['Easting'][i],data[profile]['Northing'][i],data[profile]['Chainage'][i], z))
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
def plot_profiles(profile_info, profile, output_loc, LL_limit):
|
|
|
|
|
#plot the profile. expects output from CC_split_profile
|
|
|
|
@ -427,7 +365,8 @@ for i in range(0, len(params_file)): #0, len(params_file)
|
|
|
|
|
make_raster(heatmap_las, output_raster, path_2_lastools, keep_only_ground=True)
|
|
|
|
|
|
|
|
|
|
#extract the points and get volumes
|
|
|
|
|
extract_pts(final_las, input_csv, tmp_csv, path_2_lastools, keep_only_ground=True)
|
|
|
|
|
df = extract_pts(final_las, input_csv, survey_date, keep_only_ground=True)
|
|
|
|
|
update_survey_output(df, output_csv_dir)
|
|
|
|
|
process_tmp_csv(tmp_csv, survey_date, csv_loc, beach)
|
|
|
|
|
|
|
|
|
|
#colourise the point cloud
|
|
|
|
|