From 24f01d07fed02726f69ca15001c8e5b998d43476 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Tue, 7 May 2024 15:41:29 +0200 Subject: [PATCH] Use `_i_slice` instead of bisection to get slice --- Common/util_eddies.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Common/util_eddies.py b/Common/util_eddies.py index fdb641c6..7f09f8ac 100644 --- a/Common/util_eddies.py +++ b/Common/util_eddies.py @@ -1,7 +1,6 @@ import math from os import path import sys -import bisect import os import shapefile @@ -219,9 +218,8 @@ class SHPC_class: return ishape_last def get_slice(self, date_index): - i_slice = bisect.bisect(self.d_init, date_index) - 1 - assert i_slice >= 0 - return i_slice + assert date_index >= self.d_init[0] + return self._i_slice[date_index - self.d_init[0]] def comp_ishape(self, date, eddy_index, orientation, i_slice=None): """Compute the location in the shapefiles: return `(i_slice, ishape)`. -- GitLab