diff --git a/Inst_eddies/Analysis/plot_eddy_contours.py b/Inst_eddies/Analysis/plot_eddy_contours.py index 71d0a9afe2e0d02d0de0696213e6edd726e3d21b..f17166e824a79d1da8217b20ac70c28c32c8b699 100755 --- a/Inst_eddies/Analysis/plot_eddy_contours.py +++ b/Inst_eddies/Analysis/plot_eddy_contours.py @@ -37,19 +37,23 @@ def select_ishapes(d, SHPC, i_slice, orientation, window = None): ishape_first = SHPC.comp_ishape(d, eddy_index = 1, i_slice = i_slice, orientation = orientation) - ishape_last = SHPC.get_ishape_last(i_slice, orientation)\ - [d - SHPC.d_init[i_slice]] - - if window is None: - ishape_list = list(range(ishape_first, ishape_last + 1)) - else: + try: + ishape_last = SHPC.get_ishape_last(i_slice, orientation)\ + [d - SHPC.d_init[i_slice]] + except TypeError: ishape_list = [] - reader = SHPC.get_reader(i_slice, layer = "extremum", - orientation = orientation) - - for ishape in range(ishape_first, ishape_last + 1): - points = reader.shape(ishape).points[0] - if util_eddies.in_window(points, window): ishape_list.append(ishape) + else: + if window is None: + ishape_list = list(range(ishape_first, ishape_last + 1)) + else: + ishape_list = [] + reader = SHPC.get_reader(i_slice, layer = "extremum", + orientation = orientation) + + for ishape in range(ishape_first, ishape_last + 1): + points = reader.shape(ishape).points[0] + if util_eddies.in_window(points, window): + ishape_list.append(ishape) return ishape_list