vector_derivatives#

rojak.core.derivatives.vector_derivatives(u, v, units, components=None, geod=None, crs=None)[source]#

Horizontal derivatives of a 2D velocity field, corrected for map projection distortion

Rather than directly correcting each raw Cartesian derivative by the corresponding ProjectionCorrectionFactors component (as GradientMode.GEOSPATIAL does in spatial_gradient()), this also accounts for the spatial variation of the projection’s scale factors themselves, coupling each derivative to the velocity component perpendicular to it.

Parameters:
  • u (DataArray) – x-component of the vector field. Must have "longitude" and "latitude" dimensions.

  • v (DataArray) – y-component of the vector field. Must have "longitude" and "latitude" dimensions.

  • units (LatLonUnits) – Units u/v’s latitude/longitude coordinates are expressed in

  • components (list[VelocityDerivative] | None) – Derivatives to compute. Defaults to all four of VelocityDerivative.

  • geod (Geod | None) – Geodesic used to compute the nominal grid spacing. Defaults to a WGS84 ellipsoid.

  • crs (CRS | None) – Coordinate reference system used to compute projection correction factors. Defaults to plain latitude/longitude.

Returns:

Mapping from each requested VelocityDerivative to its computed value

Return type:

dict[VelocityDerivative, DataArray]