Skip to content

Conversation

@max-sixty
Copy link
Collaborator

Not sure this is great, but it does seem to work?

Not sure this is great, but it does seem to work?
Comment on lines +324 to +332
not isinstance(data, np.ndarray)
and (
hasattr(data, "__array_function__") or hasattr(data, "__array_namespace__")
)
# Not exactly sure why this is a special case but
# https://github.com/pydata/xarray/issues/9535
# (possibly numpy strings can be
# indexed but it's indexing the string rather than as an array?)
and not isinstance(data, np.str_)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as pointed out in #9535 I believe this will be resolved by #9403, but in case it doesn't, can we combine the isinstance checks?

Suggested change
not isinstance(data, np.ndarray)
and (
hasattr(data, "__array_function__") or hasattr(data, "__array_namespace__")
)
# Not exactly sure why this is a special case but
# https://github.com/pydata/xarray/issues/9535
# (possibly numpy strings can be
# indexed but it's indexing the string rather than as an array?)
and not isinstance(data, np.str_)
# Not exactly sure why this is a special case but
# https://github.com/pydata/xarray/issues/9535
# (possibly numpy strings can be
# indexed but it's indexing the string rather than as an array?)
not isinstance(data, np.ndarray | np.str_)
and (
hasattr(data, "__array_function__") or hasattr(data, "__array_namespace__")
)

@max-sixty
Copy link
Collaborator Author

Thanks for looking at this @keewis and fixing with #9403!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants