Skip to content
Snippets Groups Projects
Commit e130907b authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Remove argument `i_slice` of `select_ishapes`

Return `i_slice` instead. Since `i_slice` is now computed inside
`select_ishapes`.
parent 7a75ad0d
No related branches found
No related tags found
No related merge requests found
...@@ -63,18 +63,14 @@ def anim_eddies(fig, ax, SHPC, window, d_min, d_max, light): ...@@ -63,18 +63,14 @@ def anim_eddies(fig, ax, SHPC, window, d_min, d_max, light):
ishape_lists_all = {} ishape_lists_all = {}
i_slices = {} i_slices = {}
for d in range(d_min, d_max + 1):
i_slices[d] = SHPC.get_slice(d)
for orientation in ["Anticyclones", "Cyclones"]: for orientation in ["Anticyclones", "Cyclones"]:
ishape_lists_all[orientation] = {} ishape_lists_all[orientation] = {}
for d in range(d_min, d_max + 1): for d in range(d_min, d_max + 1):
ishape_lists_all[orientation][ (
d i_slices[d],
] = plot_eddy_contours.select_ishapes( ishape_lists_all[orientation][d],
d, SHPC, i_slices[d], orientation, window ) = plot_eddy_contours.select_ishapes(d, SHPC, orientation, window)
)
if window is None: if window is None:
bbox = None bbox = None
......
...@@ -25,16 +25,9 @@ import util_eddies ...@@ -25,16 +25,9 @@ import util_eddies
def select_ishapes( def select_ishapes(
d: int, d: int, SHPC: util_eddies.SHPC_class, orientation: str, window: list = None
SHPC: util_eddies.SHPC_class,
i_slice: int,
orientation: str,
window: list = None,
): ):
"""Select ishapes at date d and in window. We assume date d is in """Select ishapes at date d and in window."""
slice i_slice of the SHPC.
"""
i_slice, ishape_list = SHPC.ishape_range(d, orientation) i_slice, ishape_list = SHPC.ishape_range(d, orientation)
...@@ -49,7 +42,7 @@ def select_ishapes( ...@@ -49,7 +42,7 @@ def select_ishapes(
if util_eddies.in_window(points, window): if util_eddies.in_window(points, window):
ishape_list_filt.append(ishape) ishape_list_filt.append(ishape)
return ishape_list_filt return i_slice, ishape_list_filt
def snapshot( def snapshot(
...@@ -259,14 +252,12 @@ if __name__ == "__main__": ...@@ -259,14 +252,12 @@ if __name__ == "__main__":
if args.date is None: if args.date is None:
d = SHPC.d_init[0] d = SHPC.d_init[0]
print("No date option, plotting first date of first slice:", d) print("No date option, plotting first date of first slice:", d)
i_slice = 0
else: else:
d = args.date d = args.date
i_slice = SHPC.get_slice(d)
for orientation in ["Anticyclones", "Cyclones"]: for orientation in ["Anticyclones", "Cyclones"]:
ishape_list = select_ishapes( i_slice, ishape_list = select_ishapes(
d, SHPC, i_slice, orientation=orientation, window=args.window d, SHPC, orientation=orientation, window=args.window
) )
if len(ishape_list) == 0: if len(ishape_list) == 0:
print(f"{orientation}: No eddy found") print(f"{orientation}: No eddy found")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment