Skip to content

Display data returned in apply_ufunc error message #8179

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

Merged
merged 5 commits into from
Sep 14, 2023

Conversation

max-sixty
Copy link
Collaborator

This makes debugging much easier!

  • Tests added

This makes debugging much easier!
f"number of dimensions. Received {data.ndim} dimension(s) but "
f"expected {len(dims)} dimensions with names: {dims!r}"
f"expected {len(dims)} dimensions with names: {dims!r}. The data returned "
f"was:\n\n{data!r}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Another option would to log this sort of info. It's not a "full report" of the error, since there might be other datas.

(I would vote to merge and then change in the future if it turns out to be confusing, but if someone has a different view I'm v happy to make changes)

@max-sixty max-sixty changed the title Display data returned in ufunc error message Display data returned in apply_ufunc error message Sep 14, 2023
@max-sixty max-sixty added the plan to merge Final call for comments label Sep 14, 2023
Copy link
Collaborator

@headtr1ck headtr1ck left a comment

Choose a reason for hiding this comment

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

Seems helpful! Thanks

+1 for typing improvements

@max-sixty max-sixty enabled auto-merge (squash) September 14, 2023 20:03
@max-sixty max-sixty disabled auto-merge September 14, 2023 20:06
@max-sixty max-sixty merged commit 2a02052 into pydata:main Sep 14, 2023
@max-sixty max-sixty deleted the error-message-ufunc branch September 14, 2023 20:06
Copy link
Contributor

@dcherian dcherian left a comment

Choose a reason for hiding this comment

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

Very nice, I had one comment.

(sorry for the late review)

PS: It's great to have you back, Max!

max-sixty added a commit to max-sixty/xarray that referenced this pull request Sep 15, 2023
Based on the correct observation in pydata#8179 (comment) (slightly adjusted message)
max-sixty added a commit that referenced this pull request Sep 17, 2023
* Adjust ufunc error message

Based on the correct observation in #8179 (comment) (slightly adjusted message)

* Update xarray/core/computation.py

Co-authored-by: Deepak Cherian <[email protected]>

* Update xarray/core/computation.py

---------

Co-authored-by: Deepak Cherian <[email protected]>
max-sixty added a commit to max-sixty/xarray that referenced this pull request Sep 17, 2023
* Adjust ufunc error message

Based on the correct observation in pydata#8179 (comment) (slightly adjusted message)

* Update xarray/core/computation.py

Co-authored-by: Deepak Cherian <[email protected]>

* Update xarray/core/computation.py

---------

Co-authored-by: Deepak Cherian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan to merge Final call for comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants