Feature/issue 138 migrate to xarray.DataTree#281
Merged
Conversation
… to using xarray datatree
| try: | ||
| # Instead of "with nc.Dataset() as" inside the loop, we use a context manager stack. | ||
| # This way all files are cleanly closed outside the loop. | ||
| with ExitStack() as context_stack: |
Collaborator
There was a problem hiding this comment.
I think it's actually considered best practice use a context manager for xarray Dataset/Datatree objects too. Perhaps we should create a new issue to implement them?
See:
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #281 +/- ##
===========================================
+ Coverage 85.95% 89.97% +4.02%
===========================================
Files 11 9 -2
Lines 648 449 -199
===========================================
- Hits 557 404 -153
+ Misses 91 45 -46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ated group flattening/regrouping steps
…ation to xarray datatree
Collaborator
|
@ank1m, think I'm done adding commits, if you want to confirm again with your own tests before merging! |
danielfromearth
approved these changes
Jul 2, 2025
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.
GitHub Issue: #138
Description
Recent l2ss-py update to 3.0.0 with newly released
xarray.DataTreeextension duplicates dimensions inside the netCDF groups. These duplicated dimensions break stitchee algorithm which flattens them into independent variables. Migrating stitchee logic toxarray.DataTreewill resolve the issue.Local test steps
xarray.DataTreemethods.Overview of integration done
PR Acceptance Checklist
CHANGELOG.mdupdated📚 Documentation preview 📚: https://stitchee--281.org.readthedocs.build/en/281/