home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 398157337

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/2237#issuecomment-398157337 https://api.github.com/repos/pydata/xarray/issues/2237 398157337 MDEyOklzc3VlQ29tbWVudDM5ODE1NzMzNw== 1217238 2018-06-18T18:50:39Z 2018-06-18T18:50:48Z MEMBER

The source of the indexing operation that brings all the chunks together is the _maybe_reorder helper function, which "scatters" array elements back into the correct positions after applying the grouped function: https://github.com/pydata/xarray/blob/66be9c5db7d86ea385c3a4cd4295bfce67e3f25b/xarray/core/groupby.py#L429-L435

So basically the issue comes down to indexing with dask.array, which creates a single chunk when integers indices are not all in order: ``` import dask.array as da import numpy as np

x = da.ones(4, chunks=1) print(x[np.arange(4)])

dask.array<getitem, shape=(4,), dtype=float64, chunksize=(1,)>

print(x[np.arange(4)[::-1]])

dask.array<getitem, shape=(4,), dtype=float64, chunksize=(4,)>

```

As a work-around in xarray, we could use explicit indexing + concatenation.

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