Skip to content

Commit d88f0c2

Browse files
committed
respond to david's review
1 parent 1001994 commit d88f0c2

File tree

12 files changed

+136
-327
lines changed

12 files changed

+136
-327
lines changed

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Zarr is a file storage format for chunked, compressed, N-dimensional arrays base
5151
.. grid-item-card::
5252
:img-top: _static/index_user_guide.svg
5353

54-
Guide
55-
^^^^^
54+
Guide
55+
^^^^^
5656

5757
A detailed guide for how to use Zarr-Python.
5858

docs/release.rst

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ Enhancements
19061906

19071907
* **Advanced indexing**. The ``Array`` class has several new methods and
19081908
properties that enable a selection of items in an array to be retrieved or
1909-
updated. See the :ref:`tutorial_indexing` tutorial section for more
1909+
updated. See the :ref:`user-guide-indexing` tutorial section for more
19101910
information. There is also a `notebook
19111911
<https://github.com/zarr-developers/zarr-python/blob/main/notebooks/advanced_indexing.ipynb>`_
19121912
with extended examples and performance benchmarks. :issue:`78`, :issue:`89`,
@@ -1919,15 +1919,15 @@ Enhancements
19191919
compressor codecs for Zstd and LZ4. This change is backwards-compatible with
19201920
existing code, as all codec classes defined by Numcodecs are imported into the
19211921
:mod:`zarr.codecs` namespace. However, it is recommended to import codecs from
1922-
the new package, see the tutorial sections on :ref:`tutorial_compress` and
1923-
:ref:`tutorial_filters` for examples. With contributions by
1922+
the new package, see the tutorial sections on :ref:`user-guide-compress` and
1923+
:ref:`user-guide-filters` for examples. With contributions by
19241924
:user:`John Kirkham <jakirkham>`; :issue:`74`, :issue:`102`, :issue:`120`,
19251925
:issue:`123`, :issue:`139`.
19261926

19271927
* **New storage class for DBM-style databases**. The
19281928
:class:`zarr.storage.DBMStore` class enables any DBM-style database such as gdbm,
19291929
ndbm or Berkeley DB, to be used as the backing store for an array or group. See the
1930-
tutorial section on :ref:`tutorial_storage` for some examples. :issue:`133`,
1930+
tutorial section on :ref:`user-guide-storage` for some examples. :issue:`133`,
19311931
:issue:`186`.
19321932

19331933
* **New storage class for LMDB databases**. The :class:`zarr.storage.LMDBStore` class
@@ -1943,7 +1943,7 @@ Enhancements
19431943
:func:`zarr.hierarchy.Group.tree` method which enables a tree representation of
19441944
a group hierarchy to be printed. Also provides an interactive tree
19451945
representation when used within a Jupyter notebook. See the
1946-
:ref:`tutorial_diagnostics` tutorial section for examples. By
1946+
:ref:`user-guide-diagnostics` tutorial section for examples. By
19471947
:user:`John Kirkham <jakirkham>`; :issue:`82`, :issue:`140`, :issue:`184`.
19481948

19491949
* **Visitor API**. The ``Group`` class now implements the h5py visitor API, see
@@ -1963,7 +1963,7 @@ Enhancements
19631963
store. The functions :func:`zarr.convenience.save` and
19641964
:func:`zarr.convenience.load` are also available and provide a convenient way to
19651965
save an entire NumPy array to disk and load back into memory later. See the
1966-
tutorial section :ref:`tutorial_persist` for examples. :issue:`104`,
1966+
tutorial section :ref:`user-guide-persist` for examples. :issue:`104`,
19671967
:issue:`105`, :issue:`141`, :issue:`181`.
19681968

19691969
* **IPython completions**. The ``Group`` class now implements ``__dir__()`` and
@@ -1973,15 +1973,15 @@ Enhancements
19731973
* **New info property; changes to __repr__**. The ``Group`` and
19741974
``Array`` classes have a new ``info`` property which can be used to print
19751975
diagnostic information, including compression ratio where available. See the
1976-
tutorial section on :ref:`tutorial_diagnostics` for examples. The string
1976+
tutorial section on :ref:`user-guide-diagnostics` for examples. The string
19771977
representation (``__repr__``) of these classes has been simplified to ensure
19781978
it is cheap and quick to compute in all circumstances. :issue:`83`,
19791979
:issue:`115`, :issue:`132`, :issue:`148`.
19801980

