-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
What happened:
When using boolean indexing dask crashes.
What you expected to happen:
Behave like numpy:
>>> import numpy as np
>>> a1 = np.array([1,2,3,4])
>>> a2 = np.array([0,1,1,0], dtype=bool)
>>> a3 = np.ones_like(a1)
>>> a3[a2] = a1[a2]
>>> a3
array([1, 2, 3, 1])Minimal Complete Verifiable Example:
>>> import dask.array as da
>>> da1 = da.array([1, 2, 3, 4])
>>> da2 = da.array([0, 1, 1, 0], dtype=bool)
>>> da3 = da.ones_like(da1)
>>> da3[da2] = da1[da2]
Traceback (most recent call last):
File "<ipython-input-72-31cfb0c20342>", line 5, in <module>
da3[da2] = da1[da2]
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\array\core.py", line 1531, in __setitem__
y = where(key, value, self)
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\array\routines.py", line 1343, in where
return elemwise(np.where, condition, x, y)
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\array\core.py", line 3991, in elemwise
broadcast_shapes(*shapes)
File "C:\ProgramData\Anaconda3\lib\site-packages\dask\array\core.py", line 3952, in broadcast_shapes
"shapes {0}".format(" ".join(map(str, shapes)))
ValueError: operands could not be broadcast together with shapes (4,) (nan,) (4,)Environment:
Version
INSTALLED VERSIONS
------------------
commit: None
python: 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)]
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: en
LOCALE: None.None
libhdf5: 1.10.4
libnetcdf: None
xarray: 0.16.1
pandas: 1.1.1
numpy: 1.17.5
scipy: 1.4.1
netCDF4: None
pydap: None
h5netcdf: None
h5py: 2.10.0
Nio: None
zarr: None
cftime: 1.2.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2.27.0
distributed: 2.27.0
matplotlib: 3.3.1
cartopy: None
seaborn: 0.11.0
numbagg: None
pint: None
setuptools: 49.6.0.post20200814
pip: 20.2.2
conda: 4.8.5
pytest: 6.0.2
IPython: 7.18.1
sphinx: 3.2.1
Reactions are currently unavailable