Skip to content

Commit 22a5705

Browse files
committed
more mods
1 parent dd3805b commit 22a5705

File tree

13 files changed

+754
-680
lines changed

13 files changed

+754
-680
lines changed

docs/developers/index.rst

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

2-
Developer Guide
3-
---------------
2+
Developer's Guide
3+
-----------------
44

55
.. toctree::
66
:maxdepth: 1

docs/index.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,14 @@ Zarr-Python
99
:hidden:
1010

1111
quickstart
12+
about
1213
user-guide/index
1314
api/index
1415
developers/index
15-
about
16+
developers/release
1617

1718
**Version**: |version|
1819

19-
**Download documentation**: `PDF/Zipped HTML <https://readthedocs.org/projects/zarr/downloads/>`_
20-
21-
**Useful links**:
22-
`Source Repository <https://github.com/zarr-developers/zarr-python>`_ |
23-
`Issue Tracker <https://github.com/zarr-developers/zarr-python/issues>`_ |
24-
`Zulip Chat <https://ossci.zulipchat.com/>`_ |
25-
`Zarr specifications <https://zarr-specs.readthedocs.io>`_
26-
2720
Zarr is a storage format for chunked, compressed, N-dimensional arrays based on an open-source specification. Highlights include:
2821

2922
* Create N-dimensional arrays with any NumPy dtype.
@@ -34,9 +27,6 @@ Zarr is a storage format for chunked, compressed, N-dimensional arrays based on
3427
* Write to an array concurrently from multiple threads or processes.
3528
* Organize arrays into hierarchies via groups.
3629

37-
Zarr-Python Documentation
38-
-------------------------
39-
4030
.. grid:: 2
4131

4232
.. grid-item-card::
@@ -93,23 +83,33 @@ Zarr-Python Documentation
9383
:color: dark
9484
:click-parent:
9585

96-
To the api reference guide
86+
To the API reference guide
9787

9888
.. grid-item-card::
9989
:img-top: _static/index_contribute.svg
10090

101-
Contributor's Guide
102-
^^^^^^^^^^^^^^^^^^^
91+
Developer's Guide
92+
^^^^^^^^^^^^^^^^^
10393

10494
Want to contribute to Zarr? We welcome contributions in the form of bug reports,
10595
bug fixes, documentation, enhancement proposals and more. The contributing
10696
guidelines will guide you through the process of improving Zarr.
10797

10898
+++
10999

110-
.. button-ref:: developers/contributing
100+
.. button-ref:: developers/index
111101
:expand:
112102
:color: dark
113103
:click-parent:
114104

115-
To the contributor's guide
105+
To the developers's guide
106+
107+
**Useful links**:
108+
`Source Repository <https://github.com/zarr-developers/zarr-python>`_ |
109+
`Issue Tracker <https://github.com/zarr-developers/zarr-python/issues>`_ |
110+
`Zulip Chat <https://ossci.zulipchat.com/>`_ |
111+
`Zarr specifications <https://zarr-specs.readthedocs.io>`_
112+
113+
**Download documentation**: `PDF/Zipped HTML <https://readthedocs.org/projects/zarr/downloads/>`_
114+
115+
.. _NumCodecs: https://numcodecs.readthedocs.io

docs/quickstart.rst

Lines changed: 79 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
Quickstart
1111
==========
1212

13-
Welcome to the Zarr-Python Quickstart guide! This page will help you get up and running with the Zarr library in Python to efficiently manage and analyze multi-dimensional arrays.
13+
Welcome to the Zarr-Python Quickstart guide! This page will help you get up and running with
14+
the Zarr library in Python to efficiently manage and analyze multi-dimensional arrays.
1415

15-
Zarr is a powerful library for storage of n-dimensional arrays, supporting chunking, compression, and various backends, making it a versatile choice for scientific and large-scale data.
16+
Zarr is a powerful library for storage of n-dimensional arrays, supporting chunking,
17+
compression, and various backends, making it a versatile choice for scientific and
18+
large-scale data.
1619

1720
Installation
1821
------------
@@ -32,102 +35,136 @@ or `conda`:
3235
Creating an Array
3336
-----------------
3437

35-
To get started, you can create a simple Zarr array using the in-memory store:
38+
To get started, you can create a simple Zarr array:
3639

3740
.. ipython:: python
3841
3942
import zarr
4043
import numpy as np
4144
4245
# Create a 2D Zarr array
43-
z = zarr.zeros((100, 100), chunks=(10, 10), dtype='f4')
46+
z = zarr.zeros(
47+
store="data/example-1.zarr",
48+
shape=(100, 100),
49+
chunks=(10, 10),
50+
dtype="f4"
51+
)
4452
4553
# Assign data to the array
4654
z[:, :] = np.random.random((100, 100))
55+
z.info
4756
48-
print(z.info)
49-
50-
Here, we created a 2D array of shape ``(100, 100)``, chunked into blocks of ``(10, 10)``, and filled it with random floating-point data.
57+
Here, we created a 2D array of shape ``(100, 100)``, chunked into blocks of
58+
``(10, 10)``, and filled it with random floating-point data. This array was
59+
written to a ``LocalStore`` in the ``data/example-1.zarr`` directory.
5160

52-
Persistent Storage
53-
------------------
61+
Compression and Filters
62+
~~~~~~~~~~~~~~~~~~~~~~~
5463

55-
Zarr supports persistent storage to disk or cloud-compatible backends. To store arrays on the filesystem:
64+
Zarr supports data compression and filters. For example, to use Blosc compression:
5665