19811981
* **Chunk options**. When creating an array, ``chunks=False`` can be specified,
19821982
which will result in an array with a single chunk only. Alternatively,
19831983
``chunks=True`` will trigger an automatic chunk shape guess. See
1984-
:ref:`tutorial_chunks` for more on the ``chunks`` parameter. :issue:`106`,
1984+
:ref:`user-guide-chunks` for more on the ``chunks`` parameter. :issue:`106`,
19851985
:issue:`107`, :issue:`183`.
19861986

19871987
* **Zero-dimensional arrays** and are now supported; by
@@ -2006,7 +2006,7 @@ Enhancements
20062006
creating an array with ``dtype=object`` was possible but could under certain
20072007
circumstances lead to unexpected errors and/or segmentation faults. To make it easier
20082008
to properly configure an object array, a new ``object_codec`` parameter has been
2009-
added to array creation functions. See the tutorial section on :ref:`tutorial_objects`
2009+
added to array creation functions. See the tutorial section on :ref:`user-guide-objects`
20102010
for more information and examples. Also, runtime checks have been added in both Zarr
20112011
and Numcodecs so that segmentation faults are no longer possible, even with a badly
20122012
configured array. This API change is backwards compatible and previous code that created
@@ -2062,16 +2062,16 @@ Documentation
20622062
with any of the material as previously implemented, and so the changes have been made
20632063
in-place in the document without incrementing the document version number. See the
20642064
section on changes in the specification document for more information.
2065-
* A new :ref:`tutorial_indexing` section has been added to the tutorial.
2066-
* A new :ref:`tutorial_strings` section has been added to the tutorial
2065+
* A new :ref:`user-guide-indexing` section has been added to the tutorial.
2066+
* A new :ref:`user-guide-strings` section has been added to the tutorial
20672067
(:issue:`135`, :issue:`175`).
2068-
* The :ref:`tutorial_chunks` tutorial section has been reorganised and updated.
2069-
* The :ref:`tutorial_persist` and :ref:`tutorial_storage` tutorial sections have
2068+
* The :ref:`user-guide-chunks` tutorial section has been reorganised and updated.
2069+
* The :ref:`user-guide-persist` and :ref:`user-guide-storage` tutorial sections have
20702070
been updated with new examples (:issue:`100`, :issue:`101`, :issue:`103`).
2071-
* A new tutorial section on :ref:`tutorial_pickle` has been added (:issue:`91`).
2072-
* A new tutorial section on :ref:`tutorial_datetime` has been added.
2073-
* A new tutorial section on :ref:`tutorial_diagnostics` has been added.
2074-
* The tutorial sections on :ref:`tutorial_sync` and :ref:`tutorial_tips_blosc` have been
2071+
* A new tutorial section on :ref:`user-guide-pickle` has been added (:issue:`91`).
2072+
* A new tutorial section on :ref:`user-guide-datetime` has been added.
2073+
* A new tutorial section on :ref:`user-guide-diagnostics` has been added.
2074+
* The tutorial sections on :ref:`user-guide-sync` and :ref:`user-guide-tips-blosc` have been
20752075
updated to provide information about how to avoid program hangs when using the Blosc
20762076
compressor with multiple processes (:issue:`199`, :issue:`201`).
20772077

@@ -2177,14 +2177,14 @@ Hierarchies
21772177
~~~~~~~~~~~
21782178

21792179
Support has been added for organizing arrays into hierarchies via groups. See
2180-
the tutorial section on :ref:`tutorial_groups` and the :mod:`zarr.hierarchy`
2180+
the tutorial section on :ref:`user-guide-groups` and the :mod:`zarr.hierarchy`
21812181
API docs for more information.
21822182

21832183
Filters
21842184
~~~~~~~
21852185

