Skip to content

Commit b741fe1

Browse files
committed
Reshape chunk ourselves since it is an ndarray
As we already ensured the `chunk` is an `ndarray` viewing the original data, there is no need for us to do that here as well. Plus the checks performed by `ensure_contiguous_ndarray` are not needed for our use case here. Particularly as we have already handled the unusual type cases above. We also don't need to constrain the buffer size. As such the only thing we really need is to flatten the array and make it contiguous, which is what we handle here directly.
1 parent bf4eee8 commit b741fe1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

zarr/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
import numpy as np
11-
from numcodecs.compat import ensure_ndarray, ensure_contiguous_ndarray
11+
from numcodecs.compat import ensure_ndarray
1212

1313

1414
from zarr.util import (is_total_slice, human_readable_size, normalize_resize_args,
@@ -1761,7 +1761,7 @@ def _decode_chunk(self, cdata):
17611761
# array during decoding.
17621762
raise RuntimeError('cannot read object array without object codec')
17631763
else:
1764-
chunk = ensure_contiguous_ndarray(chunk).view(self._dtype)
1764+
chunk = chunk.reshape(-1, order='A').view(self._dtype)
17651765

17661766
# ensure correct chunk shape
17671767
chunk = chunk.reshape(self._chunks, order=self._order)

0 commit comments

Comments
 (0)