home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 912149228

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
912149228 MDU6SXNzdWU5MTIxNDkyMjg= 5439 Set `allow_rechunk=True` still raise different lengths error 30388627 closed 0     1 2021-06-05T08:17:18Z 2021-06-05T08:37:11Z 2021-06-05T08:34:52Z NONE      

What happened:

I'm using apply_ufunc to apply np.minimum.reduceat() function, which is much quicker than groupby_bins().min(). However, the length of bin is different from the input data. As a result, this causes the length error.

Minimal Complete Verifiable Example:

```python import numpy as np import xarray as xr

data = xr.DataArray(np.arange(10), dims=['x']) dask_data = data.chunk({'x': -1}) bins_reduceat = np.linspace(0, 9, 10).astype('int')

def reduceat_np(data, bins): return np.minimum.reduceat(data, bins)

res = xr.apply_ufunc(reduceat_np, dask_data, bins_reduceat[:5], dask="parallelized", output_dtypes=[data.dtype], dask_gufunc_kwargs={'allow_rechunk': True},

                )

res.compute() ```

Error: `` ~/new/miniconda3/envs/pyresample_min/lib/python3.8/site-packages/dask/array/gufunc.py in apply_gufunc(func, signature, *args, **kwargs) 392 #### Check that the arrays have same length for same dimensions or dimension1393 if set(sizes) | {1} != {1, max(sizes)}: --> 394 raise ValueError( 395 "Dimension'{}'` with different lengths in arrays".format(dim) 396 )

ValueError: Dimension '__loopdim0__' with different lengths in arrays ```

Anything else we need to know?:

It works well if the data and bin have the same length.

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:22:27) [GCC 9.3.0] python-bits: 64 OS: Linux OS-release: 3.10.0-957.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.18.2 pandas: 1.2.4 numpy: 1.20.2 scipy: 1.6.3 netCDF4: 1.5.6 pydap: None h5netcdf: None h5py: 3.2.1 Nio: None zarr: 2.8.1 cftime: 1.2.1 nc_time_axis: 1.2.0 PseudoNetCDF: None rasterio: 1.2.3 cfgrib: None iris: 3.0.1 bottleneck: None dask: 2021.04.1 distributed: 2021.04.1 matplotlib: 3.3.4 cartopy: 0.19.0.post1 seaborn: None numbagg: None pint: 0.17 setuptools: 49.6.0.post20210108 pip: 21.1.1 conda: None pytest: 6.2.4 IPython: 7.23.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5439/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
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.534ms · About: xarray-datasette