Skip to content

Feature/eckit geo - #606

Draft
pmaciel wants to merge 2 commits into
developfrom
feature/eckit-geo
Draft

pmaciel wants to merge 2 commits into
developfrom
feature/eckit-geo

Conversation

@pmaciel

@pmaciel pmaciel commented Oct 14, 2026

Copy link
Copy Markdown
Member

Description

eckit::geo for all supported grids, extended gridSpec, projString and the iterator support for all varieties of scanning modes. eckit::geo is not patched to reproduce legacy issues, some newly discovered; where eccodes differs, the tests say so. Changes:

Gaussian grids, as encoded (GribToSpec)

  • Angles are compared to the precision they are encoded with (angular_precision, including fractions). There are no hardcoded tolerances.
  • The first/last latitudes and longitudes are snapped to the grid (both latitudes and longitudes) within that precision. For example, an F1280 sub-area encoded with longitudeOfFirstGridPointInDegrees=65.039062 (truncated) gets its first column again.
  • Regular Gaussian grids of any number of longitudes: ni, from the encoded increment, unless 4N (this last one is not fully well handled in eccodes or mir).
  • pl is validated (every entry positive). A regional pl is placed on the global latitudes by Gaussian latitude, in either latitude direction.
  • The east longitude fix for global reduced grids also applies to reduced_rotated_gg, reduced_stretched_gg and reduced_stretched_rotated_gg.

Projected and space_view grids, projString

  • albers, lambert, lambert_lam, lambert_azimuthal_equal_area, mercator, polar_stereographic and space_view grids are described on the projection plane:
    • x/y ranges, in grid lengths;
    • a false easting/northing placing the first grid point at (0, 0), to millimetres (for round-off);
    • the projection from (x, y), as PROJ aea, lcc, laea, merc, stere and geos;
    • the message figure (spheres and ellipsoids, including GRIB1 earthIsOblate).
  • Scanning modes, including alternativeRowScanning and jPointsAreConsecutive, are the spec order.
  • With env ECCODES_ECKIT_GEO=1 or ECCODES_ECKIT_GEO=2, projString comes from eckit::geo. It builds the projection only, so the grid geometry doesn't need to be valid. A buffer too small reports the length needed.

Iterator

  • With env ECCODES_ECKIT_GEO=1, eckit::geo iterates these grid types:
    • regular_ll, rotated_ll and reduced_ll;
    • regular_gg, rotated_gg, reduced_gg and reduced_rotated_gg;
    • healpix and unstructured_grid;
    • the projected and space_view types above.
  • Grids with alternativeRowScanning are no longer excluded.
  • The grid is checked against the message: a numberOfDataPoints different from the grid size is an error ("Wrong number of points"), both in the iterator and in gridSpec. Reduced Gaussian sub-areas encoded as PRODGEN/LIBEMOS did (rows rounded differently) are an example.
  • Memory leak fixed on creating the (geo) iterator on errors.

With env ECCODES_ECKIT_GEO=0 (the default), the iterator and projString are unchanged. Only gridSpec (always by eckit::geo) changes: its values for the grids above, and the error for a message whose number of points isn't its grid's.

Tests

  • grib_geo_iterator:
    • Compares eckit::geo grid points to the eccodes iterator, message by message, in the eccodes iterator order.
    • Covers regular, reduced, rotated and Gaussian sub-areas, HEALPix, projected and space_view windows, alternating rows, the F1280 longitude precision, and a single rotated point as an example.
    • Not compared, with the reason printed: Lambert grids scanning j- (the eccodes iterator assumes latitudes increase from the first grid point, GRIB-405), and rotated_gg (the eccodes iterator does not unrotate it).
  • grib_eckit_geo_proj_string: projString (classical) compared to the PROJ string of the eckit::geo projection, and the projection round trip from its spec.
  • grib_eckit_geo_projections: for each projected and space_view grid (examples of operational grids, and the test data), checks:
    • gridSpec and the projection spec;
    • projString with env ECCODES_ECKIT_GEO=0, 1 and 2;
    • the first, second and last points.
  • Test messages of projected and lat/lon grids built from samples set their grid keys explicitly, rather than relying on the sample's grid.
  • Existing tests check the env ECCODES_ECKIT_GEO value where eckit::geo behaves differently:
    • grib_grid_polar_stereographic: an oblate Earth is supported;
    • grib_grid_mercator: error message;
    • grib_grid_lamb_az_eq_area: longitudes modulo 360;
    • grib_change_scanning: alternating rows are iterated;
    • grib_iterator: the legacy reduced Gaussian sub-area is an error.

Related changes

Please test with the matching eckit version.

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

@pmaciel
pmaciel requested a review from joobog October 14, 2026 01:13
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.70%. Comparing base (d9d0d83) to head (914db71).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #606   +/-   ##
========================================
  Coverage    87.70%   87.70%           
========================================
  Files          860      860           
  Lines        64257    64257           
  Branches     11450    11450           
========================================
  Hits         56358    56358           
  Misses        7899     7899           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pmaciel
pmaciel force-pushed the feature/eckit-geo branch 2 times, most recently from fa921a0 to bfbd6fa Compare October 15, 2026 15:28
@pmaciel
pmaciel marked this pull request as draft October 27, 2026 09:51
…iveRowScanning), number of points checked, no leaks on errors
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.

2 participants