-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix "Chunksize cannot exceed dimension size" #1707
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
Conversation
Fixes GH1225
589bb1a
to
f5c1b57
Compare
xarray/backends/netCDF4_.py
Outdated
c > d for c, d in zip(encoding['chunksizes'], variable.shape)) | ||
changed_shape = encoding.get('original_shape') != variable.shape | ||
if chunks_too_big or changed_shape: | ||
del encoding['chunksizes'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks fine. Can you add a comment here that explains that we are dropping the encoding chunksizes so that netCDF4-python can write this dataset
xarray/backends/netCDF4_.py
Outdated
del encoding['chunksizes'] | ||
if not raise_on_invalid and 'chunksizes' in encoding: | ||
chunks_too_big = any( | ||
c > d for c, d in zip(encoding['chunksizes'], variable.shape)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you'll need to make sure encoding['chunksizes']
is an iterable of length variable.ndim
I updated the logic to only drop |
I had this error in 0.9.5. 0.10.0 definitely fixes it. Thanks! |
git diff upstream/master **/*py | flake8 --diff
whats-new.rst
for all changes andapi.rst
for new API