diff --git a/generate_heatmaps.py b/generate_heatmaps.py index 53a15df..888d794 100644 --- a/generate_heatmaps.py +++ b/generate_heatmaps.py @@ -53,7 +53,9 @@ def parse_yaml(yaml_name): def process(yaml_name): params = parse_yaml(yaml_name) beach = params['BEACH'] - base_name = os.path.splitext(os.path.basename(params['INPUT LAS']))[0] + #base_name = os.path.splitext(os.path.basename(params['INPUT LAS']))[0] + base_name='%s_%s' % (beach.lower().replace(" ","_"), params['SURVEY DATE']) + # Make all input and output paths absolute mxd_name = os.path.abspath(params['MAP DOCUMENT']) diff --git a/las_manipulation.py b/las_manipulation.py index 7f3adbf..8b75b74 100644 --- a/las_manipulation.py +++ b/las_manipulation.py @@ -351,8 +351,9 @@ def polygon_wave_runup(xyz_1m, direction, shp_name, set_check_value, distance_ch #print('making the crop polygon') # Simplify polygon to remove invalid geometry - geom = Polygon(for_shape).simplify(10) - + #geom = Polygon(for_shape).simplify(10) + geom = Polygon(for_shape) + # Export polygon as shapefile df = gpd.GeoDataFrame(geometry=[geom]) df.crs = {'init': 'epsg:283{}'.format(zone), 'no_defs': True} @@ -383,9 +384,12 @@ def process(yaml_file): las_dir = params['LAS CLASSIFIED FOLDER'] shp_dir = params['SHP SWASH FOLDER'] tmp_dir = params['TMP FOLDER'] + survey_date=params['SURVEY DATE'] + beach=params['BEACH'] # Get base name of input las - las_basename = os.path.splitext(os.path.basename(input_las))[0] + #las_basename = os.path.splitext(os.path.basename(input_las))[0] + las_basename='%s_%s' % (beach.lower().replace(" ","_"), survey_date) # # Crop to beach boundary print('Clipping...') diff --git a/las_outputs.py b/las_outputs.py index 2d97500..120db6a 100644 --- a/las_outputs.py +++ b/las_outputs.py @@ -81,7 +81,7 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol, ch_min = ch_limits.loc[profile_name, 'Landward Limit'] # Set figure dimensions based on beach size - vertical_exag = 8 + vertical_exag = 5 m_per_inch = 8 try: fig_h = profiles.dropna().values.max() / m_per_inch * vertical_exag @@ -96,6 +96,7 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol, else: fig, ax = plt.subplots(figsize=(10, 5)) + for col in profiles.columns: profile = profiles.loc[:, col] date_str = col.split('_')[-1] @@ -110,6 +111,11 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol, ax.set_xlabel('Chainage (m)', labelpad=10) ax.set_ylabel('Elevation (m AHD)', labelpad=10) + Ylim=ax.get_ylim()[1] + + if Ylim<10: + ax.set_ylim([ax.get_ylim()[0], 10]) + # Show most recent volume change if delta_vol is not None: ax.annotate('Most recent\nvolume change:\n{:+0.1f} m$^3$/m'.format(delta_vol), @@ -215,7 +221,9 @@ def process(yaml_file): tmp_dir = params['TMP FOLDER'] # Get base name of input las - las_basename = os.path.splitext(os.path.basename(original_las))[0] + #las_basename = os.path.splitext(os.path.basename(original_las))[0] + + las_basename='%s_%s' % (beach.lower().replace(" ","_"), survey_date) # Get name of input point cloud input_las = os.path.join(classified_las_dir, las_basename + '.las') @@ -249,6 +257,11 @@ def process(yaml_file): tif_name = os.path.join(output_tif_dir, las_basename + '.tif') call_lastools('las2dem', input=las_data, output=tif_name, args=['-step', 1, '-keep_class', 2], verbose=False) + # IF THIS STEP ISN'T WORKING: + # might mean there are no data lines + # trying running with args=['-step', 1, '-keep_class', 2, '-rescale', 0.001,0.001,0.001] + #call_lastools('las2dem', input=las_data, output=tif_name, + # args=['-step', 1, '-keep_class', 2, '-rescale', 0.001,0.001,0.001], verbose=False) # Extract elevations along profiles from triangulated surface print('Extracting profile elevations...') diff --git a/param-files/survey-1.xlsx b/param-files/survey-1.xlsx index bb289df..b43b56a 100644 Binary files a/param-files/survey-1.xlsx and b/param-files/survey-1.xlsx differ diff --git a/plot_heatmaps.py b/plot_heatmaps.py index 4b0ddcb..103e6de 100644 --- a/plot_heatmaps.py +++ b/plot_heatmaps.py @@ -53,7 +53,8 @@ def parse_yaml(yaml_name): def process(yaml_name): params = parse_yaml(yaml_name) beach = params['BEACH'] - base_name = os.path.splitext(os.path.basename(params['INPUT LAS']))[0] + #base_name = os.path.splitext(os.path.basename(params['INPUT LAS']))[0] + base_name='%s_%s' % (beach.lower().replace(" ","_"), params['SURVEY DATE']) # Make all input and output paths absolute mxd_name = os.path.abspath(params['MAP DOCUMENT'])