diff --git a/Inst_eddies/Analysis/anim_eddy_contours.py b/Inst_eddies/Analysis/anim_eddy_contours.py index 8caee5f68a80036ccfb1250dfbd2a013e455d5e2..ee718ed0e4c51e32320a3f748c465a6841a29afe 100755 --- a/Inst_eddies/Analysis/anim_eddy_contours.py +++ b/Inst_eddies/Analysis/anim_eddy_contours.py @@ -45,11 +45,7 @@ def anim_eddies(fig, ax, handlers, window, d_min, d_max, light): ishape_lists_all = [] for handler in handlers: - ishape_lists = {d: - plot_eddy_contours.select_ishapes(d, handler["d_init"], - handler["ishape_last"], - handler["readers"]["extremum"], - window) + ishape_lists = {d: plot_eddy_contours.select_ishapes(d, handler, window) for d in range(d_min, d_max + 1)} ishape_lists_all.append(ishape_lists) diff --git a/Inst_eddies/Analysis/plot_eddy_contours.py b/Inst_eddies/Analysis/plot_eddy_contours.py index 2e309603d68adce31832fc769c21db79a17a55bb..26ad5fb9f150804eaf14d1bd785abbad96ce254c 100755 --- a/Inst_eddies/Analysis/plot_eddy_contours.py +++ b/Inst_eddies/Analysis/plot_eddy_contours.py @@ -30,26 +30,29 @@ import sys sys.path.append(path.join(sys.path[0], "../../Common")) import util_eddies -def select_ishapes(d, d_init, ishape_last, reader_extr, window = None): +def select_ishapes(d, handler, window = None): """Select ishapes at date d and in window. ax should be an instance of GeoAxes.""" - assert d >= d_init + assert d >= handler["d_init"] - if d == d_init: + if d == handler["d_init"]: ishape_first = 0 else: - # d > d_init - ishape_first = ishape_last[d - d_init - 1] + 1 + # d > handler["d_init"] + ishape_first = handler["ishape_last"][d - handler["d_init"] - 1] + 1 if window is None: - ishape_list = list(range(ishape_first, ishape_last[d - d_init] + 1)) + ishape_list = list(range(ishape_first, + handler["ishape_last"][d - handler["d_init"]] + + 1)) else: ishape_list = [] - for ishape in range(ishape_first, ishape_last[d - d_init] + 1): - shape_rec_extr = reader_extr.shapeRecord(ishape) + for ishape in range(ishape_first, + handler["ishape_last"][d - handler["d_init"]] + 1): + shape_rec_extr = handler["readers"]["extremum"].shapeRecord(ishape) points = shape_rec_extr.shape.points[0] if util_eddies.in_window(points, window): @@ -258,10 +261,7 @@ if __name__ == "__main__": else: d = args.date - ishape_list = select_ishapes(d, handler["d_init"], - handler["ishape_last"], - handler["readers"]["extremum"], - args.window) + ishape_list = select_ishapes(d, handler, args.window) if len(ishape_list) == 0: print(f"{shpc_dir}: No eddy found") snapshot(ax, ishape_list, handler, dashed = args.dashed, light = args.light)