home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 291533765

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/1351#issuecomment-291533765 https://api.github.com/repos/pydata/xarray/issues/1351 291533765 MDEyOklzc3VlQ29tbWVudDI5MTUzMzc2NQ== 1197350 2017-04-04T15:19:20Z 2017-04-04T15:19:20Z MEMBER

There is no such thing as a "multidimensional DataArray" in the xarray data model. DataArrays can have "non-dimension coordinates" which can be used for things like grouping.

This would work python new_array = DataArray(np.zeros((2,2)), dims=['x_logical','y_logical']) new_array.coords['x_physical'] = x_physical new_array.coords['y_physical'] = y_physical new_array.groupby('x_physical').mean()

I don't know how to do this as a one-liner. Probably easier to create a Dataset rather than DataArray for this purpose python ds = xr.Dataset({'testdata': (('y_logical', 'x_logical'), np.zeros((2,2)))}, coords={'x_physical': (('y_logical', 'x_logical'), np.ones((2,2))), 'y_physical': (('y_logical', 'x_logical'), np.ones((2,2)))})

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  219184224
Powered by Datasette · Queries took 0.695ms · About: xarray-datasette