Boolean Coordinates #4861
Unanswered
martinitus
asked this question in
General
Replies: 1 comment
-
Thanks for your report. I opened a new issue with this - I think it's more appropriate there. Unfortunately there seems to be no possibility to directly move a discussion over to the issues. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Folks,
I started using xarray a couple of weeks ago after working with bare multidimensional numpy arrays for years.
I love it, you are geniuses! ❤️
Today I stumbled over a small pitfall, which I think could be avoided:
I am working with arrays that have axes labeled with categorical values and I ended up using True/False as labels for some binary categories:
now came the big surprise, when I wanted to reduce over selections of the data:
Instead of using the coordinate values like with the ternary category, it uses the list as boolean mask and hence I get a 3x1 array at the binary=False coordinate.
I assume that this behavior is reasonable in most cases - And I for sure will stop using bools as binary category labels.
That said in the above case the conceptually identical call results in completely different outcome.
My (radical) proposal would be: forbid binary coordinates in general to avoid such confusion.
Curious about your thoughts! Hth,
Marti
Beta Was this translation helpful? Give feedback.
All reactions