xoa.grid.gradient#
- xoa.grid.gradient(da, dim, coord=None)[source]#
Derivative along a dimension with respect to a coordinate, at the grid centers
The result is
diff(da, dim) / diff(coord, dim), so its size is reduced by one along dim and its coordinates are centered like withdiff().- Parameters:
dim (str)
coord (xarray.DataArray, str, None) – Numeric coordinate, or its name, that is either 1D along dim or has the dimensions of da, like depths on sigma levels. It defaults to the coordinate of dim.
- Returns:
xarray.DataArray, xarray.Dataset
See also