21862186
Support has been added for configuring filters to preprocess chunk data prior
2187-
to compression. See the tutorial section on :ref:`tutorial_filters` and the
2187+
to compression. See the tutorial section on :ref:`user-guide-filters` and the
21882188
:mod:`zarr.codecs` API docs for more information.
21892189

21902190
Other changes
@@ -2210,7 +2210,7 @@ Thanks to :user:`Matthew Rocklin <mrocklin>`, :user:`Stephan Hoyer <shoyer>` and
22102210

22112211
* The bundled Blosc library has been upgraded to version 1.10.0. The 'zstd'
22122212
internal compression library is now available within Blosc. See the tutorial
2213-
section on :ref:`tutorial_compress` for an example.
2213+
section on :ref:`user-guide-compress` for an example.
22142214
* When using the Blosc compressor, the default internal compression library
22152215
is now 'lz4'.
22162216
* The default number of internal threads for the Blosc compressor has been
@@ -2236,8 +2236,8 @@ The main motivation for re-organizing the code was to create an
22362236
abstraction layer between the core array logic and data storage (:issue:`21`).
22372237
In this release, any
22382238
object that implements the ``MutableMapping`` interface can be used as
2239-
an array store. See the tutorial sections on :ref:`tutorial_persist`
2240-
and :ref:`tutorial_storage`, the ``spec_v1``, and the
2239+
an array store. See the tutorial sections on :ref:`user-guide-persist`
2240+
and :ref:`user-guide-storage`, the ``spec_v1``, and the
22412241
:mod:`zarr.storage` module documentation for more information.
22422242

22432243
Please note also that the file organization and file name conventions
@@ -2256,8 +2256,8 @@ chunks. This release still bundles the c-blosc library and uses Blosc
22562256
as the default compressor, however other compressors including zlib,
22572257
BZ2 and LZMA are also now supported via the Python standard
22582258
library. New compressors can also be dynamically registered for use
2259-
with Zarr. See the tutorial sections on :ref:`tutorial_compress` and
2260-
:ref:`tutorial_tips_blosc`, the ``spec_v1``, and the
2259+
with Zarr. See the tutorial sections on :ref:`user-guide-compress` and
2260+
:ref:`user-guide-tips-blosc`, the ``spec_v1``, and the
22612261
:mod:`zarr.compressors` module documentation for more information.
22622262

22632263
Synchronization
@@ -2266,7 +2266,7 @@ Synchronization
22662266
The synchronization code has also been refactored to create a layer of
22672267
abstraction, enabling Zarr arrays to be used in parallel computations
22682268
with a number of alternative synchronization methods. For more
2269-
information see the tutorial section on :ref:`tutorial_sync` and the
2269+
information see the tutorial section on :ref:`user-guide-sync` and the
22702270
:mod:`zarr.sync` module documentation.
22712271

22722272
Changes to the Blosc extension
@@ -2288,7 +2288,7 @@ is running within a single-threaded or multi-threaded program and
22882288
adapts its internal behaviour accordingly (:issue:`27`). There is no need for
22892289
the user to make any API calls to switch Blosc between contextual and
22902290
non-contextual (global lock) mode. See also the tutorial section on
2291-
:ref:`tutorial_tips_blosc`.
2291+
:ref:`user-guide-tips-blosc`.
22922292

22932293
Other changes
22942294
~~~~~~~~~~~~~
@@ -2302,7 +2302,7 @@ option present in the previous release, and this has been removed.
23022302
The memory layout within chunks can now be set as either "C"
23032303
(row-major) or "F" (column-major), which can help to provide better
23042304
compression for some data (:issue:`7`). See the tutorial
2305-
section on :ref:`tutorial_chunks_order` for more information.
2305+
section on :ref:`user-guide-chunks-order` for more information.
23062306

23072307
A bug has been fixed within the ``__getitem__`` and ``__setitem__``
23082308
machinery for slicing arrays, to properly handle getting and setting

docs/user-guide/arrays.rst

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
.. _user-guide-arrays:
12

2-
Working with Arrays
3+
Working with arrays
34
===================
45

