Skip to content

Commit de9c8aa

Browse files
committed
minor improvements
1 parent 3678df6 commit de9c8aa

File tree

8 files changed

+60
-64
lines changed

8 files changed

+60
-64
lines changed

docs/developers/index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

2+
Developer Guide
3+
---------------
4+
25
.. toctree::
36
:maxdepth: 1
4-
:hidden:
57

6-
release
78
contributing
9+
release
810
roadmap

docs/index.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ Zarr-Python
1111
quickstart
1212
user-guide/index
1313
api/index
14-
developers/contributing
15-
developers/release
14+
developers/index
1615

1716
**Version**: |version|
1817

@@ -24,7 +23,7 @@ Zarr-Python
2423
`Zulip Chat <https://ossci.zulipchat.com/>`_ |
2524
`Zarr specifications <https://zarr-specs.readthedocs.io>`_
2625

27-
Zarr is a file storage format for chunked, compressed, N-dimensional arrays based on an open-source specification. Highlights include:
26+
Zarr is a storage format for chunked, compressed, N-dimensional arrays based on an open-source specification. Highlights include:
2827

2928
* Create N-dimensional arrays with any NumPy dtype.
3029
* Chunk arrays along any dimension.
@@ -45,7 +44,7 @@ Zarr-Python Documentation
4544
Quick Start
4645
^^^^^^^^^^^
4746

48-
New to Zarr? Check out the quick start guide. It contains an
47+
New to Zarr? Check out the quick start guide. It contains a brief
4948
introduction to Zarr's main concepts and links to additional tutorials.
5049

5150
+++
@@ -101,7 +100,9 @@ Zarr-Python Documentation
101100
Contributor's Guide
102101
^^^^^^^^^^^^^^^^^^^
103102

104-
Want to contribute to Zarr? We welcome contributions in the form of bug reports, bug fixes, documentation, enhancement proposals and more. The contributing guidelines will guide you through the process of improving Zarr.
103+
Want to contribute to Zarr? We welcome contributions in the form of bug reports,
104+
bug fixes, documentation, enhancement proposals and more. The contributing
105+
guidelines will guide you through the process of improving Zarr.
105106

106107
+++
107108

docs/quickstart.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. _quickstart:
2-
31
.. ipython::
42
:suppress:
53

docs/user-guide/arrays.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ disk then load back into memory later, the functions
9595
:func:`zarr.convenience.save` and :func:`zarr.convenience.load` may be
9696
useful. E.g.:
9797

98-
.. ipython:: python
98+
.. ipython::
9999
:suppress:
100100

101101
In [144]: rm -r data/example.zarr

docs/user-guide/consolidated_metadata.rst

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,44 +19,43 @@ metadata reads get child Group or Array nodes will *not* require reads from the
1919
In Python, the consolidated metadata is available on the ``.consolidated_metadata``
2020
attribute of the ``GroupMetadata`` object.
2121

22-
.. code-block:: python
22+
.. TODO: remove :okwarning: after warnings are removed
2323
24-
>>> import zarr
25-
>>> store = zarr.storage.MemoryStore({}, mode="w")
26-
>>> group = zarr.open_group(store=store)
27-
>>> group.create_array(shape=(1,), name="a")
28-
>>> group.create_array(shape=(2, 2), name="b")
29-
>>> group.create_array(shape=(3, 3, 3), name="c")
30-
>>> zarr.consolidate_metadata(store)
24+
.. ipython:: python
25+
:okwarning:
26+
27+
import zarr
28+
store = zarr.storage.MemoryStore()
29+
group = zarr.open_group(store=store)
30+
group.create_array(shape=(1,), name="a")
31+
group.create_array(shape=(2, 2), name="b")
32+
group.create_array(shape=(3, 3, 3), name="c")
33+
zarr.consolidate_metadata(store)
3134
3235
If we open that group, the Group's metadata has a :class:`zarr.ConsolidatedMetadata`
3336
that can be used.
3437

35-
.. code-block:: python
38+
.. ipython:: python
3639
37-
>>> consolidated = zarr.open_group(store=store)
38-
>>> consolidated.metadata.consolidated_metadata.metadata
39-
{'b': ArrayV3Metadata(shape=(2, 2), fill_value=np.float64(0.0), ...),
40-
'a': ArrayV3Metadata(shape=(1,), fill_value=np.float64(0.0), ...),
41-
'c': ArrayV3Metadata(shape=(3, 3, 3), fill_value=np.float64(0.0), ...)}
40+
consolidated = zarr.open_group(store=store)
41+
consolidated.metadata.consolidated_metadata.metadata
4242
4343
Operations on the group to get children automatically use the consolidated metadata.
4444

45-
.. code-block:: python
45+
.. ipython:: python
4646
47-
>>> consolidated["a"] # no read / HTTP request to the Store is required
48-
<Array memory://.../a shape=(1,) dtype=float64>
47+
consolidated["a"] # no read / HTTP request to the Store is required
4948
5049
With nested groups, the consolidated metadata is available on the children, recursively.
5150

