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

Use `_i_slice` instead of bisection to get slice

parent 6c4852ea
No related branches found
No related tags found
No related merge requests found
import math import math
from os import path from os import path
import sys import sys
import bisect
import os import os
import shapefile import shapefile
...@@ -219,9 +218,8 @@ class SHPC_class: ...@@ -219,9 +218,8 @@ class SHPC_class:
return ishape_last return ishape_last
def get_slice(self, date_index): def get_slice(self, date_index):
i_slice = bisect.bisect(self.d_init, date_index) - 1 assert date_index >= self.d_init[0]
assert i_slice >= 0 return self._i_slice[date_index - self.d_init[0]]
return i_slice
def comp_ishape(self, date, eddy_index, orientation, i_slice=None): def comp_ishape(self, date, eddy_index, orientation, i_slice=None):
"""Compute the location in the shapefiles: return `(i_slice, ishape)`. """Compute the location in the shapefiles: return `(i_slice, 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