Skip to content

Add quadratic truncation (TQ) and a TQ21 + PI configuration - #65

Merged
JanStreffing merged 2 commits into
masterfrom
feat/tq21-pi
Oct 7, 2026
Merged

JanStreffing merged 2 commits into
masterfrom
feat/tq21-pi

Conversation

@JanStreffing

Copy link
Copy Markdown
Owner

Adds a third truncation type, quadratic, and a config for the smallest coupled setup: OpenIFS TQ21 with the FESOM2 PI mesh.

Why

T21 runs on the full Gaussian grid N16 (64 x 32). Neither existing rule gives that: linear yields N11 and cubic-octahedral N22.

What changes

  • quadratic truncation: N = (3T + 1) / 4 rounded up, name prefix TQ. The grid description of a full Gaussian grid is computed from the Gauss-Legendre nodes and cached as f<N>_full.txt, so it does not depend on parsing an ICMGG file.
  • One place for the truncation rules: the TCO/TL prefix and the truncation-to-N rule were repeated in six places. They are now config.truncation_prefix and config.gaussian_number. Linear and cubic-octahedral behave as before.
  • configs/TQ21_PI.yaml: ECMWF's T21 test case (experiment epc8, shipped with the OpenIFS ifs-test data) with the PI mesh from fesom2/test/meshes/pi.
  • tests/test_truncation.py.

Tested

  • The test suite passes (24 passed, 41 skipped), run with -o addopts="" because pytest-cov was not installed.
  • python run_ocp_tool.py configs/TQ21_PI.yaml runs all twelve steps in about 10 s and writes the OASIS grids/masks/areas, vegin.nc, the modified ICMGG files, the runoff map and the LPJ-GUESS soil-layer file. A one-day coupled AWI-ESM3 run with these files completed.
  • No existing configuration was re-run, so "linear and cubic-octahedral behave as before" rests on the unit tests and on reading the code.

Known issues seen in the TQ21 run, not addressed here

  • Step 4b fails with grid 'feom' not found in grids.nc, so no rmp_*.nc are written. OASIS generated them at run time instead.
  • Python aborts with double free or corruption on exit, after "processing complete" and after all files are written.

Quadratic truncation uses the full Gaussian grid N = (3T + 1) / 4, so T21
runs on N16 (64 x 32). Neither existing rule gives that: linear yields N11
and cubic-octahedral N22.

The grid description for a full Gaussian grid is computed from the
Gauss-Legendre nodes and cached as f<N>_full.txt, so it does not depend on
parsing an ICMGG file.

The TCO/TL prefix and the truncation-to-N rule were repeated in six places;
they now live in config.truncation_prefix and config.gaussian_number.

configs/TQ21_PI.yaml pairs ECMWF's T21 test case (experiment epc8) with the
FESOM2 PI mesh, the smallest coupled setup, for laptops and CI.
Python aborted with "double free or corruption" (exit code 134) at
interpreter exit whenever ecCodes was loaded before pyproj: at the end of
run_ocp_tool.py, in the CI import check and in the Sphinx build, each after
finishing its work. The ecCodes wheel (eccodeslib) and the pyproj wheel
bundle native libraries whose teardown conflicts in that order.

Importing pyproj in the package __init__ fixes the order for every entry
point. Reproduced with eccodes 2.49.0 and pyproj 3.8.0:
  python -c "import gribapi, pyproj"   aborts
  python -c "import pyproj, gribapi"   exits 0

CI and the documentation build have failed this way on master since
2026-09-22; this is independent of the TQ change in this branch.
@JanStreffing
JanStreffing merged commit 3d934d6 into master Oct 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant