Skip to content

Commit afc5d34

Browse files
committed
Use cards on homepage for now
1 parent a3db0d5 commit afc5d34

File tree

4 files changed

+207
-165
lines changed

4 files changed

+207
-165
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ repos:
2020
rev: v5.0.0
2121
hooks:
2222
- id: check-yaml
23+
exclude: mkdocs.yml
2324
- id: trailing-whitespace
2425
- repo: https://github.com/pre-commit/mirrors-mypy
2526
rev: v1.16.1

docs/index.md

Lines changed: 22 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -33,187 +33,45 @@ or `conda`:
3333
conda install --channel conda-forge zarr
3434
```
3535

36-
## Quick Start 🚀
37-
38-
This section will help you get up and running with
39-
the Zarr library in Python to efficiently manage and analyze multi-dimensional arrays.
40-
41-
### Creating an Array
42-
43-
To get started, you can create a simple Zarr array:
44-
45-
```python
46-
import zarr
47-
import numpy as np
48-
49-
# Create a 2D Zarr array
50-
z = zarr.create_array(
51-
store="data/example-1.zarr",
52-
shape=(100, 100),
53-
chunks=(10, 10),
54-
dtype="f4"
55-
)
56-
57-
# Assign data to the array
58-
z[:, :] = np.random.random((100, 100))
59-
z.info
60-
61-
# Type : Array
62-
# Zarr format : 3
63-
# Data type : DataType.float32
64-
# Shape : (100, 100)
65-
# Chunk shape : (10, 10)
66-
# Order : C
67-
# Read-only : False
68-
# Store type : LocalStore
69-
# Codecs : [{'endian': <Endian.little: 'little'>}, {'level': 0, 'checksum': False}]
70-
# No. bytes : 40000 (39.1K)
71-
```
72-
73-
Here, we created a 2D array of shape `(100, 100)`, chunked into blocks of
74-
`(10, 10)`, and filled it with random floating-point data. This array was
75-
written to a `LocalStore` in the `data/example-1.zarr` directory.
76-
77-
#### Compression and Filters
78-
79-
Zarr supports data compression and filters. For example, to use Blosc compression:
80-
81-
```python
82-
z = zarr.create_array(
83-
"data/example-3.zarr",
84-
mode="w", shape=(100, 100),
85-
chunks=(10, 10), dtype="f4",
86-
compressors=zarr.codecs.BloscCodec(cname="zstd", clevel=3, shuffle=zarr.codecs.BloscShuffle.shuffle)
87-
)
88-
z[:, :] = np.random.random((100, 100))
89-
z.info
90-
# Type : Array
91-
# Zarr format : 3
92-
# Data type : DataType.float32
93-
# Shape : (100, 100)
94-
# Chunk shape : (10, 10)
95-
# Order : C
96-
# Read-only : False
97-
# Store type : LocalStore
98-
# Codecs : [{'endian': <Endian.little: 'little'>}, {'level': 0, 'checksum': False}]
99-
# No. bytes : 40000 (39.1K)
100-
```
101-
102-
This compresses the data using the Zstandard codec with shuffle enabled for better compression.
103-
104-
### Hierarchical Groups
36+
## Navigating the documentation
10537

106-
Zarr allows you to create hierarchical groups, similar to directories:
38+
<div class="grid cards" markdown>
10739

108-
```python
109-
# Create nested groups and add arrays
110-
root = zarr.group("data/example-2.zarr")
111-
foo = root.create_group(name="foo")
112-
bar = root.create_array(
113-
name="bar", shape=(100, 10), chunks=(10, 10), dtype="f4"
114-
)
115-
spam = foo.create_array(name="spam", shape=(10,), dtype="i4")
40+
- [:material-clock-fast:{ .lg .middle } __Quick start__](quick-start.md)
11641

117-
# Assign values
118-
bar[:, :] = np.random.random((100, 10))
119-
spam[:] = np.arange(10)
42+
---
12043

