From 5a348be3dab43e8479d32a8450d19a91286e5070 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Wed, 1 Feb 2023 15:08:14 +0100 Subject: [PATCH] Handle missing orientation in `plot_eddy_contours` --- Inst_eddies/Analysis/plot_eddy_contours.py | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Inst_eddies/Analysis/plot_eddy_contours.py b/Inst_eddies/Analysis/plot_eddy_contours.py index 71d0a9af..f17166e8 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 -- GitLab