home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 321796423

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
321796423 MDU6SXNzdWUzMjE3OTY0MjM= 2112 Sanity check when assigning a coordinate to DataArray 6815844 closed 0     0 2018-05-10T03:22:18Z 2018-05-15T16:39:22Z 2018-05-15T16:39:22Z MEMBER      

Code Sample, a copy-pastable example if possible

I think we can raise an Error if the newly assigned coordinate to a DataArray has an invalid shape.

python In [1]: import xarray as xr ...: ...: da = xr.DataArray([0, 1, 2], dims='x') ...: da['x'] = [0, 1, 2, 3] # no error ...: da ...: Out[1]: <xarray.DataArray (x: 3)> array([0, 1, 2]) Coordinates: * x (x) int64 0 1 2 3

Problem description

It is more user-friendly if we make some sanity checks when a new coordinate is assigned to a xr.DataArray.

Dataset raises an appropriate error, python In [2]: ds = xr.Dataset({'da': ('x', [0, 1, 2])}) ...: ds['x'] = [0, 1, 2, 3] # -> raises ValueError

Expected Output

ValueError

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2112/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
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.802ms · About: xarray-datasette