Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ Release notes
Unreleased
----------


Fixes
~~~~~

* Fix Zarr serialization with ZFP when array is a view.
By :user:`Altay Sansal <tasansal>`, :issue:`812`

.. _release_0.16.5:

0.16.5
Expand Down
9 changes: 6 additions & 3 deletions numcodecs/zfpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't 1D numpy arrays c and f contiguous? and so doesn't this reject 1D arrays?

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
Expand Down