home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 486153978

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
486153978 MDExOlB1bGxSZXF1ZXN0MzExNjYzOTg2 3271 Raise proper error for scalar array when coords is a dict 23618263 closed 0     3 2019-08-28T04:29:02Z 2019-08-29T17:23:20Z 2019-08-29T17:09:00Z CONTRIBUTOR   0 pydata/xarray/pulls/3271

As explained here https://github.com/pydata/xarray/pull/3159#discussion_r316230281 , when a user uses a scalar array to build a DataArray with coords given as a dictionary the error is not self explanatory. ```python

xr.DataArray(np.array(1), coords={'x': np.arange(4), 'y': 'a'}, dims=['x']) ... KeyError: 'x' ```

This PR makes sure that when data is a scalar array and dims is not empty, it sets the shape to (0,) to make it fail with the proper raise message

```python

xr.DataArray(np.array(1), coords={'x': np.arange(4), 'y': 'a'}, dims=['x']) ... ValueError: conflicting sizes for dimension 'x': length 0 on the data but length 4 on coordinate 'x' ```

  • [x] Test updated
  • [x] Passes black . && mypy . && flake8
  • [ ] Fully documented, including whats-new.rst for all changes and api.rst for new API (is this needed for a change like this?)
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3271/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

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