Skip to content

Commit 4efa196

Browse files
committed
Minor fix
1 parent 3067d6e commit 4efa196

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

seismic/stream_quality_filter.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ def curate_stream3c(ev_id, stream3c, logger=None):
6464
if not (np.all(start_times == start_times[0]) and np.all(end_times == end_times[0])):
6565
clip_start_time = np.max(start_times)
6666
clip_end_time = np.min(end_times)
67-
stream3c.trim(clip_start_time, clip_end_time)
67+
try:
68+
stream3c.trim(clip_start_time, clip_end_time)
69+
except Exception as e:
70+
if logger:
71+
logger.warning("Channels in stream {} could not be trimmed:\n{}".format(ev_id, stream3c))
72+
# end if
73+
return False
74+
# end try
6875
# end if
6976

7077
if len(stream3c[0]) != len(stream3c[1]) or len(stream3c[0]) != len(stream3c[2]):
@@ -166,7 +173,7 @@ def rz_corrcoef_filter(_stream, rz_min_xcorr_coeff, rotation_needed):
166173
logger.info('Curation options:\n{}'.format(json.dumps(curation_opts, indent=4)))
167174

168175
# Apply curation to streams prior to rotation
169-
data_all.curate(lambda _, evid, stream: curate_stream3c(evid, stream))
176+
data_all.curate(lambda _, evid, stream: curate_stream3c(evid, stream, logger=logger))
170177

171178
if "baz_range" in curation_opts:
172179
# Filter by back-azimuth

0 commit comments

Comments
 (0)