pvtend.sh_ops.gradient_sh

pvtend.sh_ops.gradient_sh(field: ndarray, lat: ndarray, lon: ndarray, R_earth: float = 6371000.0) Tuple[ndarray, ndarray][source]

Physical gradient of a scalar via spherical harmonics.

Computes (∂f/∂x, ∂f/∂y) in m⁻¹ × [field] units. Closes cleanly at both poles. NH-only inputs are auto-mirrored (scalar parity) and the result is sliced back.

Parameters:
  • field – Scalar field, shape (nlat, nlon).

  • lat – Latitudes in degrees, ascending.

  • lon – Longitudes in degrees in [0, 360).

  • R_earth – Earth radius in metres.

Returns:

Tuple (df_dx, df_dy) each with the same shape as field.