From 1f09e2a764734ba16a2df372d6aff586d6361f1f Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Tue, 17 Jul 2018 08:17:28 +1000 Subject: [PATCH] Update profile plotting --- outputs_2017088_Survey2.py | 51 ++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/outputs_2017088_Survey2.py b/outputs_2017088_Survey2.py index fcaaa49..9c14ebc 100644 --- a/outputs_2017088_Survey2.py +++ b/outputs_2017088_Survey2.py @@ -204,24 +204,24 @@ def remove_temp_files(directory): input_file = 'Parameter Files/las-manipulation-survey-2.xlsx' params_file=pd.read_excel(input_file, sheet_name="PARAMS") -for i in range(0, len(params_file)): #0, len(params_file) - print("Starting to process %s" % params_file['Beach'][i]) - beach=params_file['Beach'][i] - survey_date=params_file['SURVEY DATE'][i] - original_las=params_file['INPUT LAS'][i] - classified_las_dir=params_file['LAS CLASSIFIED FOLDER'][i] - shp_swash_dir=params_file['SHP SWASH FOLDER'][i] - crop_heatmap_poly=params_file['HEATMAP CROP POLY'][i] - output_las_dir=params_file['LAS OUTPUT FOLDER'][i] - zone_MGA=params_file['ZONE MGA'][i] - output_poly_dir=params_file['SHP RASTER FOLDER'][i] - output_tif_dir=params_file['TIF OUTPUT FOLDER'][i] - cp_csv=params_file['INPUT CSV'][i] - profile_limit_file=params_file['PROFILE LIMIT FILE'][i] - csv_output_dir=params_file['CSV OUTPUT FOLDER'][i] - graph_loc = params_file['PNG OUTPUT FOLDER'][i] - volume_output=params_file['CSV VOLUMES FOLDER'][i] - tmp_dir=params_file['TMP FOLDER'][i] +for i, row in params_file.iterrows(): + print("Starting to process %s" % row['Beach']) + beach=row['Beach'] + survey_date = row['SURVEY DATE'] + original_las = row['INPUT LAS'] + classified_las_dir = row['LAS CLASSIFIED FOLDER'] + shp_swash_dir = row['SHP SWASH FOLDER'] + crop_heatmap_poly = row['HEATMAP CROP POLY'] + output_las_dir = row['LAS OUTPUT FOLDER'] + zone_MGA = row['ZONE MGA'] + output_poly_dir = row['SHP RASTER FOLDER'] + output_tif_dir = row['TIF OUTPUT FOLDER'] + cp_csv = row['INPUT CSV'] + profile_limit_file = row['PROFILE LIMIT FILE'] + csv_output_dir = row['CSV OUTPUT FOLDER'] + graph_loc = row['PNG OUTPUT FOLDER'] + volume_output = row['CSV VOLUMES FOLDER'] + tmp_dir = row['TMP FOLDER'] # Get base name of input las las_basename = os.path.splitext(os.path.basename(original_las))[0] @@ -282,11 +282,20 @@ for csv_name in csv_names: # Remove metadata, and extract profile coordinates profiles = profiles.loc[:, 'Chainage':].set_index('Chainage') - # Remove landward section of profiles (behind beach) + # Find landward limit of profile (behind beach) ch_min = ch_limits.loc[profile_name, 'Landward Limit'] - # profiles = profiles.loc[ch_min:] - profiles.plot(title=profile_name) + ax = plt.axes() + for col in profiles.columns: + profile = profiles.loc[ch_min:, col] + date_str = col.split('_')[-1] + date = '{}-{}-{}'.format(date_str[:4], date_str[4:6], date_str[6:]) + + ax.plot(profile.index, profile, label=date) + + ax.set_xlabel('Chainage (m)', labelpad=10) + ax.set_ylabel('Elevation (m AHD)', labelpad=10) + ax.legend(frameon=False) plt.show()