-
Notifications
You must be signed in to change notification settings - Fork 12
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
UserWarning when computing chunked pint arrays #116
Comments
you don't even need the In [3]: chunked.mean()
.../lib/python3.8/site-packages/dask/array/core.py:3113: UserWarning: Passing an object to dask.array.from_array which is already a Dask collection. This can lead to unexpected behavior.
warnings.warn(
Out[3]:
<xarray.DataArray ()>
dask.array<mean_agg-aggregate, shape=(), dtype=float64, chunksize=(), chunktype=numpy.ndarray> is enough, and computing returns
Note that there's no units in the result of In conclusion: this is a pretty serious bug (in |
Oh dear. Does the other order ( |
no, it doesn't, which is why I believe this is a bug in |
It would be really nice to get this to work before we publish #114 (not that there is any time limit), but I have time now and am keen to help if I can. Should I re-raise this issue on xarray? |
yes, that would be good. I didn't test |
Are we definitely seeing the same behaviour as each other? When I do <xarray.DataArray (dim_0: 3)>
<Quantity([1 2 3], 'meter')>
Dimensions without coordinates: dim_0 which seems right to me? Conda envpackages in environment at /home/tegn500/miniconda3/envs/py38-mamba:Name Version Build Channel_libgcc_mutex 0.1 conda_forge conda-forge |
it is correct and I get the same result (which means |
with |
Right sorry, I had left out the call to mean. |
This was fixed by pydata/xarray#5559 In [4]: da = xr.DataArray([1,2,3], dims=['x'], attrs={'units': 'metres'})
In [5]: chunked = da.pint.quantify().pint.chunk(1)
In [6]: chunked
Out[6]:
<xarray.DataArray (x: 3)>
<Quantity(dask.array<xarray-<this-array>, shape=(3,), dtype=int64, chunksize=(1,), chunktype=numpy.ndarray>, 'meter')>
Dimensions without coordinates: x
In [7]: chunked.mean().compute()
Out[7]:
<xarray.DataArray ()>
<Quantity(2.0, 'meter')> |
Everything looks fine here, excellent...
but when I go to compute then I get a
UserWarning
, even though it returns the correct answer:Even if this is working fine then we don't want to be giving warnings to the user ideally.
The text was updated successfully, but these errors were encountered: