diff --git a/las_manipulation.py b/las_manipulation.py index 8b75b74..56ae694 100644 --- a/las_manipulation.py +++ b/las_manipulation.py @@ -353,7 +353,7 @@ def polygon_wave_runup(xyz_1m, direction, shp_name, set_check_value, distance_ch # Simplify polygon to remove invalid geometry #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} @@ -406,8 +406,8 @@ def process(yaml_file): # Interpolate point cloud onto a grid print('Interpolating to grid...') xyz_name = os.path.join(tmp_dir, las_basename + '.xyz') - call_lastools('las2dem', input=las_classified_name, output=xyz_name, - args=['-step', 1], verbose=False) + call_lastools('blast2dem', input=las_classified_name, output=xyz_name, + args=['-step', 0.1], verbose=False) # Make runup clipping mask from gridded point cloud print('Calculating runup clipping mask...') diff --git a/las_outputs.py b/las_outputs.py index fb62c7a..ad59e53 100644 --- a/las_outputs.py +++ b/las_outputs.py @@ -87,14 +87,14 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol, fig_h = profiles.dropna().values.max() / m_per_inch * vertical_exag fig_w = (profiles.index.max() - ch_min) / m_per_inch except ValueError: - fig_h = 5 + fig_h = 2.3 fig_w = 10 if scale_figures: fig, ax = plt.subplots(figsize=(fig_w, fig_h)) ax.set_aspect(vertical_exag) else: - fig, ax = plt.subplots(figsize=(10, 5)) + fig, ax = plt.subplots(figsize=(10, 2.3)) for col in profiles.columns: @@ -190,14 +190,15 @@ def calculate_volumes(profile_name, current_survey_date, previous_survey_date, volumes = volumes.sort_index() volumes.to_csv(csv_vol) - # Get most recent volume difference for current profile - current_date_idx = volumes.columns.get_loc('Volume_' + current_survey_date) - previous_date_idx = volumes.columns.get_loc('Volume_' + previous_survey_date) - if previous_date_idx < 0: + + if previous_survey_date=="nan": # Return None if there is only one survey delta_vol = None else: + # Get most recent volume difference for current profile + current_date_idx = volumes.columns.get_loc('Volume_' + current_survey_date) + previous_date_idx = volumes.columns.get_loc('Volume_' + previous_survey_date) previous_vol = volumes.loc[profile_name][previous_date_idx] current_vol = volumes.loc[profile_name][current_date_idx] delta_vol = current_vol - previous_vol @@ -240,18 +241,19 @@ def process(yaml_file): crop_swash_poly = os.path.join(shp_swash_dir, las_basename + '.shp') # Crop point cloud to swash boundary - print('Cropping swash...') - las_data = call_lastools('lasclip', input=input_las, output='-stdout', - args=['-poly', crop_swash_poly], verbose=False) + #print('Cropping swash...') + #las_data = call_lastools('lasclip', input=input_las, output='-stdout', + # args=['-poly', crop_swash_poly], verbose=False) # Export classified, clipped las for delivery to client - las_name = os.path.join(output_las_dir, las_basename + '.las') - with open (las_name, 'wb') as f: - f.write(las_data) + #las_name = os.path.join(output_las_dir, las_basename + '.las') + #with open (las_name, 'wb') as f: + # f.write(las_data) # Apply sea-side clipping polygon print('Cropping back of beach...') - las_data = call_lastools('lasclip', input=las_data, output='-stdout', + #las_data = call_lastools('lasclip', input=las_data, output='-stdout', + las_data = call_lastools('lasclip', input=input_las, output='-stdout', args=['-poly', crop_heatmap_poly], verbose=False) @@ -263,8 +265,8 @@ def process(yaml_file): # Make a raster from point cloud print('Creating heat map raster...') 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) + call_lastools('blast2dem', input=las_data, output=tif_name, + args=['-step', 0.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] diff --git a/param-files/survey-1.xlsx b/param-files/survey-1.xlsx deleted file mode 100644 index b43b56a..0000000 Binary files a/param-files/survey-1.xlsx and /dev/null differ