advection#
- metpy.calc.advection(scalar, u=None, v=None, w=None, *, dx=None, dy=None, dz=None, x_dim=- 1, y_dim=- 2, vertical_dim=- 3, parallel_scale=None, meridional_scale=None, latitude=None, longitude=None, crs=None)#
Calculate the advection of a scalar field by the wind.
- Parameters
scalar (
pint.Quantity
orxarray.DataArray
) – Array (with N-dimensions) with the quantity to be advected. Usexarray.DataArray
to have dimension ordering automatically determined, otherwise, use default […, Z, Y, X] ordering or specify *_dim keyword arguments.u (
pint.Quantity
orxarray.DataArray
or None) – N-dimensional arrays with units of velocity representing the flow, with a component of the wind in each dimension. For 1D advection, use 1 positional argument (with dx for grid spacing and x_dim to specify axis if not the default of -1) or use 1 applicable keyword argument (u, v, or w) for proper physical dimension (with corresponding d* for grid spacing and *_dim to specify axis). For 2D/horizontal advection, use 2 positional arguments in order for u and v winds respectively (with dx and dy for grid spacings and x_dim and y_dim keyword arguments to specify axes), or specify u and v as keyword arguments (grid spacings and axes likewise). For 3D advection, likewise use 3 positional arguments in order for u, v, and w winds respectively or specify u, v, and w as keyword arguments (either way, with dx, dy, dz for grid spacings and x_dim, y_dim, and vertical_dim for axes).v (
pint.Quantity
orxarray.DataArray
or None) – N-dimensional arrays with units of velocity representing the flow, with a component of the wind in each dimension. For 1D advection, use 1 positional argument (with dx for grid spacing and x_dim to specify axis if not the default of -1) or use 1 applicable keyword argument (u, v, or w) for proper physical dimension (with corresponding d* for grid spacing and *_dim to specify axis). For 2D/horizontal advection, use 2 positional arguments in order for u and v winds respectively (with dx and dy for grid spacings and x_dim and y_dim keyword arguments to specify axes), or specify u and v as keyword arguments (grid spacings and axes likewise). For 3D advection, likewise use 3 positional arguments in order for u, v, and w winds respectively or specify u, v, and w as keyword arguments (either way, with dx, dy, dz for grid spacings and x_dim, y_dim, and vertical_dim for axes).w (
pint.Quantity
orxarray.DataArray
or None) – N-dimensional arrays with units of velocity representing the flow, with a component of the wind in each dimension. For 1D advection, use 1 positional argument (with dx for grid spacing and x_dim to specify axis if not the default of -1) or use 1 applicable keyword argument (u, v, or w) for proper physical dimension (with corresponding d* for grid spacing and *_dim to specify axis). For 2D/horizontal advection, use 2 positional arguments in order for u and v winds respectively (with dx and dy for grid spacings and x_dim and y_dim keyword arguments to specify axes), or specify u and v as keyword arguments (grid spacings and axes likewise). For 3D advection, likewise use 3 positional arguments in order for u, v, and w winds respectively or specify u, v, and w as keyword arguments (either way, with dx, dy, dz for grid spacings and x_dim, y_dim, and vertical_dim for axes).dx (
pint.Quantity
or None, optional) – Grid spacing in applicable dimension(s). If using arrays, each array should have one item less than the size of scalar along the applicable axis. If scalar is anxarray.DataArray
, these are automatically determined from its coordinates, and are therefore optional. Required if scalar is apint.Quantity
. These are keyword-only arguments.dy (
pint.Quantity
or None, optional) – Grid spacing in applicable dimension(s). If using arrays, each array should have one item less than the size of scalar along the applicable axis. If scalar is anxarray.DataArray
, these are automatically determined from its coordinates, and are therefore optional. Required if scalar is apint.Quantity
. These are keyword-only arguments.dz (
pint.Quantity
or None, optional) – Grid spacing in applicable dimension(s). If using arrays, each array should have one item less than the size of scalar along the applicable axis. If scalar is anxarray.DataArray
, these are automatically determined from its coordinates, and are therefore optional. Required if scalar is apint.Quantity
. These are keyword-only arguments.x_dim (int or None, optional) – Axis number in applicable dimension(s). Defaults to -1, -2, and -3 respectively for (…, Z, Y, X) dimension ordering. If scalar is an
xarray.DataArray
, these are automatically determined from its coordinates. These are keyword-only arguments.y_dim (int or None, optional) – Axis number in applicable dimension(s). Defaults to -1, -2, and -3 respectively for (…, Z, Y, X) dimension ordering. If scalar is an
xarray.DataArray
, these are automatically determined from its coordinates. These are keyword-only arguments.vertical_dim (int or None, optional) – Axis number in applicable dimension(s). Defaults to -1, -2, and -3 respectively for (…, Z, Y, X) dimension ordering. If scalar is an
xarray.DataArray
, these are automatically determined from its coordinates. These are keyword-only arguments.parallel_scale (
pint.Quantity
, optional) – Parallel scale of map projection at data coordinate. Optional ifxarray.DataArray
with latitude/longitude coordinates and MetPy CRS used as input. Also optional if longitude, latitude, and crs are given. If otherwise omitted, calculation will be carried out on a Cartesian, rather than geospatial, grid. Keyword-only argument.meridional_scale (
pint.Quantity
, optional) – Meridional scale of map projection at data coordinate. Optional ifxarray.DataArray
with latitude/longitude coordinates and MetPy CRS used as input. Also optional if longitude, latitude, and crs are given. If otherwise omitted, calculation will be carried out on a Cartesian, rather than geospatial, grid. Keyword-only argument.latitude (
pint.Quantity
, optional) – Latitude of data. Optional ifxarray.DataArray
with latitude/longitude coordinates used as input. Also optional if parallel_scale and meridional_scale are given. If otherwise omitted, calculation will be carried out on a Cartesian, rather than geospatial, grid. Keyword-only argument.longitude (
pint.Quantity
, optional) – Longitude of data. Optional ifxarray.DataArray
with latitude/longitude coordinates used as input. Also optional if parallel_scale and meridional_scale are given. If otherwise omitted, calculation will be carried out on a Cartesian, rather than geospatial, grid. Keyword-only argument.crs (
pyproj.crs.CRS
, optional) – Coordinate Reference System of data. Optional ifxarray.DataArray
with MetPy CRS used as input. Also optional if parallel_scale and meridional_scale are given. If otherwise omitted, calculation will be carried out on a Cartesian, rather than geospatial, grid. Keyword-only argument.
- Returns
pint.Quantity
orxarray.DataArray
– An N-dimensional array containing the advection at all grid points.
Changed in version 1.0: Changed signature from
(scalar, wind, deltas)