I wanted to test out python-blosc2.
When trying do compress data with a user-defined Filter however, I stumbled across a for me unexplainable error.
import blosc2
import numpy as np
a = np.random.rand(1000, 1000)
blosc2.compress(a, codec='blosclz', clevel=5, filter=blosc2.Filter.SHUFFLE)
I receive a AttributeError: 'str' object has no attribute 'name'
as the documentation said, one should pass the `enum blosc2.Filter` as argument. However, I tried multiple ways, including (but receiving the same error):
blosc2.compress(a, codec='blosclz', clevel=5, filter=blosc2.Filter(0))
I did miss, to uses the enum objects insted of the string for as also pointed out in the documentation.
Looks like, your code fails here. According to the source code of core.py, codec
is not supposed to be str
type. You should pass a value of blosc2.Codec:
blosc2.compress(a, codec=blosc2.Codec.BLOSCLZ, clevel=5, filter=blosc2.Filter.SHUFFLE)