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

Passing DataArray.chunks to chunk() raises DeprecationWarning #8880

Closed
sehoffmann opened this issue Mar 26, 2024 · 1 comment
Closed

Passing DataArray.chunks to chunk() raises DeprecationWarning #8880

sehoffmann opened this issue Mar 26, 2024 · 1 comment

Comments

@sehoffmann
Copy link

sehoffmann commented Mar 26, 2024

What is your issue?

import numpy as np
import xarray as xr

da = xr.DataArray(np.random.randn(100,100), dims=['a', 'b'])
da = da.chunk({'a': 10, 'b': 10})

da.chunk(da.chunks)  <-- DeprecationWarning: Supplying chunks as dimension-order tuples is deprecated. It will raise an error in the future. Instead use a dict with dimension names as keys.

This situation might arise easily for instance when trying to chunk array_1 in the same way as array_2. Arguably, its unexpected that DataArray's own property is not allowed as argument to chunk().

@sehoffmann sehoffmann added the needs triage Issue that has not been reviewed by xarray team member label Mar 26, 2024
@dcherian dcherian added usage question and removed needs triage Issue that has not been reviewed by xarray team member labels Mar 26, 2024
@dcherian
Copy link
Contributor

Use da.chunksizes instead. It is a dict.

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

No branches or pull requests

2 participants