52-
... code-block:: python
51+
.. ipython:: python
52+
:okwarning:
5353
54-
>>> child = group.create_group("child", attributes={"kind": "child"})
55-
>>> grandchild = child.create_group("child", attributes={"kind": "grandchild"})
56-
>>> consolidated = zarr.consolidate_metadata(store)
54+
child = group.create_group("child", attributes={"kind": "child"})
55+
grandchild = child.create_group("child", attributes={"kind": "grandchild"})
56+
consolidated = zarr.consolidate_metadata(store)
5757
58-
>>> consolidated["child"].metadata.consolidated_metadata
59-
ConsolidatedMetadata(metadata={'child': GroupMetadata(attributes={'kind': 'grandchild'}, zarr_format=3, )}, ...)
58+
consolidated["child"].metadata.consolidated_metadata
6059
6160
Synchronization and Concurrency
6261
-------------------------------

docs/user-guide/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ Advanced Topics
1919
.. toctree::
2020
:maxdepth: 1
2121

22-
consolidated_metadata
2322
async
23+
consolidated_metadata
2424
extending

docs/user-guide/storage.rst

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@ Implicit Store Creation
1818
In most cases, it is not required to create a ``Store`` object explicitly. Passing a string
1919
to Zarr's top level API will result in the store being created automatically.
2020

21-
.. code-block:: python
21+
.. ipython:: python
2222
23-
>>> import zarr
24-
>>> zarr.open("data/foo/bar", mode="r") # implicitly creates a read-only LocalStore
25-
<Group file://data/foo/bar>
26-
>>> zarr.open("s3://foo/bar", mode="r") # implicitly creates a read-only FsspecStore
27-
<Group s3://foo/bar>
28-
>>> data = {}
29-
>>> zarr.open(data, mode="w") # implicitly creates a MemoryStore
30-
<Group memory://4791444288>
23+
import zarr
24+
25+
# implicitly create a writable LocalStore
26+
zarr.open_group("data/foo/bar", mode="w")
27+
28+
# implicitly create a read-only FsspecStore
29+
zarr.open_group("s3://noaa-nwm-retro-v2-zarr-pds", mode="r")
30+
31+
# implicitly creates a MemoryStore
32+
data = {}
33+
zarr.open_group(data, mode="w")
3134
3235
Explicit Store Creation
3336
-----------------------
@@ -42,25 +45,21 @@ Local Store
4245
The :class:`zarr.storage.LocalStore` stores data in a nested set of directories on a local
4346
filesystem.
4447

45-
.. code-block:: python
48+
.. ipython:: python
4649
47-
>>> import zarr
48-
>>> store = zarr.storage.LocalStore("data/foo/bar", read_only=True)
49-
>>> zarr.open(store=store)
50-
<Group file://data/foo/bar>
50+
store = zarr.storage.LocalStore("data/foo/bar", read_only=True)
51+
zarr.open(store=store, mode='r')
5152
5253
Zip Store
5354
~~~~~~~~~
5455

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

58-
.. code-block:: python
59+
.. ipython:: python
5960
60-
>>> import zarr
61-
>>> store = zarr.storage.ZipStore("data.zip", mode="w")
62-
>>> zarr.open(store=store, shape=(2,))
63-
<Array zip://data.zip shape=(2,) dtype=float64
61+
store = zarr.storage.ZipStore("data.zip", mode="w")
62+
zarr.open(store=store, shape=(2,))
6463
6564
Remote Store
6665
~~~~~~~~~~~~
@@ -71,26 +70,22 @@ such as cloud object storage (e.g. AWS S3, Google Cloud Storage, Azure Blob Stor
7170
:class:`zarr.storage.FsspecStore` is backed by `Fsspec_` and can support any Fsspec backend
7271
that implements the `AbstractFileSystem` API,
7372

74-
.. code-block:: python
73+
.. ipython:: python
7574
76-
>>> import zarr
77-
>>> store = zarr.storage.FsspecStore.from_url("gs://foo/bar", read_only=True)
78-
>>> zarr.open(store=store)
79-
<Array <FsspecStore(GCSFileSystem, foo/bar)> shape=(10, 20) dtype=float32>
75+
store = zarr.storage.FsspecStore.from_url("s3://noaa-nwm-retro-v2-zarr-pds", read_only=True)
76+
zarr.open_group(store=store, mode='r')
8077
8178
Memory Store
8279
~~~~~~~~~~~~
8380

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

87-
.. code-block:: python
84+
.. ipython:: python
8885
89-
>>> import zarr
90-
>>> data = {}
91-
>>> store = zarr.storage.MemoryStore(data)
92-
>>> zarr.open(store=store, shape=(2, ))
93-
<Array memory://4943638848 shape=(2,) dtype=float64>
86+
data = {}
87+
store = zarr.storage.MemoryStore(data)
88+
zarr.open(store=store, shape=(2, ))
9489
9590
Developing custom stores
9691
------------------------

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ docs = [
8989
'ipython',
9090
'pickleshare',
9191
'rich',
92+
's3fs',
9293
]
9394

9495
[project.urls]

0 commit comments

Comments
 (0)