Skip to content

Commit aeaf27e

Browse files
Updating field.eval docstrings
1 parent b678ccd commit aeaf27e

File tree

1 file changed

+49
-8
lines changed

1 file changed

+49
-8
lines changed

src/parcels/_core/field.py

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

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

0 commit comments

Comments
 (0)