gradient

metpy.calc.gradient(f, **kwargs)[source]

Calculate the gradient of a grid of values.

Works for both regularly-spaced data, and grids with varying spacing.

Either x or deltas must be specified.

Parameters:
  • f (array-like) – Array of values of which to calculate the derivative
  • x (array-like, optional) – Sequence of arrays containing the coordinate values corresponding to the grid points in f in axis order.
  • deltas (array-like, optional) – Sequence of arrays or scalars that specify the spacing between the grid points in f in axis order. There should be one item less than the size of f along axis.
Returns:

array-like – The first derivative calculated along each axis in the original array

See also

laplacian()

Examples using metpy.calc.gradient