-
Notifications
You must be signed in to change notification settings - Fork 110
Closed
Description
Minimal, reproducible code sample, a copy-pastable example if possible
In [1]: import numcodecs
In [2]: f = numcodecs.Fletcher32()
In [3]: result = f.encode( b"Hello world")
In [5]: import numpy as np
In [6]: f.decode(result, out = np.zeros(11, dtype="u1"))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[6], line 1
----> 1 f.decode(result, out = np.zeros(11, dtype="u1"))
File ~/src/numcodecs/numcodecs/fletcher32.pyx:82, in numcodecs.fletcher32.Fletcher32.decode()
80 "This could be a sign that the data has been corrupted."
81 )
---> 82 if out:
83 out.view("uint8")[:] = b[:-4]
84 return out
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Problem description
Fletcher32.decode contains an out keyword that seems to be intended for a numpy.ndarray due to the .view property. However, when provided with numpy.ndarray a value error occurs as per above.
Version and installation information
Please provide the following:
- Python 3.11.4
- main git branch of numcodecs
- Linux
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels