Correctly handle profiles that are outside survey area

etta-drone
Dan Howe 7 years ago
parent 0d4a2b1372
commit dbf9fac0f1

@ -83,8 +83,12 @@ def plot_profiles(profile_name, csv_output_dir, graph_loc, ch_limits, delta_vol,
# Set figure dimensions based on beach size
vertical_exag = 8
m_per_inch = 8
fig_h = profiles.dropna().values.max() / m_per_inch * vertical_exag
fig_w = (profiles.index.max() - ch_min) / m_per_inch
try:
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_w = 10
if scale_figures:
fig, ax = plt.subplots(figsize=(fig_w, fig_h))
@ -160,7 +164,10 @@ def calculate_volumes(profile_name, survey_date, csv_output_dir, ch_limits, volu
# Get Nielsen erosion volumes
chainage = profiles.loc[:, current_date].dropna().index
elevation = profiles.loc[:, current_date].dropna().values
volume = nielsen_volumes.volume_available(chainage, elevation, ch_min)
try:
volume = nielsen_volumes.volume_available(chainage, elevation, ch_min)
except ValueError:
volume = np.nan
# Update spreadsheet
volumes.loc[profile_name, 'Volume_' + survey_date] = volume

@ -116,6 +116,12 @@ def extract_pts(las_in, cp_in, survey_date, beach, args=None, verbose=True):
# Load result into pandas dataframe
df = pd.read_csv(io.BytesIO(las_data))
# Create empty dataframe if no control points intersect point cloud
if (df.iloc[:, 0] == '-').all():
df = pd.read_csv(cp_in)
df['diff'] = '-'
df['lidar_z'] = '-'
# Tidy up dataframe
df = df.drop(columns=['diff'])

Loading…
Cancel
Save