torch_harmonics.distributed.DistributedInverseRealSHT#

class torch_harmonics.distributed.DistributedInverseRealSHT(
nlat,
nlon,
lmax=None,
mmax=None,
grid='equiangular',
norm='ortho',
csphase=True,
)[source]#

Bases: Module

Distributed version of the inverse (real-valued) SHT. Precomputes Legendre Gauss nodes, weights and associated Legendre polynomials on these nodes.

Distribution scheme. The input tensor has shape (B, C, lmax_local, mmax_local) where spectral degrees and orders are split across the polar and azimuth process groups. All leading dimensions are flattened into N = B * C for redistribution. The forward pass proceeds as follows:

  1. Polar transpose (N ↔ lmax) — trade channel slices for the full degree axis, making l local for the Legendre synthesis.

  2. Legendre synthesis — local matrix multiply with the associated Legendre polynomials, producing latitude points.

  3. Polar transpose (nlat ↔ N) — redistribute so that latitudes are split across polar ranks and channels are local.

  4. Azimuth transpose (N ↔ mmax) — make spectral orders m fully local for the inverse FFT.

  5. Inverse real FFT along the (now local) m / longitude dimension.

  6. Azimuth transpose (nlon ↔ N) — redistribute so that longitudes are split across azimuth ranks.

The output has shape (B, C, nlat_local, nlon_local) with the spatial grid partitioned in the same way as the input spectral modes.

If N < max(polar_group_size, azimuth_group_size), the leading axis is zero-padded before the transposes and the padding is removed afterwards; since the transform is linear this is exact.

See also

torch_harmonics.InverseRealSHT

Serial counterpart with full mathematical description and parameter documentation.

Parameters:
  • nlat (int) – Number of latitude points

  • nlon (int) – Number of longitude points

  • lmax (int) – Maximum spherical harmonic degree

  • mmax (int) – Maximum spherical harmonic order

  • grid (str) – Grid type ("equiangular", "legendre-gauss", "lobatto", "equiangular-trapezoidal"), by default "equiangular"

  • norm (str) – Normalization type ("ortho", "schmidt", "unnorm"), by default "ortho"

  • csphase (bool) – Whether to apply the Condon-Shortley phase factor, by default True

Returns:

Tensor of shape (…, lmax, mmax)

Return type:

torch.Tensor

References

[2], [3]