Skip to content

Commit 1bab706

Browse files
Updating field.eval docstrings
1 parent 8cd02cb commit 1bab706

1 file changed

Lines changed: 49 additions & 8 deletions

File tree

src/parcels/_core/field.py

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,27 @@ def _check_velocitysampling(self):
187187
def eval(self, time: datetime, z, y, x, particles=None):
188188
"""Interpolate field values in space and time.
189189
190-
We interpolate linearly in time and apply implicit unit
191-
conversion to the result. Note that we defer to
192-
scipy.interpolate to perform spatial interpolation.
190+
Parameters
191+
----------
192+
time : float or array-like
193+
Time(s) at which to sample the field.
194+
z, y, x : scalar or array-like
195+
Vertical (z), latitudinal (y) and longitudinal (x) positions to sample.
196+
Inputs are promoted to 1-D arrays internally.
197+
particles : ParticleSet, optional
198+
If provided, used to associate results with particle indices and to
199+
update particle state and element indices. Defaults to None.
200+
201+
Returns
202+
-------
203+
(value) : float or array-like
204+
The interpolated value as a numpy.ndarray (or scalar) with the same
205+
broadcasted shape as the input coordinates.
206+
207+
Notes
208+
-----
209+
- Particle states are updated for out-of-bounds, search errors and NaN
210+
interpolation values.
193211
"""
194212
if particles is None:
195213
_ei = None
@@ -270,11 +288,34 @@ def vector_interp_method(self, method: Callable):
270288
self._vector_interp_method = method
271289

272290
def eval(self, time: datetime, z, y, x, particles=None, apply_conversion=True):
273-
"""Interpolate field values in space and time.
274-
275-
We interpolate linearly in time and apply implicit unit
276-
conversion to the result. Note that we defer to
277-
scipy.interpolate to perform spatial interpolation.
291+
"""Interpolate vectorfield values in space and time.
292+
293+
Parameters
294+
----------
295+
time : float or array-like
296+
Time(s) at which to sample the field.
297+
z, y, x : scalar or array-like
298+
Vertical (z), latitudinal (y) and longitudinal (x) positions to sample.
299+
Inputs are promoted to 1-D arrays internally.
300+
particles : ParticleSet, optional
301+
If provided, used to associate results with particle indices and to
302+
update particle state and element indices. Defaults to None.
303+
apply_conversion : bool, default True
304+
If True and the underlying grid is spherical, the horizontal velocity
305+
components (U, V) are converted from m s^-1 to degrees s^-1.
306+
If False, raw interpolated values are returned.
307+
308+
Returns
309+
-------
310+
(u, v, (w,)) : tuple or array-like
311+
The interpolated velocity components: (u, v) for 2D vectors or (u, v, w)
312+
for 3D vectors. Each element is a numpy.ndarray (or scalar) with the same
313+
broadcasted shape as the input coordinates.
314+
315+
Notes
316+
-----
317+
- Particle states are updated for out-of-bounds, search errors and NaN
318+
interpolation values.
278319
"""
279320
if particles is None:
280321
_ei = None

0 commit comments

Comments
 (0)