Repository navigation
eckit::geo: scanning orders, projections, search, caches and gridspec fixes - #374
Merged
Merged
Conversation
pmaciel
force-pushed
the
feature/eckit-geo
branch
from
October 10, 2026 14:38
39c9714 to
e3f3a7f
Compare
pmaciel
force-pushed
the
feature/eckit-geo
branch
from
October 13, 2026 13:31
e3f3a7f to
5d38e19
Compare
pmaciel
force-pushed
the
feature/eckit-geo
branch
from
October 13, 2026 18:37
386c76c to
9d2c912
Compare
pmaciel
marked this pull request as ready for review
October 14, 2026 00:31
…ictions), as mir's
… trees in memory, mapped, cache file, shared memory, Grid::search and search cache
…f the central meridian
…rch without PROJ)
…efix), areas from libraries, areas compared by uid
…lternativeRowScanning, tests
…s) and point_coordinates
…ion::Conformal) and authalic; the surface areas of all figures from the authalic
…(grids of a single point, row or column)
…ing mode (the indices as the cropped grid points, eg. of alternating rows)
…atabase is available, tests by ProjectionFactory::has_type
pmaciel
force-pushed
the
feature/eckit-geo
branch
from
October 14, 2026 00:33
8c88e80 to
18835ef
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #374 +/- ##
===========================================
+ Coverage 68.81% 70.58% +1.77%
===========================================
Files 1190 1207 +17
Lines 63233 66076 +2843
Branches 4758 5065 +307
===========================================
+ Hits 43511 46639 +3128
+ Misses 19722 19437 -285 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
These are eckit::geo fixes and features found while using gridspec grids for MIR regridding and for eccodes (regional, rotated and projected grids, scanning orders, GRIB grids), and the k-d tree search, caches and Python bindings built on them. The branch is organised as one merge per topic, in the order below; smaller changes are commits between the merges.
Longitude normalisation (
fix/longitude-normalisation)normalise_angle_to_minimum/maximumcould returnminimum + 360for values just below the minimum (e.g.-8.9e-16→360). Results are now always in[min, min + 360). Same fix forPointLonLatR.points_equalnow treats points across the longitude seam as equal (e.g.0and360 - 1e-12).regular_gground trip: Gaussian latitude cropping now tolerates rounding, so a regional grid's spec rebuilds the same grid.Regular grids and scanning orders (
fix/regular-grids-scanning)regular_ll: decreasing (i-/j-) periodic longitude ranges now start from the lowest point, like increasing ones.regular_gg:i-orders were built on the wrong global range. Construction now uses helpers, which also fixes a leak of the cropped ranges.order::Scan::reorderrenumbers points between any two scanning orders (i±j±,j±i±).Projections (
fix/projections)south_pole_lon/south_pole_latare individually optional. The Python test now expects this, which is the current behaviour; it used to expect an error.test_projdb_fallbacknow runs only when the build actually depends on theproj.dbbundled in the wheel. It skips when PROJ finds its ownproj.db, e.g. a local build against a system PROJ.Search (
feature/search)cache::MemoryUsage(memory and shared memory footprints) andcache::InMemoryCache(capacity, footprint, evictions), as in MIR.knn_or_radius,knn_and_radius).Grid::search(), a search shared throughcache::SearchCache.eckit.geosearch module, grid search loaders and examples.eckit-geo-grid-nearestuses the grid search.SPDX headers
.pyx/.pxd) now carry SPDX headers, like all other sources.cython-lintallows 90 characters (the length of the SPDX copyright line), so the correspondingREUSE.tomlexception is removed.Python extension modules
eckit.geois built as one extension module per class (area, figure, projection, grid, search) instead of a single one. The Python API is unchanged.Cache layout (
feature/cache-layout)cache/Version.h):download,latlonandsearch.download/<version>/under the eckit::geo cache directory. Coordinates written locally (e.g. unstructured grids) go tolatlon/<version>/.latloncache are safe across processes (througheckit::CacheManager): files are written to a temporary file and then renamed, so concurrent processes never read a partial file.eckit-geo-grid-cachetakes grid regular expressions or uids as arguments.cache_dir, and the Python tests cache to a temporary directory.Grid specs (
feature/gridspec)regular_xy), canonical forms, routings and spec round trips (tests).Area::fill_grid_spec,Figure::fill_projection_spec,Projection::fill_grid_spec). Defaults are left out: the default area, the default projection and the default figure.SMUFF-OPERA-2km) aren't taken for projection names.Projection::reverse(), and the spec says"reverse": trueinstead of renaming the type (reverse-<type>). The PythonProjectionhas areverseproperty..dbfpath was written under theshpkey, and the name field is nowname_field.eckit::spec::Custom::make_from_valuehandles booleans.Search caching and geocentric points (
feature/search-caching)Grid::to_xyz: geocentric coordinates of the grid points. Grids of (lon, lat) points are converted on the figure of their coordinates (Projection::source_figure, which for PROJ can differ from the target CRS figure), and geocentric grid points are returned as they are. Also in Python, asGrid.to_xyz().Grid::to_latlonsacceptsPointLonLatRpoints, and raises aGridErrorfor points that aren't (lon, lat).Searchbuilds its trees fromGrid::to_xyzand converts (lon, lat) queries withLonLatToXYZon the same figure, without PROJ (thread-safe queries, and no PROJ database needed).LonLatToXYZis simplified, with a vectorised conversion.file-io,mmap,shmemandtmp-shmem, replacing the previous tree classes.eckit_GEO_CACHE_SEARCH_CAPACITY("in-process[,shared]"bytes, default 1 GiB in-process), and the resourceeckit-geo-cache-search-capacity.util/mutex.h).Comments and dead code
Projection::falseXYsetter are removed.Projections as PROJ (
feature/projections-as-proj)regular_xygrids fromxandyranges (any step, the stop included to a fraction of the step), false easting/northing, and projections from (x, y). The spec states its order unless it's the default.lcc), Mercator (merc), polar stereographic (stere) and Lambert azimuthal equal-area (laea) as PROJ, on spheres and ellipsoids, with catalogue grids and grids as the GRIB examples (e.g.lambert_lam.grib2).space_view(geostationary satellite view) as GRIB, compared to PROJgeos.Projection::proj_str, rotation asob_tran), and grid points on the projection figure."reverse": true).swisslv95andswisslv03as catalogue grids and named projections; a projection name as grid type.EPS) and the bounding box precision; projection tests to 1e-6, independent of the platform.Grid cropping and shapefile areas (
feature/grid-crop)cache::CropCache, capacityeckit_GEO_CACHE_CROP_CAPACITY, default 0).url_prefix). Areas are compared by uid.Cleanup
GEO_PROJECTION_PROJ_DEFAULTis removed (CMake,LibEcKitGeo, Rusteckit-sys).EXPECT/EXPECT_NOT.Scanning orders (
feature/scanning-orders)i+j-), so default orders are left out of specs.alternativeRowScanning:iterator::Regularandreordersupport them.Grid.reorder,Grid.to_points(coordinate names to values) andpoint_coordinates.GRIB grids (
feature/grib-grids)ni, unless4N).Figures and Albers on ellipsoids (
feature/albers-ellipsoid)Figure::conformal()andFigure::authalic(): functions of the latitude (conformal and authalic latitudes, isometric and authalic q), moved from the projections into the figure, and used bylcc,merc,stere,laeaandaea.Figure::area()andFigure::area(BoundingBox)(spheres and ellipsoids alike).BoundingBox::areauses it.aea.Crop preserving scanning modes (
feature/crop-scanning-modes)regular_ll,regular_gg) are cropped as their own type, preserving the scanning mode (including alternating rows).Grid::cropreturns the indices of the points in the area, in the order of the cropped grid points.Smaller changes
projprojection type is registered on demand, and only if the PROJ database is available, soProjectionFactory::has_type("proj")alone tells whether it can be used.GreatCircle::coursecomputes its sines and cosines locally (util/sincos.hremoved).Changes for existing users
download/1/andlatlon/1/. Existing caches underlatlon/,fesom/andshapefile/aren't reused, so files are downloaded or written once again."reverse": trueinstead of thereverse-<type>type name.i+j-)."grid":[0,0]).GEO_PROJECTION_PROJ_DEFAULTis removed.projprojection type isn't registered without the PROJ database.search/Tree*) are replaced by the loaders (search/KDTree,FileIO,MappedFile,SharedMemory, …), andutil/sincos.his removed.Tests
Contributor Declaration
By opening this pull request, I affirm the following:
🌦️ >> Documentation << 🌦️
https://sites.ecmwf.int/docs/dev-section/eckit/pull-requests/PR-374
🤖 Generated with Claude Code