Allow surveys to be reprocessed when they are not most recent

etta-drone
Dan Howe 6 years ago
parent dc8531462a
commit 74804270f2

@ -178,13 +178,16 @@ def calculate_volumes(profile_name, survey_date, csv_output_dir, ch_limits, volu
volumes.to_csv(csv_vol)
# Get most recent volume difference for current profile
try:
previous_vol = volumes.loc[profile_name].values[-2]
current_vol = volumes.loc[profile_name].values[-1]
delta_vol = current_vol - previous_vol
except IndexError:
current_date_idx = volumes.columns.get_loc('Volume_' + survey_date)
previous_date_idx = current_date_idx - 1
if previous_date_idx < 0:
# Return None if there is only one survey
delta_vol = None
else:
previous_vol = volumes.loc[profile_name][previous_date_idx]
current_vol = volumes.loc[profile_name][current_date_idx]
delta_vol = current_vol - previous_vol
return delta_vol
@ -225,11 +228,17 @@ def process(yaml_file):
las_data = call_lastools('lasclip', input=input_las, output='-stdout',
args=['-poly', crop_swash_poly], verbose=False)
las_name = 'crop-1.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')

Loading…
Cancel
Save