torch_harmonics.truncate_sht#
- torch_harmonics.truncate_sht(nlat, nlon, lmax=None, mmax=None, grid='equiangular')[source]#
Determine the maximum spherical harmonic degree and order for an SHT based on the spatial grid.
When
lmaxormmaxare not provided, they are inferred from the grid resolution. The default truncation for each grid type is chosen so that the associated Legendre polynomials up to the returned degree can be square-integrated exactly by the corresponding quadrature rule:Default latitudinal truncation \(l_{\max}\) for \(N_\theta\) latitude points# Grid type
Includes poles?
Quadrature exactness
Default \(l_{\max}\)
"legendre-gauss"No
\(2 N_\theta - 1\)
\(N_\theta\)
"lobatto"Yes
\(2 N_\theta - 3\)
\(N_\theta - 1\)
"equiangular"/"equiangular-trapezoidal"Yes
\(\approx N_\theta - 1\)
\(\lfloor (N_\theta + 1) / 2 \rfloor\)
The default longitudinal truncation is the Nyquist limit of the uniform longitude grid: \(m_{\max} = \lfloor N_\lambda / 2 \rfloor + 1\).
Finally, a triangular truncation is applied: \(l_{\max} = m_{\max} = \min(l_{\max},\, m_{\max})\), so that every retained degree has a full set of orders.
- Parameters:
nlat (int) – Number of latitude points \(N_\theta\).
nlon (int) – Number of longitude points \(N_\lambda\).
lmax (int, optional) – User-defined maximum spherical harmonic degree (non-inclusive). If not provided, the maximum degree is determined from the latitude grid as shown in the table above.
mmax (int, optional) – User-defined maximum azimuthal harmonic order (non-inclusive). If not provided, set to the Nyquist limit \(\lfloor N_\lambda / 2 \rfloor + 1\).
grid (str, optional) – Grid type (
"legendre-gauss","lobatto","equiangular","equiangular-trapezoidal"), by default"equiangular".
- Returns:
lmax (int) – Maximum spherical harmonic degree (non-inclusive).
mmax (int) – Maximum azimuthal harmonic order (non-inclusive).
- Return type:
Examples
>>> from torch_harmonics import truncate_sht >>> truncate_sht(128, 256, grid="legendre-gauss") (128, 128) >>> truncate_sht(128, 256, grid="lobatto") (127, 127) >>> truncate_sht(128, 256, grid="equiangular") (64, 64)