0

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.

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

1 Comment

yep, that was it! Thanks! Don't know, why I had the wrong line in the error trace…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.