From 84e253251d214b936d76b1e71fbdb2b4a183788c Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Wed, 17 Dec 2025 09:08:13 -0600 Subject: [PATCH 1/3] fix contiguous array logic --- numcodecs/zfpy.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/numcodecs/zfpy.py b/numcodecs/zfpy.py index 80a1e78a..4fa1cbda 100644 --- a/numcodecs/zfpy.py +++ b/numcodecs/zfpy.py @@ -77,13 +77,16 @@ def encode(self, buf): "The zfp codec does not support none numpy arrays." f" Your buffers were {type(buf)}." ) - if buf.flags.c_contiguous: - flatten = False - else: + if buf.flags.f_contiguous: raise ValueError( "The zfp codec does not support F order arrays. " f"Your arrays flags were {buf.flags}." ) + # Force C-contiguous if needed (copies only if not already C-contiguous) + buf = np.ascontiguousarray(buf) + + # No flattening needed for C-order + flatten = False buf = ensure_contiguous_ndarray(buf, flatten=flatten) # do compression From 3e4a4c2713101901bed714c38db12e27f16b57b9 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Wed, 17 Dec 2025 09:51:55 -0600 Subject: [PATCH 2/3] lint --- numcodecs/zfpy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numcodecs/zfpy.py b/numcodecs/zfpy.py index 4fa1cbda..ab84d5f2 100644 --- a/numcodecs/zfpy.py +++ b/numcodecs/zfpy.py @@ -84,7 +84,7 @@ def encode(self, buf): ) # Force C-contiguous if needed (copies only if not already C-contiguous) buf = np.ascontiguousarray(buf) - + # No flattening needed for C-order flatten = False buf = ensure_contiguous_ndarray(buf, flatten=flatten) From 90b3b1e8a122ce6a8ae32265cbc5890c1f144d70 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Wed, 17 Dec 2025 09:58:08 -0600 Subject: [PATCH 3/3] update release notes --- docs/release.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/release.rst b/docs/release.rst index fcd3422f..b9de7569 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -17,6 +17,13 @@ Release notes Unreleased ---------- + +Fixes +~~~~~ + +* Fix Zarr serialization with ZFP when array is a view. + By :user:`Altay Sansal `, :issue:`812` + .. _release_0.16.5: 0.16.5