@@ -168,8 +168,8 @@ argument accepted by all array creation functions. For example::
168
168
>>> data = np.arange(100000000, dtype='int32').reshape(10000, 10000)
169
169
>>> z = zarr.create_array(store='data/example-5.zarr', shape=data.shape, dtype=data.dtype, chunks=(1000, 1000), compressors=compressors)
170
170
>>> z[:] = data
171
- >>> z.metadata.codecs
172
- [BytesCodec(endian=<Endian.little: 'little'>), BloscCodec(typesize=4, cname=<BloscCname.zstd: 'zstd'>, clevel=3, shuffle=<BloscShuffle.bitshuffle: 'bitshuffle'>, blocksize=0)]
171
+ >>> z.compressors
172
+ ( BloscCodec(typesize=4, cname=<BloscCname.zstd: 'zstd'>, clevel=3, shuffle=<BloscShuffle.bitshuffle: 'bitshuffle'>, blocksize=0),)
173
173
174
174
This array above will use Blosc as the primary compressor, using the Zstandard
175
175
algorithm (compression level 3) internally within Blosc, and with the
@@ -188,7 +188,9 @@ which can be used to print useful diagnostics, e.g.::
188
188
Order : C
189
189
Read-only : False
190
190
Store type : LocalStore
191
- Codecs : [{'endian': <Endian.little: 'little'>}, {'typesize': 4, 'cname': <BloscCname.zstd: 'zstd'>, 'clevel': 3, 'shuffle': <BloscShuffle.bitshuffle: 'bitshuffle'>, 'blocksize': 0}]
191
+ Filters : ()
192
+ Serializer : BytesCodec(endian=<Endian.little: 'little'>)
193
+ Compressors : (BloscCodec(typesize=4, cname=<BloscCname.zstd: 'zstd'>, clevel=3, shuffle=<BloscShuffle.bitshuffle: 'bitshuffle'>, blocksize=0),)
192
194
No. bytes : 400000000 (381.5M)
193
195
194
196
The :func: `zarr.Array.info_complete ` method inspects the underlying store and
@@ -203,7 +205,9 @@ prints additional diagnostics, e.g.::
203
205
Order : C
204
206
Read-only : False
205
207
Store type : LocalStore
206
- Codecs : [{'endian': <Endian.little: 'little'>}, {'typesize': 4, 'cname': <BloscCname.zstd: 'zstd'>, 'clevel': 3, 'shuffle': <BloscShuffle.bitshuffle: 'bitshuffle'>, 'blocksize': 0}]
208
+ Filters : ()
209
+ Serializer : BytesCodec(endian=<Endian.little: 'little'>)
210
+ Compressors : (BloscCodec(typesize=4, cname=<BloscCname.zstd: 'zstd'>, clevel=3, shuffle=<BloscShuffle.bitshuffle: 'bitshuffle'>, blocksize=0),)
207
211
No. bytes : 400000000 (381.5M)
208
212
No. bytes stored : 9696302
209
213
Storage ratio : 41.3
@@ -223,8 +227,8 @@ here is an array using Gzip compression, level 1::
223
227
>>> data = np.arange(100000000, dtype='int32').reshape(10000, 10000)
224
228
>>> z = zarr.create_array(store='data/example-6.zarr', shape=data.shape, dtype=data.dtype, chunks=(1000, 1000), compressors=zarr.codecs.GzipCodec(level=1))
225
229
>>> z[:] = data
226
- >>> z.metadata.codecs
227
- [BytesCodec(endian=<Endian.little: 'little'>), GzipCodec(level=1)]
230
+ >>> z.compressors
231
+ ( GzipCodec(level=1),)
228
232
229
233
Here is an example using LZMA from NumCodecs _ with a custom filter pipeline including LZMA's
230
234
built-in delta filter::
@@ -236,23 +240,24 @@ built-in delta filter::
236
240
>>> compressors = LZMA(filters=lzma_filters)
237
241
>>> data = np.arange(100000000, dtype='int32').reshape(10000, 10000)
238
242
>>> z = zarr.create_array(store='data/example-7.zarr', shape=data.shape, dtype=data.dtype, chunks=(1000, 1000), compressors=compressors)
239
- >>> z.metadata.codecs
240
- [BytesCodec(endian=<Endian.little: 'little'>), _make_bytes_bytes_codec.<locals>._Codec(codec_name='numcodecs.lzma', codec_config={'id': 'lzma', 'filters': [{'id': 3, 'dist': 4}, {'id': 33, 'preset': 1}]})]
243
+ >>> z.compressors
244
+ ( _make_bytes_bytes_codec.<locals>._Codec(codec_name='numcodecs.lzma', codec_config={'id': 'lzma', 'filters': [{'id': 3, 'dist': 4}, {'id': 33, 'preset': 1}]}),)
241
245
242
246
The default compressor can be changed by setting the value of the using Zarr's
243
247
:ref: `user-guide-config `, e.g.::
244
248
245
249
>>> with zarr.config.set({'array.v2_default_compressor.numeric': {'id': 'blosc'}}):
246
250
... z = zarr.create_array(store={}, shape=(100000000,), chunks=(1000000,), dtype='int32', zarr_format=2)
247
- >>> z.metadata.filters
248
- >>> z.metadata.compressor
249
- Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0)
251
+ >>> z.filters
252
+ ()
253
+ >>> z.compressors
254
+ (Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0),)
250
255
251
256
To disable compression, set ``compressors=None `` when creating an array, e.g.::
252
257
253
258
>>> z = zarr.create_array(store='data/example-8.zarr', shape=(100000000,), chunks=(1000000,), dtype='int32', compressors=None)
254
- >>> z.metadata.codecs
255
- [BytesCodec(endian=<Endian.little: 'little'>)]
259
+ >>> z.compressors
260
+ ()
256
261
257
262
.. _user-guide-filters :
258
263
@@ -287,7 +292,9 @@ Here is an example using a delta filter with the Blosc compressor::
287
292
Order : C
288
293
Read-only : False
289
294
Store type : LocalStore
290
- Codecs : [{'codec_name': 'numcodecs.delta', 'codec_config': {'id': 'delta', 'dtype': 'int32'}}, {'endian': <Endian.little: 'little'>}, {'typesize': 4, 'cname': <BloscCname.zstd: 'zstd'>, 'clevel': 1, 'shuffle': <BloscShuffle.shuffle: 'shuffle'>, 'blocksize': 0}]
295
+ Filters : (_make_array_array_codec.<locals>._Codec(codec_name='numcodecs.delta', codec_config={'id': 'delta', 'dtype': 'int32'}),)
296
+ Serializer : BytesCodec(endian=<Endian.little: 'little'>)
297
+ Compressors : (BloscCodec(typesize=4, cname=<BloscCname.zstd: 'zstd'>, clevel=1, shuffle=<BloscShuffle.shuffle: 'shuffle'>, blocksize=0),)
291
298
No. bytes : 400000000 (381.5M)
292
299
293
300
For more information about available filter codecs, see the `Numcodecs
@@ -600,11 +607,13 @@ Sharded arrays can be created by providing the ``shards`` parameter to :func:`za
600
607
Order : C
601
608
Read-only : False
602
609
Store type : LocalStore
603
- Codecs : [{'chunk_shape': (100, 100), 'codecs': ({'endian': <Endian.little: 'little'>}, {'level': 0, 'checksum': False}), 'index_codecs': ({'endian': <Endian.little: 'little'>}, {}), 'index_location': <ShardingCodecIndexLocation.end: 'end'>}]
610
+ Filters : ()
611
+ Serializer : BytesCodec(endian=<Endian.little: 'little'>)
612
+ Compressors : (ZstdCodec(level=0, checksum=False),)
604
613
No. bytes : 100000000 (95.4M)
605
614
No. bytes stored : 3981060
606
615
Storage ratio : 25.1
607
- Chunks Initialized : 100
616
+ Shards Initialized : 100
608
617
609
618
In this example a shard shape of (1000, 1000) and a chunk shape of (100, 100) is used.
610
619
This means that 10*10 chunks are stored in each shard, and there are 10*10 shards in total.
0 commit comments