From 0d33c1ea1c0fe966a5868b0673038315ab90bd2d Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 10 Dec 2018 00:33:10 -0500 Subject: [PATCH 1/3] Use `ensure_ndarray` to view chunk as an array Simplifies the process of constructing an `ndarray` to view the chunk data when writing the result to a destination. --- zarr/core.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zarr/core.py b/zarr/core.py index 65bfff3cbb..b28f4e3419 100644 --- a/zarr/core.py +++ b/zarr/core.py @@ -1604,10 +1604,7 @@ def _chunk_getitem(self, chunk_coords, chunk_selection, out, out_selection, if self._compressor: self._compressor.decode(cdata, dest) else: - if isinstance(cdata, np.ndarray): - chunk = cdata.view(self._dtype) - else: - chunk = np.frombuffer(cdata, dtype=self._dtype) + chunk = ensure_ndarray(cdata).view(self._dtype) chunk = chunk.reshape(self._chunks, order=self._order) np.copyto(dest, chunk) return From 5003af760fd103837683fd2a8827f5d3897271c7 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 10 Dec 2018 03:03:23 -0500 Subject: [PATCH 2/3] Drop trailing whitespace --- docs/release.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index 0c1440b9ba..27a8b3f3f6 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -29,7 +29,7 @@ Bug fixes * The required version of the `numcodecs `_ package has been upgraded to 0.6.2, which has enabled some code simplification and fixes a failing test involving - msgpack encoding. By :user:`John Kirkham `, :issue:`352`, :issue:`355`, + msgpack encoding. By :user:`John Kirkham `, :issue:`352`, :issue:`355`, :issue:`324`. * Failing tests related to pickling/unpickling have been fixed. By :user:`Ryan Williams `, From 30c44375a6087b20417eeb9b61298eb9fa9fa071 Mon Sep 17 00:00:00 2001 From: John Kirkham Date: Mon, 10 Dec 2018 03:03:49 -0500 Subject: [PATCH 3/3] Link this PR to Numcodecs upgrade release note --- docs/release.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index 27a8b3f3f6..bac5e42297 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -29,7 +29,7 @@ Bug fixes * The required version of the `numcodecs `_ package has been upgraded to 0.6.2, which has enabled some code simplification and fixes a failing test involving - msgpack encoding. By :user:`John Kirkham `, :issue:`352`, :issue:`355`, + msgpack encoding. By :user:`John Kirkham `, :issue:`360`, :issue:`352`, :issue:`355`, :issue:`324`. * Failing tests related to pickling/unpickling have been fixed. By :user:`Ryan Williams `,