@@ -220,12 +220,12 @@ compression, level 1::
220
220
store: dict
221
221
222
222
Here is an example using LZMA with a custom filter pipeline including
223
- the delta filter::
223
+ LZMA's built-in delta filter::
224
224
225
225
>>> import lzma
226
- >>> filters = [dict(id=lzma.FILTER_DELTA, dist=4),
227
- ... dict(id=lzma.FILTER_LZMA2, preset=1)]
228
- >>> compressor = zarr.LZMA(filters=filters )
226
+ >>> lzma_filters = [dict(id=lzma.FILTER_DELTA, dist=4),
227
+ ... dict(id=lzma.FILTER_LZMA2, preset=1)]
228
+ >>> compressor = zarr.LZMA(filters=lzma_filters )
229
229
>>> z = zarr.array(np.arange(100000000, dtype='i4').reshape(10000, 10000),
230
230
... chunks=(1000, 1000), compressor=compressor)
231
231
>>> z
@@ -234,7 +234,28 @@ the delta filter::
234
234
compressor: LZMA(format=1, check=-1, preset=None, filters=[{'dist': 4, 'id': 3}, {'preset': 1, 'id': 33}])
235
235
store: dict
236
236
237
- To disable compression, set ``compressor=None `` when creating an array.
237
+ The default compressor can be changed by setting the value of the
238
+ ``zarr.storage.default_compressor `` variable, e.g.::
239
+
240
+ >>> import zarr.storage
241
+ >>> # switch to using Zstandard via Blosc by default
242
+ ... zarr.storage.default_compressor = zarr.Blosc(cname='zstd', clevel=1, shuffle=1)
243
+ >>> z = zarr.zeros(100000000, chunks=1000000)
244
+ >>> z
245
+ Array((100000000,), float64, chunks=(1000000,), order=C)
246
+ nbytes: 762.9M; nbytes_stored: 302; ratio: 2649006.6; initialized: 0/100
247
+ compressor: Blosc(cname='zstd', clevel=1, shuffle=1)
248
+ store: dict
249
+ >>> # switch back to Blosc defaults
250
+ ... zarr.storage.default_compressor = zarr.Blosc()
251
+
252
+ To disable compression, set ``compressor=None `` when creating an array, e.g.::
253
+
254
+ >>> z = zarr.zeros(100000000, chunks=1000000, compressor=None)
255
+ >>> z
256
+ Array((100000000,), float64, chunks=(1000000,), order=C)
257
+ nbytes: 762.9M; nbytes_stored: 209; ratio: 3827751.2; initialized: 0/100
258
+ store: dict
238
259
239
260
.. _tutorial_filters :
240
261
0 commit comments