Kinematic Calculations

metpy.calc.kinematics.v_vorticity(u, v, dx, dy)

Calculate the vertical vorticity of the horizontal wind.

The grid must have a constant spacing in each direction.

Parameters:
  • u ((X, Y) ndarray) – x component of the wind
  • v ((X, Y) ndarray) – y component of the wind
  • dx (float) – The grid spacing in the x-direction
  • dy (float) – The grid spacing in the y-direction
Returns:

(X, Y) ndarray – vertical vorticity

metpy.calc.kinematics.h_convergence(u, v, dx, dy)

Calculate the horizontal convergence of the horizontal wind.

The grid must have a constant spacing in each direction.

Parameters:
  • u ((X, Y) ndarray) – x component of the wind
  • v ((X, Y) ndarray) – y component of the wind
  • dx (float) – The grid spacing in the x-direction
  • dy (float) – The grid spacing in the y-direction
Returns:

(X, Y) ndarray – The horizontal convergence

metpy.calc.kinematics.convergence_vorticity(u, v, dx, dy)

Calculate the horizontal convergence and vertical vorticity of the horizontal wind.

The grid must have a constant spacing in each direction.

Parameters:
  • u ((X, Y) ndarray) – x component of the wind
  • v ((X, Y) ndarray) – y component of the wind
  • dx (float) – The grid spacing in the x-direction
  • dy (float) – The grid spacing in the y-direction
Returns:

convergence, vorticity (tuple of (X, Y) ndarrays) – The horizontal convergence and vertical vorticity, respectively

Notes

This is a convenience function that will do less work than calculating the horizontal convergence and vertical vorticity separately.

metpy.calc.kinematics.advection(scalar, wind, deltas)

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 N 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) – A (length N) sequence containing the grid spacing in each dimension.
Returns:

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

metpy.calc.kinematics.geostrophic_wind(heights, f, dx, dy)

Calculate the geostrophic wind given from the heights or geopotential.

Parameters:
  • heights ((x,y) ndarray) – The height field, given with leading dimensions of x by y. There can be trailing dimensions on the array.
  • f (array_like) – The coriolis parameter. This can be a scalar to be applied everywhere or an array of values.
  • dx (scalar) – The grid spacing in the x-direction
  • dy (scalar) – The grid spacing in the y-direction
Returns:

A 2-item tuple of arrays – A tuple of the u-component and v-component of the geostrophic wind.