|
|
@ -26,94 +26,6 @@ from cycler import cycler
|
|
|
|
from survey_tools import call_lastools, extract_pts, update_survey_output
|
|
|
|
from survey_tools import call_lastools, extract_pts, update_survey_output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def plot_profiles(profile_info, profile, output_loc, LL_limit):
|
|
|
|
|
|
|
|
#plot the profile. expects output from CC_split_profile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YminorLocator=MultipleLocator(0.5)
|
|
|
|
|
|
|
|
XminorLocator=MultipleLocator(5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fig,ax=plt.subplots(figsize=(8, 3))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
num_plots=len(profile_info.keys())-1
|
|
|
|
|
|
|
|
colormap = plt.cm.jet
|
|
|
|
|
|
|
|
ax.set_prop_cycle(cycler('color', [colormap(i) for i in np.linspace(0, 0.9, num_plots)]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
max_y=0
|
|
|
|
|
|
|
|
for date in profile_info.keys():
|
|
|
|
|
|
|
|
if date!='info':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plt.plot(profile_info[date]['Chainage'], profile_info[date]['Elevation'], label=date)
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if max([i for i in profile_info[date]['Elevation'] if pd.isnull(i)==False])>max_y:
|
|
|
|
|
|
|
|
max_y=max([i for i in profile_info[date]['Elevation'] if pd.isnull(i)==False])
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
print("empty elevation section for %s" % date)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plt.plot([LL_limit,LL_limit], [-1,max_y], 'r--', alpha=0.5, label="Landward Limit")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plt.xlabel('Chainage (m)',weight='bold')
|
|
|
|
|
|
|
|
plt.ylabel('Elevation (m AHD)',weight='bold')
|
|
|
|
|
|
|
|
plt.legend(loc='upper right', bbox_to_anchor=(1.3,1))
|
|
|
|
|
|
|
|
plt.title(profile)
|
|
|
|
|
|
|
|
plt.rcParams['font.size']=8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ax.set_ylim([-1,math.ceil(max_y)])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ax.xaxis.set_minor_locator(XminorLocator)
|
|
|
|
|
|
|
|
ax.yaxis.set_minor_locator(YminorLocator)
|
|
|
|
|
|
|
|
ax.xaxis.grid(True, which='minor', color='k', linestyle='-', alpha=0.3)
|
|
|
|
|
|
|
|
ax.yaxis.grid(True,which='minor',color='k', linestyle='-', alpha=0.3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plt.grid(which='major', color='k', linestyle='-')
|
|
|
|
|
|
|
|
today=datetime.datetime.now().date().strftime('%Y%m%d')
|
|
|
|
|
|
|
|
plt.savefig(os.path.join(output_loc, '%s_%s.png' % (today, profile)),bbox_inches='tight',dpi=900)
|
|
|
|
|
|
|
|
plt.clf()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def CC_split_profile(file2read):
|
|
|
|
|
|
|
|
# this reads the profile files and splits it into dates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file_master=pd.read_csv(file2read)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
beach_original=file_master['Beach'].tolist()
|
|
|
|
|
|
|
|
profile_original=file_master['Profile'].tolist()
|
|
|
|
|
|
|
|
date_original=file_master['Date'].tolist()
|
|
|
|
|
|
|
|
chainage_original=file_master['Chainage'].tolist()
|
|
|
|
|
|
|
|
elevation_original=file_master['Elevation'].tolist()
|
|
|
|
|
|
|
|
easting_original=file_master['Easting'].tolist()
|
|
|
|
|
|
|
|
northing_original=file_master['Northing'].tolist()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data={}
|
|
|
|
|
|
|
|
i=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#add info on the beach and profile number
|
|
|
|
|
|
|
|
data['info']={'Profile':profile_original[0], 'Beach':beach_original[0]}
|
|
|
|
|
|
|
|
date_now=date_original[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while i<len(file_master):
|
|
|
|
|
|
|
|
chainage_tmp=[]
|
|
|
|
|
|
|
|
elevation_tmp=[]
|
|
|
|
|
|
|
|
easting_tmp=[]
|
|
|
|
|
|
|
|
northing_tmp=[]
|
|
|
|
|
|
|
|
while i<len(file_master) and date_now==date_original[i]:
|
|
|
|
|
|
|
|
chainage_tmp.append(chainage_original[i])
|
|
|
|
|
|
|
|
elevation_tmp.append(elevation_original[i])
|
|
|
|
|
|
|
|
easting_tmp.append(easting_original[i])
|
|
|
|
|
|
|
|
northing_tmp.append(northing_original[i])
|
|
|
|
|
|
|
|
i=i+1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data[date_now]={'Beach': beach_original[i-1], 'Profile':profile_original[i-1],'Easting': easting_tmp, 'Northing':northing_tmp, 'Elevation':elevation_tmp, 'Chainage':chainage_tmp}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if i<len(file_master):
|
|
|
|
|
|
|
|
date_now=date_original[i]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def profile_plots_volume(csv_loc, LL_xlsx, output_xlsx, graph_location):
|
|
|
|
def profile_plots_volume(csv_loc, LL_xlsx, output_xlsx, graph_location):
|
|
|
|
#get a list of all csvs which will each be analysed
|
|
|
|
#get a list of all csvs which will each be analysed
|
|
|
|
file_list=[]
|
|
|
|
file_list=[]
|
|
|
@ -203,7 +115,7 @@ def remove_temp_files(directory):
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits):
|
|
|
|
def plot_profiles(profile_name, survey_date, csv_output_dir, graph_loc, ch_limits):
|
|
|
|
csv_name = profile_name + '.csv'
|
|
|
|
csv_name = profile_name + '.csv'
|
|
|
|
profiles = pd.read_csv(os.path.join(csv_output_dir, csv_name))
|
|
|
|
profiles = pd.read_csv(os.path.join(csv_output_dir, csv_name))
|
|
|
|
|
|
|
|
|
|
|
@ -216,8 +128,7 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits):
|
|
|
|
ax = plt.axes()
|
|
|
|
ax = plt.axes()
|
|
|
|
for col in profiles.columns:
|
|
|
|
for col in profiles.columns:
|
|
|
|
profile = profiles.loc[ch_min:, col]
|
|
|
|
profile = profiles.loc[ch_min:, col]
|
|
|
|
date_str = col.split('_')[-1]
|
|
|
|
date = '{}-{}-{}'.format(survey_date[:4], survey_date[4:6], survey_date[6:])
|
|
|
|
date = '{}-{}-{}'.format(date_str[:4], date_str[4:6], date_str[6:])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ax.plot(profile.index, profile, label=date)
|
|
|
|
ax.plot(profile.index, profile, label=date)
|
|
|
|
|
|
|
|
|
|
|
@ -232,6 +143,7 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits):
|
|
|
|
|
|
|
|
|
|
|
|
png_name = os.path.join(graph_loc, profile_name + '.png')
|
|
|
|
png_name = os.path.join(graph_loc, profile_name + '.png')
|
|
|
|
plt.savefig(png_name, bbox_inches='tight', dpi=300)
|
|
|
|
plt.savefig(png_name, bbox_inches='tight', dpi=300)
|
|
|
|
|
|
|
|
plt.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input_file = 'Parameter Files/las-manipulation-survey-2.xlsx'
|
|
|
|
input_file = 'Parameter Files/las-manipulation-survey-2.xlsx'
|
|
|
@ -302,7 +214,7 @@ for i, row in params_file.iterrows():
|
|
|
|
# Plot profiles of current beach
|
|
|
|
# Plot profiles of current beach
|
|
|
|
profile_names = df['Profile'].unique()
|
|
|
|
profile_names = df['Profile'].unique()
|
|
|
|
for profile_name in profile_names:
|
|
|
|
for profile_name in profile_names:
|
|
|
|
plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits)
|
|
|
|
plot_profiles(profile_name, survey_date, csv_output_dir, graph_loc, ch_limits)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#delete the temp files from the tmp_dir and the interim_dir
|
|
|
|
#delete the temp files from the tmp_dir and the interim_dir
|
|
|
|