5-
.. ipython::
6+
.. ipython:: python
67
:suppress:
78
8-
In [144]: rm -r data/
9+
rm -r data/
910
1011
Creating an array
1112
-----------------
@@ -30,17 +31,17 @@ The code above creates a 2-dimensional array of 32-bit integers with 10000 rows
3031
and 10000 columns, divided into chunks where each chunk has 1000 rows and 1000
3132
columns (and so there will be 100 chunks in total). The data is written to a
3233
:class:`zarr.storage.MemoryStore` (e.g. an in-memory dict). See
33-
:ref:`tutorial_persist` for details on storing arrays in other stores.
34+
:ref:`user-guide-persist` for details on storing arrays in other stores.
3435

35-
For a complete list of array creation routines see the :mod:`zarr.api.synchronous`
36+
For a complete list of array creation routines see the :mod:`zarr`
3637
module documentation.
3738

38-
.. _tutorial_array:
39+
.. _user-guide-array:
3940

4041
Reading and writing data
4142
------------------------
4243

43-
Zarr arrays support a similar interface to `NumPy <https://numpy.org/doc/stable/>`
44+
Zarr arrays support a similar interface to `NumPy <https://numpy.org/doc/stable/>`_
4445
arrays for reading and writing data. For example, the entire array can be filled
4546
with a scalar value:
4647

@@ -68,14 +69,18 @@ requested region into memory as a NumPy array, e.g.:
6869
z[:, 0]
6970
z[:]
7071
71-
.. _tutorial_persist:
72+
Read more about NumPy-style indexing can be found in the
73+
`NumPy documentation <https://numpy.org/doc/stable/user/basics.indexing.html>`_.
74+
75+
.. _user-guide-persist:
7276

7377
Persistent arrays
7478
-----------------
7579

7680
In the examples above, compressed data for each chunk of the array was stored in
7781
main memory. Zarr arrays can also be stored on a file system, enabling
78-
persistence of data between sessions. For example:
82+
persistence of data between sessions. To do this, we can change the store
83+
argument to point to a filesystem path:
7984

8085
.. ipython:: python
8186
@@ -88,7 +93,7 @@ persistence of data between sessions. For example:
8893
)
8994
9095
The array above will store its configuration metadata and all compressed chunk
91-
data in a directory called ``'data/example.zarr'`` relative to the current working
96+
data in a directory called ``'data/example-2.zarr'`` relative to the current working
9297
directory. The :func:`zarr.open` function provides a convenient way
9398
to create a new persistent array or continue working with an existing
9499
array. Note that although the function is called "open", there is no need to
@@ -123,9 +128,9 @@ useful. E.g.:
123128
zarr.load('data/example-3.zarr')
124129
125130
Please note that there are a number of other options for persistent array
126-
storage, see the :ref:`tutorial_storage` guide for more details.
131+
storage, see the :ref:`Storage Guide <user-guide-storage>` guide for more details.
127132

128-
.. _tutorial_resize:
133+
.. _user-guide-resize:
129134

130135
Resizing and appending
131136
----------------------
@@ -161,7 +166,7 @@ used to append data to any axis. E.g.:
161166
z.append(np.vstack([a, a]), axis=1)
162167
z.shape
163168
164-
.. _tutorial_compress:
169+
.. _user-guide-compress:
165170

166171
Compressors
167172
-----------
@@ -187,7 +192,7 @@ algorithm (compression level 3) internally within Blosc, and with the
187192
bit-shuffle filter applied.
188193

189194
When using a compressor, it can be useful to get some diagnostics on the
190-
compression ratio. Zarr arrays provide the :func:`zarr.Array.info` property
195+
compression ratio. Zarr arrays provide the :property:`zarr.Array.info` property
191196
which can be used to print useful diagnostics, e.g.:
192197

