torch_harmonics.distributed.DistributedQuadratureS2#

class torch_harmonics.distributed.DistributedQuadratureS2(
img_shape,
grid='equiangular',
normalize=False,
)[source]#

Bases: Module

Distributed scalar quadrature on \(S^2\) for integrating spherical fields on a latitude/longitude grid, with data and weights split across polar and azimuth communicator groups.

See also

torch_harmonics.QuadratureS2

Serial counterpart with full mathematical description and parameter documentation.

Parameters:
  • img_shape (Tuple[int]) – Spatial grid shape (nlat, nlon).

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

  • normalize (bool, optional) – If True, divides weights by 4π to return an average instead of an integral, by default False.

Returns:

Tensor of shape (..., channels) containing the global integral over the last two spatial dimensions (reduced across communicator groups).

Return type:

torch.Tensor

Raises:

ValueError – If an unknown grid type is provided.