@@ -41,7 +41,7 @@ def _deal_with_errors(error, key, vector_type: VectorType):
4141 elif isinstance (key [- 1 ], KernelParticle ):
4242 key [- 1 ].state = AllParcelsErrorCodes [type (error )]
4343 else :
44- raise RuntimeError (f"{ error } . Error could not be handled because particle was not part of the Field Sampling." )
44+ raise RuntimeError (f"{ error } . Error could not be handled because particles was not part of the Field Sampling." )
4545
4646 if vector_type and "3D" in vector_type :
4747 return (0 , 0 , 0 )
@@ -205,7 +205,7 @@ def _check_velocitysampling(self):
205205 stacklevel = 2 ,
206206 )
207207
208- def eval (self , time : datetime , z , y , x , particle = None , applyConversion = True ):
208+ def eval (self , time : datetime , z , y , x , particles = None , applyConversion = True ):
209209 """Interpolate field values in space and time.
210210
211211 We interpolate linearly in time and apply implicit unit
@@ -219,11 +219,11 @@ def eval(self, time: datetime, z, y, x, particle=None, applyConversion=True):
219219
220220 tau , ti = _search_time_index (self , time )
221221 position = self .grid .search (z , y , x , ei = _ei )
222- _update_particle_states_position (particle , position )
222+ _update_particle_states_position (particles , position )
223223
224224 value = self ._interp_method (self , ti , position , tau , time , z , y , x )
225225
226- _update_particle_states_interp_value (particle , value )
226+ _update_particle_states_interp_value (particles , value )
227227
228228 if applyConversion :
229229 value = self .units .to_target (value , z , y , x )
@@ -287,7 +287,7 @@ def vector_interp_method(self, method: Callable):
287287 _assert_same_function_signature (method , ref = ZeroInterpolator_Vector , context = "Interpolation" )
288288 self ._vector_interp_method = method
289289
290- def eval (self , time : datetime , z , y , x , particle = None , applyConversion = True ):
290+ def eval (self , time : datetime , z , y , x , particles = None , applyConversion = True ):
291291 """Interpolate field values in space and time.
292292
293293 We interpolate linearly in time and apply implicit unit
@@ -301,7 +301,7 @@ def eval(self, time: datetime, z, y, x, particle=None, applyConversion=True):
301301
302302 tau , ti = _search_time_index (self .U , time )
303303 position = self .grid .search (z , y , x , ei = _ei )
304- _update_particle_states_position (particle , position )
304+ _update_particle_states_position (particles , position )
305305
306306 if self ._vector_interp_method is None :
307307 u = self .U ._interp_method (self .U , ti , position , tau , time , z , y , x )
@@ -319,7 +319,7 @@ def eval(self, time: datetime, z, y, x, particle=None, applyConversion=True):
319319 (u , v , w ) = self ._vector_interp_method (self , ti , position , tau , time , z , y , x , applyConversion )
320320
321321 for vel in (u , v , w ):
322- _update_particle_states_interp_value (particle , vel )
322+ _update_particle_states_interp_value (particles , vel )
323323
324324 if applyConversion and ("3D" in self .vector_type ):
325325 w = self .W .units .to_target (w , z , y , x ) if self .W else 0.0
@@ -339,34 +339,34 @@ def __getitem__(self, key):
339339 return _deal_with_errors (error , key , vector_type = self .vector_type )
340340
341341
342- def _update_particle_states_position (particle , position ):
342+ def _update_particle_states_position (particles , position ):
343343 """Update the particle states based on the position dictionary."""
344- if particle : # TODO also support uxgrid search
344+ if particles : # TODO also support uxgrid search
345345 for dim in ["X" , "Y" ]:
346346 if dim in position :
347- particle .state = np .maximum (
348- np .where (position [dim ][0 ] == - 1 , StatusCode .ErrorOutOfBounds , particle .state ), particle .state
347+ particles .state = np .maximum (
348+ np .where (position [dim ][0 ] == - 1 , StatusCode .ErrorOutOfBounds , particles .state ), particles .state
349349 )
350- particle .state = np .maximum (
351- np .where (position [dim ][0 ] == GRID_SEARCH_ERROR , StatusCode .ErrorGridSearching , particle .state ),
352- particle .state ,
350+ particles .state = np .maximum (
351+ np .where (position [dim ][0 ] == GRID_SEARCH_ERROR , StatusCode .ErrorGridSearching , particles .state ),
352+ particles .state ,
353353 )
354354 if "Z" in position :
355- particle .state = np .maximum (
356- np .where (position ["Z" ][0 ] == RIGHT_OUT_OF_BOUNDS , StatusCode .ErrorOutOfBounds , particle .state ),
357- particle .state ,
355+ particles .state = np .maximum (
356+ np .where (position ["Z" ][0 ] == RIGHT_OUT_OF_BOUNDS , StatusCode .ErrorOutOfBounds , particles .state ),
357+ particles .state ,
358358 )
359- particle .state = np .maximum (
360- np .where (position ["Z" ][0 ] == LEFT_OUT_OF_BOUNDS , StatusCode .ErrorThroughSurface , particle .state ),
361- particle .state ,
359+ particles .state = np .maximum (
360+ np .where (position ["Z" ][0 ] == LEFT_OUT_OF_BOUNDS , StatusCode .ErrorThroughSurface , particles .state ),
361+ particles .state ,
362362 )
363363
364364
365- def _update_particle_states_interp_value (particle , value ):
365+ def _update_particle_states_interp_value (particles , value ):
366366 """Update the particle states based on the interpolated value, but only if state is not an Error already."""
367- if particle :
368- particle .state = np .maximum (
369- np .where (np .isnan (value ), StatusCode .ErrorInterpolation , particle .state ), particle .state
367+ if particles :
368+ particles .state = np .maximum (
369+ np .where (np .isnan (value ), StatusCode .ErrorInterpolation , particles .state ), particles .state
370370 )
371371
372372
0 commit comments