xoa.dyn.flow2d#
- xoa.dyn.flow2d(u, v, xy0, duration, step, date=None)[source]#
Integrate gridded 2D velocities from initial positions
Uses a 4th-order Runge-Kutta scheme to advect particles in a 2D velocity field.
- Parameters:
u (xarray.DataArray) – Gridded zonal velocity (must be 2D after squeezing).
v (xarray.DataArray) – Gridded meridional velocity (must be 2D after squeezing).
xy0 (tuple, int, xarray.Dataset) –
Initial positions. Either:
a
(x_array, y_array)tuple of longitudes and latitudes,an
intfor randomly placed particles,a
xarray.Datasetwith longitude and latitude coordinates.
duration (int, numpy.timedelta64) – Total integration time in seconds.
step (int, numpy.timedelta64) – Integration time step in seconds.
date (None, numpy.datetime64) – A reference date for the output time coordinate.
- Returns:
xarray.Dataset – Output positions with
lonandlatcoordinates varying alongtimeandparticlesdimensions.
Example
Advect two particles for 3 hours with a 2-hour time step:
ff = flow2d(u, v, ([1., 2.], [1., 1.5]), np.timedelta64(3, "h"), np.timedelta64(2, "h"), date="2000-01-01")
See also
xoa.interp.grid2loc