home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 115897556

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
115897556 MDU6SXNzdWUxMTU4OTc1NTY= 649 error when using broadcast_arrays with coordinates 1197350 closed 0     5 2015-11-09T15:16:32Z 2015-11-10T14:27:41Z 2015-11-10T14:27:41Z MEMBER      

I frequently use broadcast_arrays to to feed xray variables to non-xray libraries (e.g. gsw.) Often I need to broadcast the coordinates and variables in order to do call functions that take both as arguments.

I have found that broadcast_arrays doesn't work as I expect with coordinates. For example

python import xray import numpy as np ds = xray.Dataset({'a': (['y','x'], np.ones((20,10)))}, coords={'x': (['x'], np.arange(10)), 'y': (['y'], np.arange(20))}) xbc, ybc, abc = xray.broadcast_arrays(ds.x, ds.y, ds.a)

This raises ValueError: an index variable must be defined with 1-dimensional data.

If I change the last line to

python xbc, ybc, abc = xray.broadcast_arrays(1*ds.x, 1*ds.y, ds.a)

it works fine.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/649/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

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