first_derivative¶
-
metpy.calc.
first_derivative
(f, **kwargs)[source]¶ Calculate the first derivative of a grid of values.
Works for both regularly-spaced data and grids with varying spacing.
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. Should be one item less than the size of f along axis.
Returns: array-like – The first derivative calculated along the selected axis.
See also