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

Remove argument `i_slice` of `ishape_range`

Return `i_slice` instead. Since getting `i_slice` is now cheaper.
parent 24f01d07
No related branches found
No related tags found
No related merge requests found
...@@ -254,16 +254,16 @@ class SHPC_class: ...@@ -254,16 +254,16 @@ class SHPC_class:
return i_slice, ishape return i_slice, ishape
def ishape_range(self, date, i_slice, orientation): def ishape_range(self, date, orientation):
"""Returns an empty list if ishape_last was not found and could not be """Returns an empty list if ishape_last was not found and could not be
created. Crashes if i_slice is not None and date is not in i_slice. created.
""" """
i_slice, ishape_start = self.comp_ishape(date, 1, orientation, i_slice) i_slice, ishape_start = self.comp_ishape(date, 1, orientation)
if ishape_start is None: if ishape_start is None:
return [] return i_slice, []
else: else:
ishape_stop = ( ishape_stop = (
self._ishape_last[i_slice][orientation][ self._ishape_last[i_slice][orientation][
...@@ -271,7 +271,7 @@ class SHPC_class: ...@@ -271,7 +271,7 @@ class SHPC_class:
] ]
+ 1 + 1
) )
return range(ishape_start, ishape_stop) return i_slice, range(ishape_start, ishape_stop)
def in_window(point, window): def in_window(point, window):
......
...@@ -36,7 +36,7 @@ def select_ishapes( ...@@ -36,7 +36,7 @@ def select_ishapes(
""" """
ishape_list = SHPC.ishape_range(d, i_slice, orientation) i_slice, ishape_list = SHPC.ishape_range(d, orientation)
if window is None: if window is None:
ishape_list_filt = ishape_list ishape_list_filt = ishape_list
......
...@@ -46,7 +46,7 @@ for orientation in ["Anticyclones", "Cyclones"]: ...@@ -46,7 +46,7 @@ for orientation in ["Anticyclones", "Cyclones"]:
for my_date in range(args.date_start, date_stop): for my_date in range(args.date_start, date_stop):
eddy_index = 0 eddy_index = 0
for ishape in SHPC.ishape_range(my_date, i_slice, orientation): for ishape in SHPC.ishape_range(my_date, orientation)[1]:
eddy_index += 1 eddy_index += 1
for sr, w in zip([extremum.shapeRecord(ishape), for sr, w in zip([extremum.shapeRecord(ishape),
......
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