Add SGRID metadata to generic datasets#2647
Merged
VeckoTheGecko merged 11 commits intoMay 29, 2026
Merged
Conversation
At the moment XGrid.from_dataset uses xgcm internals to set the time dimension. Once the `from_dataset` code path is dropped, this can be enabled again
Update ds_2d_padded_both and ds_2d_padded_none
Now that the datasets themselves have sgrid metadata, theres no need to have this extra dataset
ddde734 to
e76e8b8
Compare
VeckoTheGecko
commented
May 28, 2026
| of the grid. | ||
| """ | ||
| return ds.drop_vars(ds.data_vars) | ||
| return ds.drop_vars(set(ds.data_vars) - {"grid"}) # don't drop sgrid metadata |
Contributor
Author
There was a problem hiding this comment.
This function will be removed in a future PR anyway (once from_dataset is removed)
| grid.to_attrs(), | ||
| ) | ||
| ds.attrs["Conventions"] = "SGRID" | ||
| # ds.attrs["Conventions"] = "SGRID" # TODO: re-enable once XGrid.from_dataset is gone |
Contributor
Author
There was a problem hiding this comment.
This was needed to get around some xgcm internals - will be re-enabled in a future PR.
3 tasks
erikvansebille
approved these changes
May 28, 2026
Member
erikvansebille
left a comment
There was a problem hiding this comment.
Looks good; just one question below
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
This PR does some refactoring/prep work on datasets ahead of removing the
XGrid.from_dataset()code path which is being deprecated. This is in favour of theFieldSet.from_sgrid_conventions()code path which directly constructs the grid.This is ultimately working towards #2646
This PR:
datasets_comodoback todatasetsdatasetsas the default for most test cases would be great since the COMODO dimension naming is quite nice. It now having SGRID metadata makes ingestion much easier.datasets['ds_2d_inner']anddatasets['ds_2d_outer']ds_2d_padded_bothandds_2d_padded_noneindatasets_sgridChecklist
mainfor normal development,v3-supportfor v3 support)AI Disclosure
None used