Skip to content

Commit

Permalink
Fixes pydata#2198: Drop chunksizes when original_shape is different
Browse files Browse the repository at this point in the history
Before this fix chunksizes was dropped even when
original_shape was not found in encoding
  • Loading branch information
Karel-van-de-Plassche committed Jun 1, 2018
1 parent 16ef0cf commit d933522
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xarray/backends/netCDF4_.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ def _extract_nc4_variable_encoding(variable, raise_on_invalid=False,
chunks_too_big = any(
c > d and dim not in unlimited_dims
for c, d, dim in zip(chunksizes, variable.shape, variable.dims))
changed_shape = encoding.get('original_shape') != variable.shape
has_original_shape = encoding.get('original_shape') is not None
changed_shape = (has_original_shape and
encoding.get('original_shape') != variable.shape)
if chunks_too_big or changed_shape:
del encoding['chunksizes']

Expand Down

0 comments on commit d933522

Please sign in to comment.