@@ -155,12 +155,14 @@ which can be used to append data to any axis. E.g.::
155155 compressor: Blosc(cname='lz4', clevel=5, shuffle=1)
156156 store: dict
157157 >>> z.append(a)
158+ (20000, 1000)
158159 >>> z
159160 Array((20000, 1000), int32, chunks=(1000, 100), order=C)
160161 nbytes: 76.3M; nbytes_stored: 3.8M; ratio: 20.3; initialized: 200/200
161162 compressor: Blosc(cname='lz4', clevel=5, shuffle=1)
162163 store: dict
163164 >>> z.append(np.vstack([a, a]), axis=1)
165+ (20000, 2000)
164166 >>> z
165167 Array((20000, 2000), int32, chunks=(1000, 100), order=C)
166168 nbytes: 152.6M; nbytes_stored: 7.5M; ratio: 20.3; initialized: 400/400
@@ -220,12 +222,12 @@ compression, level 1::
220222 store: dict
221223
222224Here is an example using LZMA with a custom filter pipeline including
223- the delta filter::
225+ LZMA's built-in delta filter::
224226
225227 >>> 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 )
228+ >>> lzma_filters = [dict(id=lzma.FILTER_DELTA, dist=4),
229+ ... dict(id=lzma.FILTER_LZMA2, preset=1)]
230+ >>> compressor = zarr.LZMA(filters=lzma_filters )
229231 >>> z = zarr.array(np.arange(100000000, dtype='i4').reshape(10000, 10000),
230232 ... chunks=(1000, 1000), compressor=compressor)
231233 >>> z
@@ -234,7 +236,28 @@ the delta filter::
234236 compressor: LZMA(format=1, check=-1, preset=None, filters=[{'dist': 4, 'id': 3}, {'preset': 1, 'id': 33}])
235237 store: dict
236238
237- To disable compression, set ``compressor=None `` when creating an array.
239+ The default compressor can be changed by setting the value of the
240+ ``zarr.storage.default_compressor `` variable, e.g.::
241+
242+ >>> import zarr.storage
243+ >>> # switch to using Zstandard via Blosc by default
244+ ... zarr.storage.default_compressor = zarr.Blosc(cname='zstd', clevel=1, shuffle=1)
245+ >>> z = zarr.zeros(100000000, chunks=1000000)
246+ >>> z
247+ Array((100000000,), float64, chunks=(1000000,), order=C)
248+ nbytes: 762.9M; nbytes_stored: 302; ratio: 2649006.6; initialized: 0/100
249+ compressor: Blosc(cname='zstd', clevel=1, shuffle=1)
250+ store: dict
251+ >>> # switch back to Blosc defaults
252+ ... zarr.storage.default_compressor = zarr.Blosc()
253+
254+ To disable compression, set ``compressor=None `` when creating an array, e.g.::
255+
256+ >>> z = zarr.zeros(100000000, chunks=1000000, compressor=None)
257+ >>> z
258+ Array((100000000,), float64, chunks=(1000000,), order=C)
259+ nbytes: 762.9M; nbytes_stored: 209; ratio: 3827751.2; initialized: 0/100
260+ store: dict
238261
239262.. _tutorial_filters :
240263
@@ -321,8 +344,8 @@ This array is safe to read or write within a multi-threaded program.
321344Zarr also provides support for process synchronization via file locking,
322345provided that all processes have access to a shared file system. E.g.::
323346
324- >>> synchronizer = zarr.ProcessSynchronizer('example.zarr ')
325- >>> z = zarr.open_array('example.zarr ', mode='w', shape=(10000, 10000),
347+ >>> synchronizer = zarr.ProcessSynchronizer('example.sync ')
348+ >>> z = zarr.open_array('example', mode='w', shape=(10000, 10000),
326349 ... chunks=(1000, 1000), dtype='i4',
327350 ... synchronizer=synchronizer)
328351 >>> z
0 commit comments