home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 614445489

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/pull/3922#issuecomment-614445489 https://api.github.com/repos/pydata/xarray/issues/3922 614445489 MDEyOklzc3VlQ29tbWVudDYxNDQ0NTQ4OQ== 5821660 2020-04-16T06:39:13Z 2020-04-16T06:39:13Z MEMBER

@shoyer Thanks for the hint.

I'm currently experimenting with the different possibilities.

non-dask: <xarray.DataArray (y: 3, x: 7)> array([[ 0, 1, 2, 0, -2, -4, 2], [ 1, 1, 1, 1, 1, 1, 1], [ 0, 0, -10, 5, 20, 0, 0]]) Coordinates: * x (x) int64 0 4 8 12 16 20 24 * y (y) int64 1 0 -1 Attributes: attr1: value1 attr2: 2929 dask: <xarray.DataArray (y: 3, x: 7)> dask.array<xarray-<this-array>, shape=(3, 7), dtype=int64, chunksize=(3, 7), chunktype=numpy.ndarray> Coordinates: * x (x) int64 0 4 8 12 16 20 24 * y (y) int64 1 0 -1 Attributes: attr1: value1 attr2: 2929

The relevant code inside idxmin/idxmax:

```python

This will run argmin or argmax.

indx will be dask if array is dask

indx = func(array, dim=dim, axis=None, keep_attrs=keep_attrs, skipna=skipna)

separated out for debugging

with the current test layout coords will not be dask since the array's coords are not dask

coords = array[dim]

try to make dask of coords as per @shoyer's suggestion

the below fails silently, but cannot be forced even with trying to

do something like dask.array.asarray(), this errors out with

"Cannot assign to the .data attribute of dimension coordinate a.k.a IndexVariable 'x'"

if isinstance(indx.data, dask_array_type): coords = coords.chunk({})

res = coords[(indx,)] ``` It seems that the map-blocks approach is the only one which seem to work throughout the tests, but one. It fails with array set as array.astype("object") in the test fixture. Reason: dask gets computed within argmin/argmax.

I'll revert to the map-blocks now and add the with raise_if_dask_computes() , context where neccessary. Any hints appreciated for the dask compute-error.

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