second_derivative

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

Calculate the second derivative of a grid of values.

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

Either x or delta must be specified.

Either x or delta must be specified. This uses 3 points to calculate the derivative, using forward or backward at the edges of the grid as appropriate, and centered elsewhere. The irregular spacing is handled explicitly, using the formulation as specified by [Bowen2005].

Parameters:
  • f (array-like) – Array of values of which to calculate the derivative
  • axis (int, optional) – The array axis along which to take the derivative. Defaults to 0.
  • x (array-like, optional) – The coordinate values corresponding to the grid points in f.
  • delta (array-like, optional) – Spacing between the grid points in f. There should be one item less than the size of f along axis.
Returns:

array-like – The second derivative calculated along the selected axis.