Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3.9 dask/array/slicing.py in slice_wrap_lists Don't yet support nd fancy indexing #5225

Closed
JavierRuano opened this issue Apr 27, 2021 · 5 comments

Comments

@JavierRuano
Copy link

JavierRuano commented Apr 27, 2021

The code in the line 411, returns Don't yet support nd fancy indexing from dask.
https://github.com/JavierRuano/ASI_Steady/blob/main/ASI_Datase_RACKt.py#L411

that was working well with python3.7 .

ASI_Datase_RACKt.py in refresh_Graphics
saveFile = self.xarray[indices_maps[str(self.typi)]].where(self.xarray.mask == 1).where( …
▼ Local vars
Variable Value
NETCDF_FILES_FOLDER
'/var/www/stream/stream/data/'
end
'2020-11-02'
indices_maps
{'horton': 'ASI_Horton_2012',
'huang': 'ASI_Huang_2018',
'wang': 'ASI_Wang_2017'}
lat_dos
48.75
lat_uno
48.0
lng_dos
-5.75
lng_uno
-5.0
self
<polls.ASI_Datase_RACKt.ASI object at 0x7f585899e1f0>
start
'2020-11-01'
/usr/local/lib/python3.9/dist-packages/xarray/core/common.py in where
self = self.isel(**indexers) …
▼ Local vars
Variable Value
DataArray
<class 'xarray.core.dataarray.DataArray'>
Dataset
<class 'xarray.core.dataset.Dataset'>
align
<function align at 0x7f5878522af0>
clipcond
<xarray.DataArray (latitude: 68, longitude: 81)>
array([[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
...,
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False]])
Coordinates:

  • latitude (latitude) float32 75.0 74.25 73.5 72.75 ... 26.25 25.5 24.75
  • longitude (longitude) float32 -20.0 -19.25 -18.5 -17.75 ... 38.5 39.25 40.0
    cond
    <xarray.DataArray (latitude: 68, longitude: 81)>
    array([[False, False, False, ..., False, False, False],
    [False, False, False, ..., False, False, False],
    [False, False, False, ..., False, False, False],
    ...,
    [False, False, False, ..., False, False, False],
    [False, False, False, ..., False, False, False],
    [False, False, False, ..., False, False, False]])
    Coordinates:
  • latitude (latitude) float32 75.0 74.25 73.5 72.75 ... 26.25 25.5 24.75
  • longitude (longitude) float32 -20.0 -19.25 -18.5 -17.75 ... 38.5 39.25 40.0
    drop
    True
    indexers
    {'latitude': array([], dtype=int64), 'longitude': array([], dtype=int64)}
    nonzeros
    <zip object at 0x7f584bfc08c0>
    other
self dask.array Coordinates: * time (time) datetime64[ns] 1979-01-01T12:00:00 ... 2020-11-30T12:00:00 * latitude (latitude) float32 75.0 74.25 73.5 72.75 ... 26.25 25.5 24.75 * longitude (longitude) float32 -20.0 -19.25 -18.5 -17.75 ... 38.5 39.25 40.0 mask (latitude, longitude) float64 1.0 2.0 2.0 2.0 ... 1.0 1.0 1.0 1.0 Attributes: long_name: air_stagnation_index /usr/local/lib/python3.9/dist-packages/xarray/core/dataarray.py in isel variable = self._variable.isel(indexers, missing_dims=missing_dims) … ▼ Local vars Variable Value drop False indexers {'latitude': array([], dtype=int64), 'longitude': array([], dtype=int64)} indexers_kwargs {'latitude': array([], dtype=int64), 'longitude': array([], dtype=int64)} missing_dims 'raise' self dask.array Coordinates: * time (time) datetime64[ns] 1979-01-01T12:00:00 ... 2020-11-30T12:00:00 * latitude (latitude) float32 75.0 74.25 73.5 72.75 ... 26.25 25.5 24.75 * longitude (longitude) float32 -20.0 -19.25 -18.5 -17.75 ... 38.5 39.25 40.0 mask (latitude, longitude) float64 1.0 2.0 2.0 2.0 ... 1.0 1.0 1.0 1.0 Attributes: long_name: air_stagnation_index /usr/local/lib/python3.9/dist-packages/xarray/core/variable.py in isel return self[key] … ▼ Local vars Variable Value indexers {'latitude': array([], dtype=int64), 'longitude': array([], dtype=int64)} indexers_kwargs {} key (slice(None, None, None), array([], dtype=int64), array([], dtype=int64)) missing_dims 'raise' self dask.array Attributes: long_name: air_stagnation_index /usr/local/lib/python3.9/dist-packages/xarray/core/variable.py in __getitem__ data = as_indexable(self._data)[indexer] … ▼ Local vars Variable Value dims ('time', 'latitude', 'longitude') indexer OuterIndexer((slice(None, None, None), array([], dtype=int64), array([], dtype=int64))) key (slice(None, None, None), array([], dtype=int64), array([], dtype=int64)) new_order None self dask.array Attributes: long_name: air_stagnation_index /usr/local/lib/python3.9/dist-packages/xarray/core/indexing.py in __getitem__ return array[key] … ▼ Local vars Variable Value array dask.array key (array([[[ 0]],
   [[    1]],

   [[    2]],

   ...,

   [[15307]],

   [[15308]],

   [[15309]]]),

array([], shape=(1, 0, 1), dtype=int64),
array([], shape=(1, 1, 0), dtype=int64))
self
NdArrayLikeIndexingAdapter(array=dask.array<copy, shape=(15310, 68, 81), dtype=float64, chunksize=(15310, 68, 81), chunktype=numpy.ndarray>)
/usr/local/lib/python3.9/dist-packages/dask/array/core.py in getitem
dsk, chunks = slice_array(out, self.name, self.chunks, index2, self.itemsize) …
▼ Local vars
Variable Value
dependencies
{'copy-60d43625606b762db38f4c336bfabf09'}
i
array([], shape=(1, 1, 0), dtype=int64)
index
(array([[[ 0]],

   [[    1]],

   [[    2]],

   ...,

   [[15307]],

   [[15308]],

   [[15309]]]),

array([], shape=(1, 0, 1), dtype=int64),
array([], shape=(1, 1, 0), dtype=int64))
index2
(array([[[ 0]],

   [[    1]],

   [[    2]],

   ...,

   [[15307]],

   [[15308]],

   [[15309]]]),

array([], shape=(1, 0, 1), dtype=int64),
array([], shape=(1, 1, 0), dtype=int64))
normalize_index
<function normalize_index at 0x7f585a1b7940>
out
'getitem-33275cee9730d05017ed841f8e82e286'
self
dask.array<copy, shape=(15310, 68, 81), dtype=float64, chunksize=(15310, 68, 81), chunktype=numpy.ndarray>
slice_with_bool_dask_array
<function slice_with_bool_dask_array at 0x7f585a1b7b80>
slice_with_int_dask_array
<function slice_with_int_dask_array at 0x7f585a1b7a60>
/usr/local/lib/python3.9/dist-packages/dask/array/slicing.py in slice_array
dsk_out, bd_out = slice_with_newaxes(out_name, in_name, blockdims, index, itemsize) …
▼ Local vars
Variable Value
blockdims
((15310,), (68,), (81,))
in_name
'copy-60d43625606b762db38f4c336bfabf09'
index
(array([[[ 0]],

   [[    1]],

   [[    2]],

   ...,

   [[15307]],

   [[15308]],

   [[15309]]]),

array([], shape=(1, 0, 1), dtype=int64),
array([], shape=(1, 1, 0), dtype=int64))
itemsize
8
missing
0
not_none_count
3
out_name
'getitem-33275cee9730d05017ed841f8e82e286'
/usr/local/lib/python3.9/dist-packages/dask/array/slicing.py in slice_with_newaxes
dsk, blockdims2 = slice_wrap_lists(out_name, in_name, blockdims, index2, itemsize) …
▼ Local vars
Variable Value
blockdims
((15310,), (68,), (81,))
in_name
'copy-60d43625606b762db38f4c336bfabf09'
index
(array([[[ 0]],

   [[    1]],

   [[    2]],

   ...,

   [[15307]],

   [[15308]],

   [[15309]]]),

array([], shape=(1, 0, 1), dtype=int64),
array([], shape=(1, 1, 0), dtype=int64))
index2
(array([[[ 0]],

   [[    1]],

   [[    2]],

   ...,

   [[15307]],

   [[15308]],

   [[15309]]]),

array([], shape=(1, 0, 1), dtype=int64),
array([], shape=(1, 1, 0), dtype=int64))
itemsize
8
out_name
'getitem-33275cee9730d05017ed841f8e82e286'
where_none
[]
where_none_orig
[]
/usr/local/lib/python3.9/dist-packages/dask/array/slicing.py in slice_wrap_lists
raise NotImplementedError("Don't yet support nd fancy indexing") …

▼ Local vars
Variable Value
blockdims
((15310,), (68,), (81,))
in_name
'copy-60d43625606b762db38f4c336bfabf09'
index
(array([[[ 0]],

   [[    1]],

   [[    2]],

   ...,

   [[15307]],

   [[15308]],

   [[15309]]]),

array([], shape=(1, 0, 1), dtype=int64),
array([], shape=(1, 1, 0), dtype=int64))
itemsize
8
out_name
'getitem-33275cee9730d05017ed841f8e82e286'
where_list
[0, 1, 2]

@mathause
Copy link
Collaborator

Could you fill out the issue template including the show_versions part. Please also add the versions of the environment that did work. Also, without a reproducible example we cannot look into the problem.

@JavierRuano
Copy link
Author

Linux streamDebian 5.10.0-6-amd64 #1 SMP Debian 5.10.28-1 (2021-04-09) x86_64 GNU/Linux

xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110]
python-bits: 64
OS: Linux
OS-release: 5.10.0-6-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
libhdf5: 1.12.0
libnetcdf: 4.7.4

xarray: 0.17.0
pandas: 1.2.4
numpy: 1.19.5
scipy: 1.6.3
netCDF4: 1.5.6
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.4.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2021.04.1
distributed: None
matplotlib: 3.4.1
cartopy: 0.18.0
seaborn: None
numbagg: None
pint: None
setuptools: 52.0.0
pip: 20.3.4
conda: None
pytest: 6.0.2
IPython: 7.20.0
sphinx: None

@max-sixty
Copy link
Collaborator

Hi @JavierRuano — good to see you again!

This seems to be a dask issue, is that correct?

I'd be surprised if it's a python 3.7 vs 3.9 difference — are you sure that's the only change — are the dask & xarray versions the same?

Also — have a look at GitHub's docs on how to format code & tracebacks — we appreciate people posting issues — but it is easier to read them if they're formatted reasonably.

@JavierRuano
Copy link
Author

It works again, i have tried to save a netcdf file what produces the bug, but nothing. The traceback was from debug mode of django.

@JavierRuano
Copy link
Author

I'm sorry I couldn't be more helpful this time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants