Skip to content

Commit 6a0e358

Browse files
committed
improve error catching for rotary spectra plot
1 parent f27b510 commit 6a0e358

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

pycurrents_ADCP_processing/plot_westcoast_nc_LX.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,15 +2538,17 @@ def create_westcoast_plots(
25382538
# Only proceed if the bin index is in range
25392539
if bin_idx < len(bin_depths_lim):
25402540
# Add extra step in case the tidal analysis fails
2541-
plot_name = make_plot_rotary_spectra(
2542-
dest_dir, ncdata.filename, ncdata.station, ncdata.deployment_number,
2543-
ncdata.instrument_depth.data, ncdata.instrument_serial_number.data,
2544-
bin_number=bin_idx, bin_depths_lim=bin_depths_lim, time_lim=time_lim,
2545-
ns_lim=ns_lim, ew_lim=ew_lim, latitude=ncdata.latitude.data,
2546-
resampled=resampled, axis=-1
2547-
)
2548-
if plot_name is not None:
2549-
fnames_rot_spec.append(plot_name)
2541+
try:
2542+
fname_rot_spec = make_plot_rotary_spectra(
2543+
dest_dir, ncdata.filename, ncdata.station, ncdata.deployment_number,
2544+
ncdata.instrument_depth.data, ncdata.instrument_serial_number.data,
2545+
bin_number=bin_idx, bin_depths_lim=bin_depths_lim, time_lim=time_lim,
2546+
ns_lim=ns_lim, ew_lim=ew_lim, latitude=ncdata.latitude.data,
2547+
resampled=resampled, axis=-1
2548+
)
2549+
fnames_rot_spec.append(fname_rot_spec)
2550+
except ValueError as e:
2551+
print(f'Rotary spectra plot failed with error: {e}')
25502552
else:
25512553
print(f'Warning: Bin index {bin_idx} for rotary spectra out of range of limited bins with '
25522554
f'length {len(bin_depths_lim)}')

0 commit comments

Comments
 (0)