Can't pack an empty array: ZeroDivisionError: integer modulo by zero
Closed this issue · 1 comments
fyrestone commented
I am not sure if this is by design, but it would be good if blocs2 can support an empty array as well.
import numpy as np
import blosc2
print(np.__version__)
print(blosc2.__version__)
empty = np.zeros((0,), dtype=float)
blosc2.pack_tensor(empty)
Output:
1.26.4
3.0.0b4
Traceback (most recent call last):
File "blocs2_bug2.py", line 8, in <module>
blosc2.pack_tensor(empty)
File "/Users/admin/.pyenv/versions/miniconda3-3.11-23.11.0-2/lib/python3.11/site-packages/blosc2/core.py", line 644, in pack_tensor
schunk = blosc2.SChunk(chunksize=chunksize, data=arr, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/admin/.pyenv/versions/miniconda3-3.11-23.11.0-2/lib/python3.11/site-packages/blosc2/schunk.py", line 284, in __init__
super().__init__(_schunk=sc, chunksize=chunksize, data=data, **kwargs)
File "blosc2_ext.pyx", line 1017, in blosc2.blosc2_ext.SChunk.__init__
ZeroDivisionError: integer modulo by zero
FrancescAlted commented
Sure. PRs welcome :-)