@@ -91,7 +91,7 @@ def advect(x, y, c, t0, n_days, u_name="u", v_name="v"):
91
91
92
92
93
93
def particle_candidate_step (
94
- t_start , contours_start , contours_end , space_step , dt , c , ** kwargs
94
+ t_start , contours_start , contours_end , space_step , dt , c , day_fraction = 6 , ** kwargs
95
95
):
96
96
"""Select particles within eddies, advect them, return target observation and associated percentages.
97
97
For one time step.
@@ -102,13 +102,17 @@ def particle_candidate_step(
102
102
:param float space_step: step between 2 particles
103
103
:param int dt: duration of advection
104
104
:param `~py_eddy_tracker.dataset.grid.GridCollection` c: GridCollection with speed for particles
105
+ :param int day_fraction: fraction of day
105
106
:params dict kwargs: dict of params given to advection
106
107
:return (np.array,np.array): return target index and percent associate
107
108
"""
109
+ # In case of zarr array
110
+ contours_start = [i [:] for i in contours_start ]
111
+ contours_end = [i [:] for i in contours_end ]
108
112
# Create particles in start contour
109
113
x , y , i_start = create_meshed_particles (* contours_start , space_step )
110
114
# Advect particles
111
- kw = dict (nb_step = 6 , time_step = 86400 / 6 )
115
+ kw = dict (nb_step = day_fraction , time_step = 86400 / day_fraction )
112
116
p = c .advect (x , y , t_init = t_start , ** kwargs , ** kw )
113
117
for _ in range (dt ):
114
118
_ , x , y = p .__next__ ()
0 commit comments