5766
.. ipython:: python
5867
59-
# Store the array in a directory on disk
68+
from numcodecs import Blosc
69+
6070
z = zarr.open(
61-
'data/example-1.zarr',
62-
mode='w', shape=(100, 100), chunks=(10, 10), dtype='f4'
71+
"data/example-3.zarr",
72+
mode="w", shape=(100, 100),
73+
chunks=(10, 10), dtype="f4",
74+
compressor=Blosc(cname="zstd", clevel=3, shuffle=Blosc.SHUFFLE),
75+
zarr_format=2
6376
)
6477
z[:, :] = np.random.random((100, 100))
6578
66-
print("Array stored at 'data/example-1.zarr'")
79+
z.info
6780
68-
To open an existing array:
69-
70-
.. ipython:: python
71-
72-
z = zarr.open('data/example-1.zarr', mode='r')
73-
print(z[:])
81+
This compresses the data using the Zstandard codec with shuffle enabled for better compression.
7482

7583
Hierarchical Groups
7684
-------------------
7785

78-
Zarr allows creating hierarchical groups, similar to directories:
86+
Zarr allows you to create hierarchical groups, similar to directories:
7987

8088
.. ipython:: python
8189
82-
# Create a group and add arrays
83-
root = zarr.group('data/example-2.zarr')
84-
foo = root.create_array(name='foo', shape=(1000, 100), chunks=(10, 10), dtype='f4')
85-
bar = root.create_array(name='bar', shape=(100,), dtype='i4')
90+
# Create nested groups and add arrays
91+
root = zarr.group("data/example-2.zarr")
92+
foo = root.create_group(name="foo")
93+
bar = root.create_array(
94+
name="bar", shape=(100, 10), chunks=(10, 10)
95+
)
96+
spam = foo.create_array(name="spam", shape=(10,), dtype="i4")
8697
8798
# Assign values
88-
foo[:, :] = np.random.random((1000, 100))
89-
bar[:] = np.arange(100)
99+
bar[:, :] = np.random.random((100, 10))
100+
spam[:] = np.arange(10)
90101
102+
# print the hierarchy
91103
root.tree()
92104
93105
This creates a group with two datasets: ``foo`` and ``bar``.
94106

95-
.. Compression and Filters
96-
.. -----------------------
107+
Persistent Storage
108+
------------------
109+
110+
Zarr supports persistent storage to disk or cloud-compatible backends. While examples above
111+
utilized a :class:`zarr.storage.LocalStore`, a number of other storage options are available,
112+
including the :class:`zarr.storage.ZipStore` and :class:`zarr.storage.FsspecStore`.
97113

98-
.. Zarr supports data compression and filters. For example, to use Blosc compression:
114+
.. ipython:: python
99115
100-
.. .. ipython:: python
101-
.. :verbatim:
116+
# Store the array in a ZIP file
117+
store = zarr.storage.ZipStore("data/example-3.zip", mode='w')
102118
103-
.. z = zarr.open('data/example-3.zarr', mode='w', shape=(100, 100), chunks=(10, 10), dtype='f4',
104-
.. compressor=zarr.Blosc(cname='zstd', clevel=3, shuffle=zarr.Blosc.SHUFFLE))
105-
.. z[:, :] = np.random.random((100, 100))
119+
z = zarr.open(
120+
store=store,
121+
mode="w",
122+
shape=(100, 100),
123+
chunks=(10, 10),
124+
dtype="f4"
125+
)
106126
107-
.. print(z.info)
127+
# write to the array
128+
z[:, :] = np.random.random((100, 100))
108129
109-
.. This compresses the data using the Zstandard codec with shuffle enabled for better compression.
130+
# the ZipStore must be explicitly closed
131+
store.close()
132+
133+
To open an existing array:
134+
135+
.. ipython:: python
136+
137+
# Open the ZipStore in read-only mode
138+
store = zarr.storage.ZipStore("data/example-3.zip", read_only=True)
139+
140+
z = zarr.open(store, mode='r')
141+
142+
# read the data as a NumPy Array
143+
z[:]
110144
111145
Cloud Storage Backends
112-
----------------------
146+
~~~~~~~~~~~~~~~~~~~~~~
113147

114-
Zarr integrates seamlessly with cloud storage such as Amazon S3 and Google Cloud Storage using external libraries like `s3fs` or `gcsfs`.
148+
Zarr integrates seamlessly with cloud storage such as Amazon S3 and Google Cloud Storage
149+
using external libraries like `s3fs <https://s3fs.readthedocs.io>`_ or
150+
`gcsfs <https://gcsfs.readthedocs.io>`_.
115151

116152
For example, to use S3:
117153

118154
.. ipython:: python
119155
:verbatim:
120156
121157
import s3fs
122-
import zarr
123158
124-
z = zarr.open("s3://example-bucket/foo", mode='w', shape=(100, 100), chunks=(10, 10))
159+
z = zarr.open("s3://example-bucket/foo", mode="w", shape=(100, 100), chunks=(10, 10))
125160
z[:, :] = np.random.random((100, 100))
126161
162+
Read more about Zarr's storage options in the `User Guide <user-guide/storage.html>`_.
163+
127164
Next Steps
128165
----------
129166

130167
Now that you're familiar with the basics, explore the following resources:
131168

132-
- `User Guide <guide>`_
169+
- `User Guide <user-guide>`_
133170
- `API Reference <api>`_

0 commit comments

Comments
 (0)