home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 189129954

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
189129954 MDU6SXNzdWUxODkxMjk5NTQ= 1120 Creating a `Dataset` with a coordinate given by a `DataArray` may create an invalid dataset 1310437 closed 0     3 2016-11-14T14:46:44Z 2017-09-06T00:07:08Z 2017-09-06T00:07:08Z CONTRIBUTOR      

Consider this: import xarray as xr import numpy as np ds = xr.Dataset( data_vars=dict( v = ('y',np.r_[0:10]), ), coords=dict( y=xr.DataArray(np.r_[:10]/10,dims='x'), ), ) The dataset ds will end up having dimensions ('x', 'y') because of the coordinate y having dimensions ('x',). This seems to violate some of the internal assumptions (ds.indexes['y'].name turns out to be 'x'), consequently ds.sel(y=0) will throw an exception (ValueError: cannot use a dict-like object for selection on a dimension that does not have a MultiIndex).

I came across this situation when trying to generate a dataset with a coordinate that is a copy of another pre-existing coordinate, but under a different name. My expectation was that the coordinate would be renamed (doing so manually also doesn't work out of the box due to #1116). Of course that is not the only possible interpretation of the construct above, arguably it should raise an exception instead (which is what DataArray currently does in the corresponding case).

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1120/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

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