Skip to content

Commit d21a075

Browse files
committed
tweak doco
1 parent eb3fd9a commit d21a075

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

README.rst

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ Create a persistent array (data stored on disk)
136136
.. code-block:: python
137137
138138
>>> path = 'example.zarr'
139-
>>> z = zarr.open(path, shape=(10000, 1000), dtype='i4', chunks=(1000, 100))
139+
>>> z = zarr.open(path, mode='w', shape=(10000, 1000), dtype='i4', chunks=(1000, 100))
140140
>>> z[:] = np.arange(10000000, dtype='i4').reshape(10000, 1000)
141141
>>> z
142142
zarr.ext.SynchronizedPersistentArray((10000, 1000), int32, chunks=(1000, 100))
143143
cname: blosclz; clevel: 5; shuffle: 1 (BYTESHUFFLE)
144144
nbytes: 38.1M; cbytes: 2.0M; ratio: 19.3; initialized: 100/100
145-
mode: a; path: example.zarr
145+
mode: w; path: example.zarr
146146
147147
There is no need to close a persistent array. Data are automatically flushed
148148
to disk.
@@ -152,30 +152,39 @@ If you're working with really big arrays, try the 'lazy' option
152152
.. code-block:: python
153153
154154
>>> path = 'big.zarr'
155-
>>> z = zarr.open(path, shape=(1e8, 1e7), dtype='i4', chunks=(1000, 1000), lazy=True)
155+
>>> z = zarr.open(path, mode='w', shape=(1e8, 1e7), dtype='i4', chunks=(1000, 1000), lazy=True)
156156
>>> z
157157
zarr.ext.SynchronizedLazyPersistentArray((100000000, 10000000), int32, chunks=(1000, 1000))
158158
cname: blosclz; clevel: 5; shuffle: 1 (BYTESHUFFLE)
159159
nbytes: 3.6P; cbytes: 0; initialized: 0/1000000000
160-
mode: a; path: big.zarr
160+
mode: w; path: big.zarr
161161
162162
See the [persistence documentation](PERSISTENCE.rst) for more details of the
163163
file format.
164164

165165
Tuning
166166
------
167167

168-
``zarr`` is designed for use in parallel computations working chunk-wise
169-
over data. Try it with `dask.array
170-
<http://dask.pydata.org/en/latest/array.html>`_.
171-
172168
``zarr`` is optimised for accessing and storing data in contiguous slices,
173169
of the same size or larger than chunks. It is not and will never be
174170
optimised for single item access.
175171

176172
Chunks sizes >= 1M are generally good. Optimal chunk shape will depend on
177173
the correlation structure in your data.
178174

175+
``zarr`` is designed for use in parallel computations working
176+
chunk-wise over data. Try it with `dask.array
177+
<http://dask.pydata.org/en/latest/array.html>`_. If using in a
178+
multi-threaded, set zarr to use blosc in contextual mode::
179+
180+
>>> zarr.set_blosc_options(use_context=True)
181+
182+
If using zarr in a single-threaded context, set zarr to use blosc in
183+
non-contextual mode, which allows blosc to use multiple threads
184+
internally::
185+
186+
>>> zarr.set_blosc_options(use_context=False, nthreads=4)
187+
179188
Acknowledgments
180189
---------------
181190

0 commit comments

Comments
 (0)