-
Notifications
You must be signed in to change notification settings - Fork 2
Fix propagation of global attributes to child datasets and variables #72
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #72 +/- ##
=======================================
Coverage 99.46% 99.46%
=======================================
Files 67 67
Lines 2810 2816 +6
Branches 413 413
=======================================
+ Hits 2795 2801 +6
Partials 15 15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
forman
left a comment
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.
Please fix:
- It is not clear, why the fix is correct. New code is also quite unintuitive.
- Missing unit tests
xrlint/_linter/apply.py
Outdated
| dataset_copy = node.datatree.dataset.copy() | ||
| merged_dataset_attrs = { | ||
| **current_attrs, | ||
| **dataset_copy.attrs, | ||
| } |
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.
This does not look right. Can you please add a comment explaining why this is done and why it is correct.
Also add a test case that verifies correctness and explains the use case / reproduces the issue.
xrlint/_linter/apply.py
Outdated
| datatree_copy.attrs = { | ||
| **current_attrs, | ||
| **datatree_copy.attrs, | ||
| } |
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.
Same as above.
This PR fixes the propagation of global DataTree attributes to child Datasets and Variables.
Closes #63.
Checklist (strike out non-applicable):
CHANGES.mdCHANGES.mddocs/*