deriv_half

deriv_half(x, y, /, order=1, axis=0)[source]

Return an arbitrary order finite difference approximation by taking successive half-level differences. This will change both the length of the data and the x coordinates of the data. While this is not always practical, it retains data resolution better than the centered methods.

Parameters
  • x (float or array-like) – The step size, a 1-d coordinate vector, or an array of coordinates matching the shape of y.

  • y (array-like) – The data.

  • order (int, optional) – The order of the derivative. Default is 1.

axisint, optional

Axis along which derivative is taken.

dimstr, optional

For `xarray.DataArray` input only. Named dimension along which the derivative is taken.

Returns

  • x (array-like) – The new x coordinates.

  • diff (array-like) – The “derivative”.