Blosc/python-blosc2

Proxy does not inherit the cparams/dparams properly

Closed this issue · 0 comments

Here it is an example:

import blosc2

cparams = blosc2.CParams(clevel=5, codec=blosc2.Codec.LZ4,
                         filters=[blosc2.Filter.BITSHUFFLE],
                         filters_meta=[0])
a = blosc2.zeros((128, 128), dtype="float64", urlpath="a.b2nd", mode="w",
                 cparams=cparams)
blosc2.remove_urlpath("proxy.b2nd")
b = blosc2.Proxy(a, urlpath="proxy.b2nd")

# And see its metadata
print(f"Codec in 'a': {a.schunk.cparams['codec']}")
print(f"Codec in 'b': {b._cache.schunk.cparams['codec']}")
print(f"Clevel in 'a': {a.schunk.cparams['clevel']}")
print(f"Clevel in 'b': {b._cache.schunk.cparams['clevel']}")
print(f"Filters in 'a': {a.schunk.cparams['filters']}")
print(f"Filters in 'b': {b._cache.schunk.cparams['filters']}")

and the output:

Codec in 'a': Codec.LZ4
Codec in 'b': Codec.ZSTD
Clevel in 'a': 5
Clevel in 'b': 1
Filters in 'a': [<Filter.BITSHUFFLE: 2>, <Filter.NOFILTER: 0>, <Filter.NOFILTER: 0>, <Filter.NOFILTER: 0>, <Filter.NOFILTER: 0>, <Filter.NOFILTER: 0>]
Filters in 'b': [<Filter.NOFILTER: 0>, <Filter.NOFILTER: 0>, <Filter.NOFILTER: 0>, <Filter.NOFILTER: 0>, <Filter.NOFILTER: 0>, <Filter.SHUFFLE: 1>]