-
Notifications
You must be signed in to change notification settings - Fork 21
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
Compliance with Dask version 2021.03 ? #27
Comments
Noting that @aaronspring encountered what appears to be a similar problem using dask==2021.03.0 with xhistogram inside xskillscore (xarray-contrib/xskillscore#280) |
Ok, thanks for reporting this. Need to get a fix in asap. Any ideas? Ideally we should be testing against xarray and dask master branches. |
Needed until xgcm/xhistogram#27 is resolved.
Took a quick look at one of the failing tests in xskillscore xarray-contrib/xskillscore#280 (comment) Failing at |
failing here with dask: https://github.com/xgcm/xhistogram/blob/master/xhistogram/test/test_core.py#L177 The test: https://gist.github.com/raybellwaves/fe5c941eea0a885616c3c1cb3d8627b3 |
The core issue is that dask's xhistogram/xhistogram/duck_array_ops.py Line 33 in a3760d3
is now returning dask arrays with shape |
maybe dask/dask#7391 will help? |
I just reviewed that PR and I'm 99% sure that it will fix the problem. I consider this a regression in dask, so we will not be making a workaround in xhistogram. We have two choices here:
What do those affected prefer? |
I'm fine with doing nothing if others are. dask releases are more or less monthly and I think we've already pinned an earlier version of dask in the last xskillscore release. |
dask/dask#7391 was just merged into Dask's |
I find a followup issue with Its a new error message: skillscore/tests/test_probabilistic.py:831:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
xskillscore/core/probabilistic.py:1209: in roc
dim=dim,
xskillscore/core/contingency.py:122: in __init__
self._table = self._get_contingency_table(dim)
xskillscore/core/contingency.py:167: in _get_contingency_table
bin_dim_suffix="_bin",
xskillscore/core/utils.py:166: in histogram
return xhist(*args, bins=bins, **kwargs)
/usr/share/miniconda/envs/xskillscore-minimum-tests/lib/python3.7/site-packages/xhistogram/xarray.py:146: in histogram
block_size=block_size
/usr/share/miniconda/envs/xskillscore-minimum-tests/lib/python3.7/site-packages/xhistogram/core.py:271: in histogram
block_size=block_size,
/usr/share/miniconda/envs/xskillscore-minimum-tests/lib/python3.7/site-packages/xhistogram/core.py:131: in _histogram_2d_vectorized
bin_indices = ravel_multi_index(each_bin_indices, hist_shapes)
/usr/share/miniconda/envs/xskillscore-minimum-tests/lib/python3.7/site-packages/xhistogram/duck_array_ops.py:24: in f
return getattr(module, name)(*args, **kwargs)
<__array_function__ internals>:6: in ravel_multi_index
???
/usr/share/miniconda/envs/xskillscore-minimum-tests/lib/python3.7/site-packages/dask/array/core.py:1525: in __array_function__
return da_func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
multi_index = [dask.array<digitize, shape=(1, 200), dtype=int64, chunksize=(1, 200), chunktype=numpy.ndarray>, dask.array<digitize, shape=(1, 200), dtype=int64, chunksize=(1, 200), chunktype=numpy.ndarray>]
dims = [4, 4], mode = 'raise', order = 'C'
@wraps(np.ravel_multi_index)
def ravel_multi_index(multi_index, dims, mode="raise", order="C"):
> return multi_index.map_blocks(
_ravel_multi_index_kernel,
dtype=np.intp,
chunks=(multi_index.shape[-1],),
drop_axis=0,
func_kwargs=dict(dims=dims, mode=mode, order=order),
)
E AttributeError: 'list' object has no attribute 'map_blocks' xhist master doesnt solve it: |
xgcm tests seem ok on upstream: https://github.com/xgcm/xhistogram/actions/workflows/upstream.yml |
the xhist wrapper for datasets by @dougiesquire |
I think I've found the issue here. It's an issue in dask that was introduced into xhistogram in the latest version. The dask version of That is, the following works: import numpy as np
import dask.array as dsa
arr = np.array([[3,6,6],[4,5,1]]) # Example from numpy docs
da = dsa.from_array(arr)
dsa.ravel_multi_index(da, (7,7)) but the following fails with the error dsa.ravel_multi_index((da, da), (7,7)) This is a bug in dask and I'll open an issue about it. xhistogram doesn't currently have tests with multiple dask @raybellwaves, @aaronspring one solution for now in xskillscore is to pin xhistogram==0.1.2. |
Issue opened with dask here: dask/dask#7580 |
A fix for this has been implemented in the latest release of dask (2021.06.1). In the meantime, however, the xhistogram refactor to use Closing the issue. |
First of all thank you for making this useful tool.
It has worked well for me until Dask version 2021.03, after which I am getting error as below when calling
histogram
. I apologize that this might be not be sufficient information to reproduce.The text was updated successfully, but these errors were encountered: