Skip to content

Commit

Permalink
respond to outstanding reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamman committed Dec 21, 2024
1 parent 22a5705 commit 4130c54
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 47 deletions.
4 changes: 2 additions & 2 deletions docs/user-guide/arrays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ useful. E.g.:
zarr.load('data/example-3.zarr')
Please note that there are a number of other options for persistent array
storage, see the section on :ref:`tutorial_storage` below.
storage, see the :ref:`tutorial_storage` guide for more details.

.. _tutorial_resize:

Expand Down Expand Up @@ -367,7 +367,7 @@ That is, the following two calls are equivalent:
Indexing with a mask array
~~~~~~~~~~~~~~~~~~~~~~~~~~

.. Items can also be extracted by providing a Boolean mask. E.g.:
Items can also be extracted by providing a Boolean mask. E.g.:

.. ipython:: python
Expand Down
34 changes: 34 additions & 0 deletions docs/user-guide/attributes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.. _tutorial_attrs:

Working with attributes
=======================

Zarr arrays and groups support custom key/value attributes, which can be useful for
storing application-specific metadata. For example:

.. ipython:: python
root = zarr.group()
root.attrs['foo'] = 'bar'
z = root.zeros(name='zzz', shape=(10000, 10000))
z.attrs['baz'] = 42
z.attrs['qux'] = [1, 4, 7, 12]
sorted(root.attrs)
'foo' in root.attrs
root.attrs['foo']
sorted(z.attrs)
z.attrs['baz']
z.attrs['qux']
Internally Zarr uses JSON to store array attributes, so attribute values must be
JSON serializable.
6 changes: 3 additions & 3 deletions docs/user-guide/consolidated_metadata.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Consolidated Metadata
=====================

Zarr-Python implements the `Consolidated Metadata_` extension to the Zarr Spec.
Zarr-Python implements the `Consolidated Metadata`_ extension to the Zarr Spec.
Consolidated metadata can reduce the time needed to load the metadata for an
entire hierarchy, especially when the metadata is being served over a network.
Consolidated metadata essentially stores all the metadata for a hierarchy in the
Expand All @@ -13,7 +13,7 @@ Usage
If consolidated metadata is present in a Zarr Group's metadata then it is used
by default. The initial read to open the group will need to communicate with
the store (reading from a file for a :class:`zarr.storage.LocalStore`, making a
network request for a :class:`zarr.storage.RemoteStore`). After that, any subsequent
network request for a :class:`zarr.storage.FsspecStore`). After that, any subsequent
metadata reads get child Group or Array nodes will *not* require reads from the store.

In Python, the consolidated metadata is available on the ``.consolidated_metadata``
Expand All @@ -32,7 +32,7 @@ attribute of the ``GroupMetadata`` object.
group.create_array(shape=(3, 3, 3), name="c")
zarr.consolidate_metadata(store)
If we open that group, the Group's metadata has a :class:`zarr.ConsolidatedMetadata`
If we open that group, the Group's metadata has a :class:`zarr.core.group.ConsolidatedMetadata`
that can be used.

.. ipython:: python
Expand Down
35 changes: 0 additions & 35 deletions docs/user-guide/groups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,38 +119,3 @@ Groups also have the :func:`zarr.Group.tree` method, e.g.:

:func:`zarr.Group.tree` requires the optional `rich <https://rich.readthedocs.io/en/stable/>`_
dependency. It can be installed with the ``[tree]`` extra.

.. _tutorial_attrs:

User attributes
---------------

Zarr arrays and groups support custom key/value attributes, which can be useful for
storing application-specific metadata. For example:

.. ipython:: python
root = zarr.group()
root.attrs['foo'] = 'bar'
z = root.zeros(name='zzz', shape=(10000, 10000))
z.attrs['baz'] = 42
z.attrs['qux'] = [1, 4, 7, 12]
sorted(root.attrs)
'foo' in root.attrs
root.attrs['foo']
sorted(z.attrs)
z.attrs['baz']
z.attrs['qux']
Internally Zarr uses JSON to store array attributes, so attribute values must be
JSON serializable.
1 change: 1 addition & 0 deletions docs/user-guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ User Guide
installation
arrays
groups
attributes
storage
config
v3_migration
Expand Down
12 changes: 6 additions & 6 deletions docs/user-guide/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Storage
=======

Zarr-Python supports multiple storage backends, including: local file systems,
Zip files, remote stores via ``fsspec`` (S3, HTTP, etc.), and in-memory stores. In
Zip files, remote stores via fsspec_ (S3, HTTP, etc.), and in-memory stores. In
Zarr-Python 3, stores must implement the abstract store API from
:class:`zarr.abc.store.Store`.

Expand Down Expand Up @@ -58,7 +58,7 @@ Zip Store
~~~~~~~~~

The :class:`zarr.storage.ZipStore` stores the contents of a Zarr hierarchy in a single
Zip file. The `Zip Store specification_` is currently in draft form.
Zip file. The `Zip Store specification`_ is currently in draft form.

.. ipython:: python
Expand All @@ -71,9 +71,9 @@ Remote Store
The :class:`zarr.storage.FsspecStore` stores the contents of a Zarr hierarchy in following the same
logical layout as the ``LocalStore``, except the store is assumed to be on a remote storage system
such as cloud object storage (e.g. AWS S3, Google Cloud Storage, Azure Blob Store). The
:class:`zarr.storage.FsspecStore` is backed by `Fsspec_` and can support any Fsspec backend
:class:`zarr.storage.FsspecStore` is backed by `fsspec`_ and can support any backend
that implements the `AbstractFileSystem` API. ``storage_options`` can be used to configure
the Fsspec backend.
the fsspec backend.

.. ipython:: python
Expand All @@ -87,7 +87,7 @@ the Fsspec backend.
Memory Store
~~~~~~~~~~~~

The :class:`zarr.storage.FsspecStore` a in-memory store that allows for serialization of
The :class:`zarr.storage.MemoryStore` a in-memory store that allows for serialization of
Zarr data (metadata and chunks) to a dictionary.

.. ipython:: python
Expand All @@ -104,4 +104,4 @@ Class includes all of the methods needed to be a fully operational store in Zarr
Zarr also provides a test harness for custom stores: :class:`zarr.testing.store.StoreTests`.

.. _Zip Store Specification: https://github.com/zarr-developers/zarr-specs/pull/311
.. _Fsspec: https://zarr-specs.readthedocs.io/en/latest/v3/core/v3.0.html#consolidated-metadata
.. _fsspec: https://filesystem-spec.readthedocs.io
2 changes: 1 addition & 1 deletion docs/user-guide/v3_migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ after the 3.0 release:

- The following options in the top-level API have not been ported to Zarr-Python 3 yet.
If these options are important to you, please open a
`GitHub issue <https://github.com/zarr-developers/zarr-python/issues/new>` describing
`GitHub issue <https://github.com/zarr-developers/zarr-python/issues/new>`_ describing
your use case.

* ``cache_attrs``
Expand Down

0 comments on commit 4130c54

Please sign in to comment.