uxarray.UxDataArray.curl

uxarray.UxDataArray.curl#

UxDataArray.curl(other, **kwargs)#

Computes the curl of a vector field.

Parameters:
  • other (UxDataArray) – The second component of the vector field. This UxDataArray should represent the meridional (v) component, while self represents the zonal (u) component.

  • **kwargs (dict) – Additional keyword arguments (currently unused, reserved for future extensions).

Returns:

curl – The curl of the vector field (u, v), computed as: curl = ∂v/∂x - ∂u/∂y

Return type:

UxDataArray

Notes

The curl is computed using the existing gradient infrastructure. For a 2D vector field V = (u, v), the curl is a scalar field representing the rotation or circulation density at each point.

The curl is computed by: 1. Computing the gradient of the u-component: ∇u = (∂u/∂x, ∂u/∂y) 2. Computing the gradient of the v-component: ∇v = (∂v/∂x, ∂v/∂y) 3. Extracting the relevant components: ∂v/∂x and ∂u/∂y 4. Computing: curl = ∂v/∂x - ∂u/∂y

Requirements: - Both components must be UxDataArray objects - Both must be defined on the same grid - Both must be 1-dimensional (use .isel() for multi-dimensional data) - Data must be face-centered

Example

>>> u_component = uxds["u_wind"]
>>> v_component = uxds["v_wind"]
>>> curl_field = u_component.curl(v_component)