home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1855291078

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1855291078 PR_kwDOAMm_X85YLGz2 8079 Consistently report all dimensions in error messages if invalid dimensions are given 20118130 closed 0     11 2023-08-17T16:03:53Z 2023-09-09T04:55:43Z 2023-09-09T04:55:43Z CONTRIBUTOR   0 pydata/xarray/pulls/8079

Hello,

I noticed that arr.min("nonexistent") raises an error with a very helpful message ValueError: 'nonexistent' not found in array dimensions ('x', 'y', 'z') while arr.idxmin("nonexistent") raises KeyError: 'Dimension "nonexistent" not in dimension' [sic]

IMO, the list of dimensions should always be shown in the error message for these kinds of errors, it makes debugging much easier. With this PR, I have implemented this behavior for all such functions that I could find.

There is quite a consistent pattern which I think could be factored out into a function, but I didn't have a clear enough picture of the structure of the whole code to do it.

I didn't fix the tests yet, I'll do it if you think this can be merged.

  • [x] Searched list of issues, couldn't find one related to this
  • [x] Tests added
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8079/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 4 rows from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.593ms · About: xarray-datasette