pvtend.helmholtz_decomposition

pvtend.helmholtz_decomposition(u: ndarray, v: ndarray, lat: ndarray, lon: ndarray, R_earth: float = 6371000.0, method: str = 'spectral', solver_kw: dict | None = None) dict[str, ndarray][source]

Helmholtz decomposition on a lat-lon grid.

By default (method="spectral"), dispatches to pvtend.sh_ops.helmholtz_sh(), which uses pyspharm / windspharm to compute ζ, δ, ψ, χ via spherical harmonics. NH-only inputs are auto-detected and parity-mirrored (u even, v odd) onto the full sphere before transforming. The legacy finite-difference + spherical-FFT-Poisson path remains available via method="fd".

Parameters:
  • u – Zonal wind [m s⁻¹], shape (nlat, nlon).

  • v – Meridional wind [m s⁻¹], shape (nlat, nlon).

  • lat – Latitude in degrees (ascending), shape (nlat,).

  • lon – Longitude in degrees, shape (nlon,).

  • R_earth – Earth radius [m].

  • method"spectral" (default, recommended) or "fd" (legacy conservative-form spherical-FFT solver).

  • solver_kw – Reserved for future spectral options (e.g. ntrunc, sanity_tol).

Returns:

Dictionary with keys u_rot, v_rot, u_div, v_div, u_har, v_har, chi, psi, vorticity, divergence — each (nlat, nlon).