zarr-python
zarr-python copied to clipboard
Zarr forces compression even when explicitly disabled
Minimal, reproducible code sample, a copy-pastable example if possible
import zarr
zeros = zarr.zeros((262144,), chunks=32*1024, dtype='f4', compressor=None)
print(zeros.compressor) # None
g = zarr.open_group('test.zarr', mode='w')
g['zeros'] = zeros
print(g['zeros'].compressor ) # Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0) ???
Problem description
Arrays created with no compression get compressed when added to a group.
A workaround is to set zarr.storage.default_compressor = None, but that affects all arrays.
I've been looking through the documentation and couldn't find any other way :/
Seems that here, compressor value is ignored as array is recreated:
https://github.com/zarr-developers/zarr-python/blob/480136c8a580123d3f7b44cf52692221401b8fea/zarr/creation.py#L377
Version and installation information
- zarr 2.12.0
- numcodecs 0.10.0
- python 3.9.9
- GNU/Linux CentOS 7.8
- Installed via pip into a venv
@ptallada: interesting! I would have thought that would work as well. I assume the issue you are dealing with is that the first array was created without a store instance. Until the issue there is found, creating the group first works:
In [8]: zeros = g.zeros(name="zeros", shape=(262144,), chunks=32*1024, dtype='f4', compressor=None)
In [9]: zeros.compressor
In [10]: print(g['zeros'].compressor )
None