@@ -44,8 +44,10 @@ Design goals
4444Usage
4545-----
4646
47- Create an array::
47+ Create an array:
4848
49+ .. code-block ::
50+
4951 >>> import numpy as np
5052 >>> import zarr
5153 >>> z = zarr.empty(shape=(10000, 1000), dtype='i4', chunks=(1000, 100))
@@ -54,16 +56,20 @@ Create an array::
5456 cname: blosclz; clevel: 5; shuffle: 1 (BYTESHUFFLE)
5557 nbytes: 38.1M; cbytes: 0; initialized: 0/100
5658
57- Fill it with some data::
59+ Fill it with some data:
5860
61+ .. code-block ::
62+
5963 >>> z[:] = np.arange(10000000, dtype='i4').reshape(10000, 1000)
6064 >>> z
6165 zarr.ext.SynchronizedArray((10000, 1000), int32, chunks=(1000, 100))
6266 cname: blosclz; clevel: 5; shuffle: 1 (BYTESHUFFLE)
6367 nbytes: 38.1M; cbytes: 2.0M; ratio: 19.3; initialized: 100/100
6468
65- Obtain a NumPy array by slicing::
69+ Obtain a NumPy array by slicing:
6670
71+ .. code-block ::
72+
6773 >>> z[:]
6874 array([[ 0, 1, 2, ..., 997, 998, 999],
6975 [ 1000, 1001, 1002, ..., 1997, 1998, 1999],
@@ -89,8 +95,10 @@ Obtain a NumPy array by slicing::
8995 [9998000, 9998001, 9998002, ..., 9998097, 9998098, 9998099],
9096 [9999000, 9999001, 9999002, ..., 9999097, 9999098, 9999099]], dtype=int32)
9197
92- Resize the array and add more data::
98+ Resize the array and add more data:
9399
100+ .. code-block ::
101+
94102 >>> z.resize(20000, 1000)
95103 >>> z
96104 zarr.ext.SynchronizedArray((20000, 1000), int32, chunks=(1000, 100))
@@ -123,9 +131,9 @@ append data to any axis:
123131 Persistence
124132-----------
125133
126- Create a persistent array (data stored on disk)
134+ Create a persistent array (data stored on disk):
127135
128- .. code-block :: python
136+ .. code-block ::
129137
130138 >>> path = 'example.zarr'
131139 >>> z = zarr.open(path, mode='w', shape=(10000, 1000), dtype='i4', chunks=(1000, 100))
@@ -139,9 +147,9 @@ Create a persistent array (data stored on disk)
139147 There is no need to close a persistent array. Data are automatically flushed
140148to disk.
141149
142- If you're working with really big arrays, try the 'lazy' option
150+ If you're working with really big arrays, try the 'lazy' option:
143151
144- .. code-block :: python
152+ .. code-block ::
145153
146154 >>> path = 'big.zarr'
147155 >>> z = zarr.open(path, mode='w', shape=(1e8, 1e7), dtype='i4', chunks=(1000, 1000), lazy=True)
0 commit comments