Filters inaccessible after array creation- unclear if they are being applied
Closed this issue · 1 comments
ljwoods2 commented
I want to be able to open a zarr group passed in by a user, find the first available array, and get the filtering and compression used when creating the array. Something like this:
import zarr
import numcodecs
g = zarr.open_group("test.zarr", mode='a')
filters = [numcodecs.Quantize(digits=3, dtype='f4')]
g["a"] = zarr.create_array((100), filters=filters)
But when I create an array like this, I can only access the compressor, not the filters (no output):
In [65]: g["a"].compressor
Out[65]: Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0)
In [66]: g["b"].filters
For reference, I'm using Zarr 2.13.3 and numcodecs 0.12.1 with Ubuntu 22.04
How can I get access to the filters passed in upon array creation?
ljwoods2 commented
Filters can be applied like this:
filters = [numcodecs.Quantize(digits=3, dtype='f4')]
particle_group.empty(
"step", shape=(self._first_dim,), dtype=np.int32, filters=filters
)