Skip to content

map_over_datasets: fix error message for wrong result type #10016

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 2 commits into from
Feb 5, 2025

Conversation

mathause
Copy link
Collaborator

The error message did not indicate the name of the node which is fixed here.

It shows '.' for the root node while the repr uses / which is maybe confusing. This comes from using NodePath() - maybe this should be changed to NodePath("/")?

queue = collections.deque([(NodePath(), self)])

@mathause
Copy link
Collaborator Author

Ok, I also found it helpful to have the result on a new line.

before:

TypeError: the result of calling func on the node at position 'ssp126' is not a Dataset or None or a tuple of such types: <xarray.DataArray 'selected_ar_order' (member: 1)> Size: 8B
array([2.])
Coordinates:
  * member   (member) <U8 32B 'r1i1p1f1'

now:

TypeError: the result of calling func on the node at position 'ssp126' is not a Dataset or None or a tuple of such types:
<xarray.DataArray 'selected_ar_order' (member: 1)> Size: 8B
array([2.])
Coordinates:
  * member   (member) <U8 32B 'r1i1p1f1'

@TomNicholas TomNicholas added the topic-DataTree Related to the implementation of a DataTree class label Feb 4, 2025
Copy link
Member

@TomNicholas TomNicholas left a comment

Choose a reason for hiding this comment

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

Thanks @mathause !

@mathause mathause added the plan to merge Final call for comments label Feb 4, 2025
@mathause
Copy link
Collaborator Author

mathause commented Feb 4, 2025

Thanks - I'll merge shortly.

@mathause mathause merged commit 160cced into pydata:main Feb 5, 2025
41 checks passed
@mathause mathause deleted the fix_dt_err_msg_wrong_result branch February 5, 2025 09:53
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 topic-DataTree Related to the implementation of a DataTree class
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy