Compare commits

...

2 Commits

Author SHA1 Message Date
Chris Drummond 7ad2760377 Does not crop the classified las file 5 years ago
Chris Drummond b00902c204 Changed gridding from 1 m to 0.1 m in blast2dem 5 years ago

@ -406,8 +406,8 @@ def process(yaml_file):
# Interpolate point cloud onto a grid # Interpolate point cloud onto a grid
print('Interpolating to grid...') print('Interpolating to grid...')
xyz_name = os.path.join(tmp_dir, las_basename + '.xyz') xyz_name = os.path.join(tmp_dir, las_basename + '.xyz')
call_lastools('las2dem', input=las_classified_name, output=xyz_name, call_lastools('blast2dem', input=las_classified_name, output=xyz_name,
args=['-step', 1], verbose=False) args=['-step', 0.1], verbose=False)
# Make runup clipping mask from gridded point cloud # Make runup clipping mask from gridded point cloud
print('Calculating runup clipping mask...') print('Calculating runup clipping mask...')

@ -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_h = profiles.dropna().values.max() / m_per_inch * vertical_exag
fig_w = (profiles.index.max() - ch_min) / m_per_inch fig_w = (profiles.index.max() - ch_min) / m_per_inch
except ValueError: except ValueError:
fig_h = 5 fig_h = 2.3
fig_w = 10 fig_w = 10
if scale_figures: if scale_figures:
fig, ax = plt.subplots(figsize=(fig_w, fig_h)) fig, ax = plt.subplots(figsize=(fig_w, fig_h))
ax.set_aspect(vertical_exag) ax.set_aspect(vertical_exag)
else: else:
fig, ax = plt.subplots(figsize=(10, 5)) fig, ax = plt.subplots(figsize=(10, 2.3))
for col in profiles.columns: 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 = volumes.sort_index()
volumes.to_csv(csv_vol) 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 # Return None if there is only one survey
delta_vol = None delta_vol = None
else: 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] previous_vol = volumes.loc[profile_name][previous_date_idx]
current_vol = volumes.loc[profile_name][current_date_idx] current_vol = volumes.loc[profile_name][current_date_idx]
delta_vol = current_vol - previous_vol delta_vol = current_vol - previous_vol
@ -239,32 +240,11 @@ def process(yaml_file):
# Get name of swash cropping polygon # Get name of swash cropping polygon
crop_swash_poly = os.path.join(shp_swash_dir, las_basename + '.shp') 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)
# 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)
# Apply sea-side clipping polygon
print('Cropping back of beach...')
las_data = call_lastools('lasclip', input=las_data, output='-stdout',
args=['-poly', crop_heatmap_poly], verbose=False)
# Create clipping polygon for heatmap raster
print('Creating heat map cropping polygon...')
shp_name = os.path.join(output_poly_dir, las_basename + '.shp')
call_lastools('lasboundary', input=las_data, output=shp_name, verbose=False)
# Make a raster from point cloud # Make a raster from point cloud
print('Creating heat map raster...') print('Creating heat map raster...')
tif_name = os.path.join(output_tif_dir, las_basename + '.tif') tif_name = os.path.join(output_tif_dir, las_basename + '.tif')
call_lastools('las2dem', input=las_data, output=tif_name, call_lastools('blast2dem', input=input_las, output=tif_name,
args=['-step', 1, '-keep_class', 2], verbose=False) args=['-step', 0.1, '-keep_class', 2], verbose=True)
# IF THIS STEP ISN'T WORKING: # IF THIS STEP ISN'T WORKING:
# might mean there are no data lines # might mean there are no data lines
# trying running with args=['-step', 1, '-keep_class', 2, '-rescale', 0.001,0.001,0.001] # trying running with args=['-step', 1, '-keep_class', 2, '-rescale', 0.001,0.001,0.001]
@ -274,7 +254,7 @@ def process(yaml_file):
# Extract elevations along profiles from triangulated surface # Extract elevations along profiles from triangulated surface
print('Extracting profile elevations...') print('Extracting profile elevations...')
df = extract_pts( df = extract_pts(
las_data, input_las,
cp_csv, cp_csv,
survey_date, survey_date,
beach, beach,

Binary file not shown.
Loading…
Cancel
Save