193198
.. ipython:: python
@@ -201,6 +206,11 @@ prints additional diagnostics, e.g.:
201206
202207
z.info_complete()
203208
209+
.. note::
210+
:func:`zarr.Array.info_complete` will inspect the underlying store and may
211+
be slow for large arrays. Use :property:`zarr.Array.info` if detailed storage
212+
statistics are not needed.
213+
204214
If you don't specify a compressor, by default Zarr uses the Blosc
205215
compressor. Blosc is generally very fast and can be configured in a variety of
206216
ways to improve the compression ratio for different types of data. Blosc is in
@@ -252,7 +262,7 @@ built-in delta filter:
252262
None # TODO: z.compressor
253263
254264
The default compressor can be changed by setting the value of the using Zarr's
255-
:ref:`config`, e.g.:
265+
:ref:`user-guide-config`, e.g.:
256266

257267
.. ipython:: python
258268
@@ -269,7 +279,7 @@ To disable compression, set ``compressor=None`` when creating an array, e.g.:
269279
# TODO: remove zarr_format
270280
z = zarr.zeros(100000000, chunks=1000000, compressor=None, zarr_format=2)
271281
z
272-
.. _tutorial_filters:
282+
.. _user-guide-filters:
273283

274284
Filters
275285
-------
@@ -301,7 +311,7 @@ Here is an example using a delta filter with the Blosc compressor:
301311
For more information about available filter codecs, see the `Numcodecs
302312
<https://numcodecs.readthedocs.io/>`_ documentation.
303313

304-
.. _tutorial_indexing:
314+
.. _user-guide-indexing:
305315

306316
Advanced indexing
307317
-----------------
@@ -522,7 +532,44 @@ Any combination of integer and slice can be used for block indexing:
522532
bar[:] = np.arange(100)
523533
root.tree()
524534
535+
.. _user-guide-sharding:
536+
525537
Sharding
526538
--------
527539

528540
Coming soon.
541+
542+
543+
Missing features in 3.0
544+
-----------------------
545+
546+
547+
The following features have not been ported to 3.0 yet.
548+
549+
.. _user-guide-objects:
550+
551+
Object arrays
552+
~~~~~~~~~~~~~
553+
554+
See the Zarr-Python 2 documentation on `Object arrays <https://zarr.readthedocs.io/en/support-v2/tutorial.html#object-arrays>`_ for more details.
555+
556+
.. _user-guide-strings:
557+
558+
Fixed-length string arrays
559+
~~~~~~~~~~~~~~~~~~~~~~~~~~
560+
561+
See the Zarr-Python 2 documentation on `Fixed-length string arrays <https://zarr.readthedocs.io/en/support-v2/tutorial.html#string-arrays>`_ for more details.
562+
563+
.. _user-guide-datetime:
564+
565+
Datetime and Timedelta arrays
566+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
567+
568+
See the Zarr-Python 2 documentation on `Datetime and Timedelta <https://zarr.readthedocs.io/en/support-v2/tutorial.html#datetimes-and-timedeltas>`_ for more details.
569+
570+
.. _user-guide-copy:
571+
572+
Copying and migrating data
573+
~~~~~~~~~~~~~~~~~~~~~~~~~~
574+
575+
See the Zarr-Python 2 documentation on `Copying and migrating data <https://zarr.readthedocs.io/en/support-v2/tutorial.html#copying-migrating-data>`_ for more details.

docs/user-guide/attributes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _tutorial_attrs:
1+
.. _user-guide-attrs:
22

33
Working with attributes
44
=======================

docs/user-guide/config.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _config:
1+
.. _user-guide-config:
22

33
Runtime configuration
44
=====================
@@ -8,11 +8,17 @@ and is based on the `donfig <https://github.com/pytroll/donfig>`_ Python library
88

99
Configuration values can be set using code like the following:
1010

11-
.. code-block:: python
11+
.. ipython:: python
1212
1313
import zarr
1414
zarr.config.set({"array.order": "F"})
1515
16+
.. ipython:: python
17+
:suppress:
18+
19+
# revert this change so it doesn't impact the rest of the docs
20+
zarr.config.set({"array.order": "C"})
21+
1622
Alternatively, configuration values can be set using environment variables, e.g.
1723
``ZARR_ARRAY__ORDER=F``.
1824

0 commit comments

Comments
 (0)