Interpolation is used to evaluate the state of particles within an environmental field (e.g., temperature or velocity) at their specific real-time and spatial positions (t, z, y, x).
In Parcels, you can evaluate a field at particle positions using square bracket notation. This is a shorthand that provides the grid search algorithm with the particles' current positions as a 'first guess' for element indices, making the operation efficient.
If you need to sample at locations or times that are not necessarily close to the particles' current positions, you can pass specific coordinates, but note that this may be slower for curvilinear or unstructured grids as it requires a full grid search.
# Efficiently evaluate field at particle positions
particles.temperature = fieldset.temperature[particles]
# Shorthand for:
# particles.temperature = fieldset.temperature[particles.t, particles.z, particles.y, particles.x, particles]
# Sample at arbitrary locations (potentially slower for complex grids)
particles.temperature = fieldset.temperature[t, z, y, x]