advection

metpy.calc.advection(scalar, wind, deltas)[source]

Calculate the advection of a scalar field by the wind.

The order of the dimensions of the arrays must match the order in which the wind components are given. For example, if the winds are given [u, v], then the scalar and wind arrays must be indexed as x,y (which puts x as the rows, not columns).

Parameters
  • scalar (N-dimensional array) – Array (with N-dimensions) with the quantity to be advected.

  • wind (sequence of arrays) – Length M sequence of N-dimensional arrays. Represents the flow, with a component of the wind in each dimension. For example, for horizontal advection, this could be a list: [u, v], where u and v are each a 2-dimensional array.

  • deltas (sequence of float or ndarray) – A (length M) sequence containing the grid spacing(s) in each dimension. If using arrays, in each array there should be one item less than the size of scalar along the applicable axis.

  • dim_order (str or None, optional) – The ordering of dimensions in passed in arrays. Can be one of None, 'xy', or 'yx'. 'xy' indicates that the dimension corresponding to x is the leading dimension, followed by y. 'yx' indicates that x is the last dimension, preceded by y. None indicates that the default ordering should be assumed, which is ‘yx’. Can only be passed as a keyword argument, i.e. func(…, dim_order=’xy’).

Returns

N-dimensional array – An N-dimensional array containing the advection at all grid points.