From 2ab1d2d0a88b220aa27f95f7f2887c814c15f3f1 Mon Sep 17 00:00:00 2001 From: thunderhoser Date: Sun, 22 Nov 2020 22:41:48 -0700 Subject: [PATCH] Fixed bug in track_reanalysis.py. --- gewittergefahr/gg_utils/track_reanalysis.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gewittergefahr/gg_utils/track_reanalysis.py b/gewittergefahr/gg_utils/track_reanalysis.py index 68ce1d64..c3e18e0d 100644 --- a/gewittergefahr/gg_utils/track_reanalysis.py +++ b/gewittergefahr/gg_utils/track_reanalysis.py @@ -535,12 +535,21 @@ def join_collinear_tracks( unique_primary_id_strings, these_last_rows ))) - first_late_time_index = numpy.where( + these_indices = numpy.where( unique_times_unix_sec >= first_late_time_unix_sec - )[0][0] - last_late_time_index = numpy.where( + )[0] + + if len(these_indices) == 0: + return storm_object_table + first_late_time_index = these_indices[0] + + these_indices = numpy.where( unique_times_unix_sec <= last_late_time_unix_sec - )[0][-1] + )[0] + + if len(these_indices) == 0: + return storm_object_table + last_late_time_index = these_indices[-1] for j in range(first_late_time_index, last_late_time_index + 1):