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 # Set figure dimensions based on beach size
vertical_exag = 8 vertical_exag = 8
m_per_inch = 8 m_per_inch = 8
try:
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:
fig_h = 5
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))
@ -160,7 +164,10 @@ def calculate_volumes(profile_name, survey_date, csv_output_dir, ch_limits, volu
# Get Nielsen erosion volumes # Get Nielsen erosion volumes
chainage = profiles.loc[:, current_date].dropna().index chainage = profiles.loc[:, current_date].dropna().index
elevation = profiles.loc[:, current_date].dropna().values elevation = profiles.loc[:, current_date].dropna().values
try:
volume = nielsen_volumes.volume_available(chainage, elevation, ch_min) volume = nielsen_volumes.volume_available(chainage, elevation, ch_min)
except ValueError:
volume = np.nan
# Update spreadsheet # Update spreadsheet
volumes.loc[profile_name, 'Volume_' + survey_date] = volume volumes.loc[profile_name, 'Volume_' + survey_date] = volume

@ -117,6 +117,12 @@ def extract_pts(las_in, cp_in, survey_date, beach, args=None, verbose=True):
# Load result into pandas dataframe # Load result into pandas dataframe
df = pd.read_csv(io.BytesIO(las_data)) 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 # Tidy up dataframe
df = df.drop(columns=['diff']) df = df.drop(columns=['diff'])
df['lidar_z'] = pd.to_numeric(df['lidar_z'], errors='coerce') df['lidar_z'] = pd.to_numeric(df['lidar_z'], errors='coerce')

Loading…
Cancel
Save