Epic: Spherical harmonics rewrite (stable Legendre tables, spectral vector calculus, SHTns-style storage)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- jupyter-notebook, python
- Domain
- backend-api-design, performance, tooling
Research direction
The work is in the spectraldiffx/_src/spherical/ module. Start by reading the child issues #96 through #101 to understand the specific defects. Examine the current Legendre table construction and transform code. Verify correctness with existing tests for quadrature, orthonormality, and transforms. The goal is a coherent rewrite that fixes critical bugs, enables JIT compilation, and adopts an efficient storage layout.
Written by the indexing model from the issue text.
Description
Scope
The spherical-harmonics module (spectraldiffx/_src/spherical/) has two critical defects that make it unusable above T85 and wrong for any field with odd zonal wavenumber, plus a storage layout that is 8x larger than necessary and cannot be jitted in the GFD solvers. These are best fixed as one coherent piece of work because they all touch the same table-construction and transform code.
What is verified correct today and must be preserved: Gauss–Legendre quadrature and weights; discrete orthonormality of the basis (Gram off-diagonal 8e-17); forward/inverse round trip of band-limited fields (≤1.2e-11 up to T31, including odd Nx, odd Ny, Nx<2Ny); agreement with scipy.special.sph_harm_y up to a scale factor; Laplacian eigenvalues −l(l+1)/R² (rel. err 4e-11 at R=1, 2, 6.371e6); exact FFT longitude derivative; Poisson/Helmholtz eigenvalue inversion (2e-13); isotropic filters.
Child issues (in suggested order)
- #96 fix(spherical): every transform returns NaN at T86 and above (
lpmvoverflow) — critical - #97 fix(spherical): θ-derivative wrong for odd m, O(1) non-converging error — critical
- #98 fix(spherical): GFD solvers rebuild operators per call and cannot be jitted — high
- #99 perf(spherical): SHTns-style Legendre storage (rfft, l≥m, parity, real tables) — high
- #100 fix(spherical): conventions,
radius,weights, deaddealiascode, docstring sign errors — medium - #101 feat(spherical): operators needed by the sphere models (
jacobian,velocity_from_streamfunction, spectra, …) — medium
Items 1–3 are bug fixes and can go first; 4 is the performance rewrite and is easiest once 1–2 have replaced lpmv; 5–6 are API work.
Blocks
- #9 (SWE on a sphere), #11 (QG on a sphere), #13 (barotropic vorticity on a sphere) all need correct vector calculus on the sphere (#97) and the operators in #101.
Related
- #80 (correctness), #82 (JAX-native), #83 (Fourier consolidation), #84 (gaussx integration), #85 (hygiene).
- Dominant language
- Python
- Stars
- 2
- Forks
- 0
- Avg merge
- 8h 13m
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jejjohnson/spectraldiffx
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jejjohnson/spectraldiffx#172 ·
-
epic
Difficulty 1/5 Under an hour Newbie friendliness 62/100
jejjohnson/spectraldiffx#167 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
jejjohnson/spectraldiffx#113 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
jejjohnson/spectraldiffx#105 ·
-
dependencies
Difficulty 4/5 3-5 days Newbie friendliness 45/100
jejjohnson/spectraldiffx#181 ·
All issues in jejjohnson/spectraldiffx
Similar issues
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainers usually reply within 1 day