121-
# print the hierarchy
122-
root.tree()
123-
# /
124-
# ├── bar (100, 10) float32
125-
# └── foo
126-
# └── spam (10,) int32
127-
```
44+
New to Zarr? Check out the quick start guide. It contains a brief
45+
introduction to Zarr's main concepts and links to additional tutorials.
12846

129-
This creates a group with two datasets: `foo` and `bar`.
130-
131-
#### Batch Hierarchy Creation
132-
133-
Zarr provides tools for creating a collection of arrays and groups with a single function call.
134-
Suppose we want to copy existing groups and arrays into a new storage backend:
135-
136-
```python
137-
# Create nested groups and add arrays
138-
root = zarr.group("data/example-3.zarr", attributes={'name': 'root'})
139-
foo = root.create_group(name="foo")
140-
bar = root.create_array(
141-
name="bar", shape=(100, 10), chunks=(10, 10), dtype="f4"
142-
)
143-
nodes = {'': root.metadata} | {k: v.metadata for k,v in root.members()}
144-
print(nodes)
145-
from zarr.storage import MemoryStore
146-
new_nodes = dict(zarr.create_hierarchy(store=MemoryStore(), nodes=nodes))
147-
new_root = new_nodes['']
148-
assert new_root.attrs == root.attrs
149-
```
15047

151-
Note that `zarr.create_hierarchy` will only initialize arrays and groups -- copying array data must
152-
be done in a separate step.
48+
- [:material-book-open:{ .lg .middle } __User guide__](user-guide/installation.md)
15349

154-
### Persistent Storage
50+
---
15551

156-
Zarr supports persistent storage to disk or cloud-compatible backends. While examples above
157-
utilized a `zarr.storage.LocalStore`, a number of other storage options are available.
52+
A detailed guide for how to use Zarr-Python.
15853

159-
Zarr integrates seamlessly with cloud object storage such as Amazon S3 and Google Cloud Storage
160-
using external libraries like [s3fs](https://s3fs.readthedocs.io) or
161-
[gcsfs](https://gcsfs.readthedocs.io):
16254

163-
```python
164-
import s3fs
55+
- [:material-api:{ .lg .middle } __API Reference__](api/open.md)
16556

166-
z = zarr.create_array("s3://example-bucket/foo", mode="w", shape=(100, 100), chunks=(10, 10), dtype="f4")
167-
z[:, :] = np.random.random((100, 100))
168-
```
57+
---
16958

170-
A single-file store can also be created using the `zarr.storage.ZipStore`:
59+
The reference guide contains a detailed description of the functions, modules,
60+
and objects included in Zarr. The reference describes how the methods work and
61+
which parameters can be used. It assumes that you have an understanding of the
62+
key concepts.
17163

172-
```python
173-
# Store the array in a ZIP file
174-
store = zarr.storage.ZipStore("data/example-3.zip", mode='w')
17564

176-
z = zarr.create_array(
177-
store=store,
178-
mode="w",
179-
shape=(100, 100),
180-
chunks=(10, 10),
181-
dtype="f4"
182-
)
65+
- [:material-account-group:{ .lg .middle } __Contributor's Guide__](contributing.md)
18366

184-
# write to the array
185-
z[:, :] = np.random.random((100, 100))
67+
---
18668

187-
# the ZipStore must be explicitly closed
188-
store.close()
189-
```
69+
Want to contribute to Zarr? We welcome contributions in the form of bug reports,
70+
bug fixes, documentation, enhancement proposals and more. The contributing guidelines
71+
will guide you through the process of improving Zarr.
19072

191-
To open an existing array from a ZIP file:
192-
193-
```python
194-
# Open the ZipStore in read-only mode
195-
store = zarr.storage.ZipStore("data/example-3.zip", read_only=True)
196-
197-
z = zarr.open_array(store, mode='r')
198-
199-
# read the data as a NumPy Array
200-
z[:]
201-
# array([[0.66734236, 0.15667458, 0.98720884, ..., 0.36229587, 0.67443246,
202-
# 0.34315267],
203-
# [0.65787303, 0.9544212 , 0.4830079 , ..., 0.33097172, 0.60423803,
204-
# 0.45621237],
205-
# [0.27632037, 0.9947008 , 0.42434934, ..., 0.94860053, 0.6226942 ,
206-
# 0.6386924 ],
207-
# ...,
208-
# [0.12854576, 0.934397 , 0.19524333, ..., 0.11838563, 0.4967675 ,
209-
# 0.43074256],
210-
# [0.82029045, 0.4671437 , 0.8090906 , ..., 0.7814118 , 0.42650765,
211-
# 0.95929915],
212-
# [0.4335856 , 0.7565437 , 0.7828931 , ..., 0.48119593, 0.66220033,
213-
# 0.6652362 ]], shape=(100, 100), dtype=float32)
214-
```
73+
</div>
21574

216-
Read more about Zarr's storage options in the [User Guide](user-guide/storage.md).
21775

21876
## Project Status
21977

@@ -224,7 +82,7 @@ If you are using Zarr-Python, we would [love to hear about it](https://github.co
22482
### Funding and Support
22583
The project is fiscally sponsored by [NumFOCUS](https://numfocus.org/), a US
22684
501(c)(3) public charity, and development has been supported by the
227-
[MRC Centre for Genomics and Global Health](https://www.cggh.org)
85+
[MRC Centre for Genomics and Global Health](https://www.sanger.ac.uk/collaboration/mrc-centre-genomics-and-global-health-cggh/)
22886
and the [Chan Zuckerberg Initiative](https://chanzuckerberg.com/).
22987

23088
[Donate to Zarr](https://numfocus.org/donate-to-zarr) to support the project!

0 commit comments

Comments
 (0)