-
Notifications
You must be signed in to change notification settings - Fork 5
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 find_axes inside use_plot_config causing TypeError with DataArray #303
Conversation
🧙 Sourcery has finished reviewing your pull request! Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #303 +/- ##
==========================================
+ Coverage 58.26% 58.33% +0.07%
==========================================
Files 31 31
Lines 1598 1601 +3
Branches 290 291 +1
==========================================
+ Hits 931 934 +3
Misses 651 651
Partials 16 16 ☔ View full report in Codecov by Sentry. |
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.
Thanks for fixing this so quickly! And good thinking expanding the unit tests to include this scenario!
This PR fixes that
find_axes
raises aTypeError
when a config enabled function (has ause_plot_config
decorator) has axr.DataArray
argument or return value.Thanks @jsnel for discovering this error.
We didn't catch this error earlier since all our examples use
xr.Dataset
and when iterating overxr.Dataset
you get the keys of thedata_vars
.For
xr.DataArray
howeverfind_axes
recursively looks up subxr.DataArray
until it gets to a point where the value is a single itemxr.DataArray
and raises theTypeError
due to the dimensionality check in its__iter__
.In addition to fixing the above described bug, this PR also fixes that
Mappings
ofAxes
as arguments or return values wouldn't have been handled correctly.Minimal reproducible example:
Error before fix:
Change summary
Checklist