advect

Routines for advecting ice parcels using velocity grids

Source code

General Attributes and Methods

class IceAdvect.Advect(ds, **kwargs)[source]

Data class for advecting ice parcels using velocity estimates

Attributes:
ds: xarray.DataTree

xarray DataTree of velocity data

x: np.ndarray

x-coordinates

y: np.ndarray

y-coordinates

t: np.ndarray

time coordinates

x0: np.ndarray or NoneType, default None

Final x-coordinate after advection

y0: np.ndarray or NoneType, default None

Final y-coordinate after advection

t0: np.ndarray or float, default 0.0

Ending time for advection

ds: xarray.Dataset

xarray Dataset of velocity data

integrator: str
Advection function
  • 'euler'

  • 'RK4'

  • 'RKF45'

method: str, default ‘linear’
Interpolation method for velocities
  • 'linear', 'nearest': xarray interpolation method

time_units: str, default ‘seconds’

Units for input time coordinates

fill_value: float or NoneType, default np.nan

invalid value for output data

run(**kwargs)[source]

Runs the advection of parcels using specified parameters

Returns:
x0: np.ndarray

Final x-coordinate after advection

y0: np.ndarray

Final y-coordinate after advection

interp(x: ndarray, y: ndarray, t: float | ndarray = 0.0, **kwargs)[source]

Interpolates velocity data to specified coordinates

Parameters:
x: np.ndarray

x-coordinates

y: np.ndarray

y-coordinates

t: float or np.ndarray, default 0.0

time coordinates

kwargs: dict

keyword arguments for xarray interpolation

translate(**kwargs)[source]

Translates a parcel using an advection function

Parameters:
integrator: str

Advection function

  • 'euler'

  • 'RK4'

  • 'RKF45'

method: str

Interpolation method from xarray

  • 'linear': linear interpolation for regular grids

  • 'nearest': nearest-neighbor interpolation

step: int or float, default 86400

Temporal step size for advection (in seconds)

N: int or NoneType, default None

Number of integration steps

Default is determined based on the temporal step size

t0: float, default 0.0

Ending time for advection

euler(**kwargs)[source]

Advects parcels using an Explicit Euler integration

Parameters:
N: int, default 1

Number of integration steps

RK4(**kwargs)[source]

Advects parcels using a fourth-order Runge-Kutta integration

Parameters:
N: int, default 1

Number of integration steps

RKF45(**kwargs)[source]

Advects parcels using a Runge-Kutta-Fehlberg 4(5) integration

Parameters:
N: int, default 1

Number of integration steps

RFK45_interp(xi: ndarray, yi: ndarray, dt: ndarray, **kwargs)[source]

Calculates X and Y velocities for Runge-Kutta-Fehlberg 4(5) method

Parameters:
xi: np.ndarray

x-coordinates

yi: np.ndarray

y-coordinates

dt: np.ndarray

integration time step size

t: np.ndarray or NoneType, default None

time coordinates

property distance

Calculates displacement between the start and end coordinates

Returns:
dist: np.ndarray

Eulerian distance between start and end points