spatial_gradient#
- rojak.core.derivatives.spatial_gradient(array, units, gradient_mode, dimension=None, geod=None, crs=None)[source]#
Spatial gradient of a scalar field on a latitude/longitude grid
- Parameters:
array (DataArray) – Field to compute the gradient of. Must have
"longitude"and"latitude"dimensions.units (LatLonUnits) – Units
array’s latitude/longitude coordinates are expressed ingradient_mode (GradientMode) – Whether to correct for map projection distortion (
GradientMode.GEOSPATIAL) or not (GradientMode.CARTESIAN)dimension (CartesianDimension | None) – If provided, only compute the gradient along this dimension. Defaults to both x and y.
geod (Geod | None) – Geodesic used to compute the nominal grid spacing (see
nominal_grid_spacing()). Defaults to a WGS84 ellipsoid.crs (CRS | None) – Coordinate reference system used to compute projection correction factors when
gradient_modeisGradientMode.GEOSPATIAL. Defaults to plain latitude/longitude.
- Returns:
Mapping with
"dfdx"and/or"dfdy"keys (depending ondimension) to the corresponding component of the gradient- Return type: