Repository navigation
feat(xarray): load reduced Gaussian/HEALPix netCDF grids and add gridspec to xarray field geography - #1241
Merged
Conversation
…spec to xarray field geography
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
Description
Improves the geography of fields read from netCDF/xarray, building on earthkit-geo's grid detection.
XarrayGrid.grid_typeoverride; fields now report earthkit-geo's grid type. Projected grids with only x/y coordinates now give"regular_xy"(or"unstructured") instead ofNone;to_xarray()still works for them.XarrayGridis now a thin view over any earthkit-geo grid instead of a subclass.grid_spec(),grid()andunique_grid_id()now work for xarray fields. The gridspec comes from earthkit-geo; it isNonewhen it does not number the values in their stored order (wrapped longitudes, reduced Gaussian sub-areas crossing 0°). The eckit grid is built lazily, once per variable. Latitudes/longitudes still come from the xarray coordinates, so there is no extra cost at load time or when reading coordinates.(npoints,)wherever singleton dimensions sit.BoundingBoxno longer hangs on huge or infinite longitudes (loop-free normalisation), and the xarray bounding box uses only valid points.Tests
tests/netcdf/test_netcdf_grid_xr.py: loads all 65 netCDF files from the remotetest-data/grids/xrfolder (the same files earthkit-geo tests) and checks field count, shape, grid type, lat/lon samples, bounding box and gridspec, with expected values taken from earthkit-geo's tests. Markedlong_test,downloadandcache.BoundingBoxedge cases.Contributor Declaration
By opening this pull request, I affirm the following: