Skip to content

Commit 89ae3ff

Browse files
author
adelepoulle
committed
Bug fix in nearest_contour_index x was replace by y :(
1 parent 4d09d4e commit 89ae3ff

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/py_eddy_tracker/tools.pyx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def poly_contain_poly(
147147
xy_poly_in[i_elt, 1],
148148
xy_poly_out
149149
)
150-
if wn ==0:
150+
if wn == 0:
151151
return False
152152
return True
153153

@@ -273,13 +273,14 @@ def distance_matrix(
273273
@wraparound(False)
274274
@boundscheck(False)
275275
cdef dist_array_size(
276-
DTYPE_ui l_i,
276+
DTYPE_ui i_start,
277277
DTYPE_ui nb_c_per_l,
278278
DTYPE_ui * nb_pt_per_c,
279279
DTYPE_ui * c_i
280280
):
281-
cdef DTYPE_ui i_elt, i_start, i_end, nb_pts
282-
i_start = l_i
281+
"""Give slice to select data
282+
"""
283+
cdef DTYPE_ui i_elt, i_end, nb_pts
283284
i_end = i_start + nb_c_per_l
284285
nb_pts = 0
285286

@@ -302,6 +303,8 @@ def index_from_nearest_path(
302303
DTYPE_coord xpt,
303304
DTYPE_coord ypt,
304305
):
306+
"""Get index from nearest path
307+
"""
305308
cdef DTYPE_ui i_elt
306309
cdef DTYPE_ui nearesti, nb_contour
307310

@@ -319,7 +322,7 @@ def index_from_nearest_path(
319322
)
320323

321324
nearesti = nearest_contour_index(
322-
& y_value[0],
325+
& x_value[0],
323326
& y_value[0],
324327
xpt,
325328
ypt,
@@ -344,6 +347,8 @@ cdef nearest_contour_index(
344347
DTYPE_ui start,
345348
DTYPE_ui end,
346349
):
350+
"""Give index fron the nearest pts
351+
"""
347352
cdef DTYPE_ui i_elt, i_ref
348353
cdef DTYPE_coord dist, dist_ref
349354
i_ref = start
@@ -353,5 +358,4 @@ cdef nearest_contour_index(
353358
if dist < dist_ref:
354359
dist_ref = dist
355360
i_ref = i_elt
356-
357361
return i_ref - start

0 commit comments

Comments
 (0)