home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 649968866

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/4136#issuecomment-649968866 https://api.github.com/repos/pydata/xarray/issues/4136 649968866 MDEyOklzc3VlQ29tbWVudDY0OTk2ODg2Ng== 1217238 2020-06-26T05:05:48Z 2020-06-26T05:05:48Z MEMBER

Dimensions on the outputs of an xarray operations are picked based on their order of appearance in the arguments.

In this case, I agree that it's somewhat surprising, but putting lon first is consistent with the order of dimensions in the function call xr.where(y.lon < 1, y, -1).

If you want to preserve the original dimensions order, one way to achieve this would be to use the where method instead, i.e., ```

y.where(y.lon < 1, -1) <xarray.DataArray 'sst' (lat: 3, lon: 3)> array([[-1., -1., -1.], [-1., -1., -1.], [-1., -1., -1.]]) Coordinates: * lat (lat) int64 0 1 2 * lon (lon) int64 10 11 12 ```

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