-
Notifications
You must be signed in to change notification settings - Fork 171
Add SGRID Xarray accessor #2638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
VeckoTheGecko
merged 22 commits into
Parcels-code:main
from
VeckoTheGecko:push-kupxytsrkxzn
May 21, 2026
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
eec5c2e
Patch simple_UV_dataset metadata
VeckoTheGecko e02e9e6
Add SGRID Xarray index
VeckoTheGecko ee414c3
Move sgrid files
VeckoTheGecko 0f24d47
Update sgrid API
VeckoTheGecko 17e4ff8
Move sgrid file to own subpackage
VeckoTheGecko 2f1104f
Move test_sgrid.py
VeckoTheGecko 116e162
Fix typo
VeckoTheGecko a24caa6
SGRID xarray accessor tests
VeckoTheGecko 286e675
Add SGRID xarray accessor - metadata, rename()
VeckoTheGecko c272eed
Add function assert_metadata_ds_consistency
VeckoTheGecko 85d65c8
Improve tests
VeckoTheGecko e441cc0
Add isel method to Xarray accessor
VeckoTheGecko 889c9ad
Add test for single isel
VeckoTheGecko 3fba06b
Fix typechecking
VeckoTheGecko c702f83
Move rename test
VeckoTheGecko f4c9e91
xfail test_parse_sgrid_3d
VeckoTheGecko a3a3fb3
Extend isel to work with padding NONE and BOTH datasets
VeckoTheGecko 8243486
Use dataset as argument
VeckoTheGecko e3d8ce3
Self review
VeckoTheGecko 8e8910a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] dd66b21
Update docstrings
VeckoTheGecko 1f0743c
Merge branch 'main' into push-kupxytsrkxzn
VeckoTheGecko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| from .accessor import SgridAccessor | ||
| from .core import ( | ||
| FaceNodePadding, | ||
| Padding, | ||
| SGrid2DMetadata, | ||
| SGrid3DMetadata, | ||
| _attach_sgrid_metadata, | ||
| dump_mappings, | ||
| get_n_faces, | ||
| get_n_nodes, | ||
| load_mappings, | ||
| xgcm_parse_sgrid, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "FaceNodePadding", | ||
| "Padding", | ||
| "SGrid2DMetadata", | ||
| "SGrid3DMetadata", | ||
| "SgridAccessor", | ||
| "_attach_sgrid_metadata", | ||
| "dump_mappings", | ||
| "get_n_faces", | ||
| "get_n_nodes", | ||
| "load_mappings", | ||
| "xgcm_parse_sgrid", | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's happening here? What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are generic type variables https://mypy.readthedocs.io/en/stable/generics.html
They allow you to describe (via typing) a relationship between the input and output types of a function, without providing concrete types.
e.g.,
In our case here we define type variables K and V (for "key" and "value") for