-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix writing of DataTree subgroups to zarr or netCDF #9677
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1709721
Fix writing of DataTree subgroups to zarr or netCDF
shoyer 85711b1
Merge branch 'main' into datatree-write-subgroup
shoyer 7e5ccd2
Add write_inherited_coords for additional control in DataTree.to_zarr
shoyer c51811e
Merge branch 'main' into datatree-write-subgroup
shoyer 5646c61
Switch write_inherited_coords default to false
shoyer 9cf885f
Merge branch 'main' into datatree-write-subgroup
shoyer 0311614
add whats new
shoyer b7995f1
Merge branch 'main' into datatree-write-subgroup
shoyer 6df6817
remove unused import
shoyer 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 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 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 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
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 happens at read-time? Do we normalize and remove duplicated coords by default? If so, I think we should change so that does not happen by default.
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.
Yes, this is what happens.
Can you clarify what you mean here?
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.
IIUC the default is to denormalize at write-time and normalize at read-time, where "normalizing" means that coordinates are de-duplicated and inherited from parent groups where possible.
To me, that's confusing in that you really have to opt-in to round-trip to disk exactly what you have in memory. Also, anyone reading a CF-compliant store with inherited coordinates and writing it out will be surprised when opening it up with another library. FWIW it seems to me that we usually regret this kind of convenience/consistency tradeoff in the long-run.
I don't feel too strongly though. At the very least we should add some docs on how to roundtrip exactly, and how to open and write CF-compliant datasets with coordinate inheritance.
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.
The advantage of writing things out this way is that you get the same DataTree from reading out a particular group, i.e.,
I think this will be a little less surprising to users, but overall I agree that it does not matter too much.
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.
I'd expect when handling CF compliant data to roundtrip accordingly.
This might lead to issues on the user side.
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.
I've reverted changing this behavior -- the default is now
write_inherited_coords=False
.