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

Call `compute_bbox` one date at a time

Preparing for dates at different slices, which will need different
readers.
parent 5f2375e1
No related branches found
No related tags found
No related merge requests found
......@@ -12,17 +12,16 @@ def bbox_union(b1, b2):
return [min(b1[0], b2[0]), min(b1[1], b2[1]), max(b1[2], b2[2]),
max(b1[3], b2[3])]
def compute_bbox(ishape_lists, reader_outer):
"""ishape_lists should be a dictionary."""
def compute_bbox(ishape_list, reader_outer):
"""ishape_list should be a list."""
bbox = None
for ishape_list in ishape_lists.values():
for ishape in ishape_list:
try:
bbox = bbox_union(bbox, reader_outer.shape(ishape).bbox)
except AttributeError:
pass
for ishape in ishape_list:
try:
bbox = bbox_union(bbox, reader_outer.shape(ishape).bbox)
except AttributeError:
pass
return bbox
......@@ -59,10 +58,11 @@ def anim_eddies(fig, ax, SHPC, window, d_min, d_max, light):
bbox = None
for orientation in ["Anticyclones", "Cyclones"]:
b2 = compute_bbox(ishape_lists_all[orientation],
for d in range(d_min, d_max + 1):
b2 = compute_bbox(ishape_lists_all[orientation][d],
SHPC.get_reader(0, orientation,
"outermost_contour"))
bbox = bbox_union(bbox, b2)
bbox = bbox_union(bbox, b2)
else:
bbox = window
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment