Skip to content

Commit 30d3d70

Browse files
committed
add docs for with_config
1 parent 1407109 commit 30d3d70

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

docs/user-guide/arrays.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,32 @@ z.append(np.vstack([a, a]), axis=1)
154154
print(f"Shape after second append: {z.shape}")
155155
```
156156

157+
## Runtime configuration
158+
159+
Zarr arrays are parametrized with a configuration that determines certain aspects of array behavior.
160+
161+
We currently support two configuration options for arrays: `write_empty_chunks` and `order`.
162+
163+
| field | type | default | description |
164+
| - | - | - | - |
165+
| `write_empty_chunks` | `bool` | `False` | Controls whether empty chunks are written to storage. See [Empty chunks](performance.md#empty-chunks).
166+
| `order` | `Literal["C", "F"]` | `"C"` | The memory layout of arrays returned when reading data from the store.
167+
168+
You can specify the configuration when you create an array with the `config` keyword argument.
169+
`config` can be passed as either a `dict` or an `ArrayConfig` object.
170+
171+
```python exec="true" session="arrays" source="above" result="ansi"
172+
arr = zarr.create_array({}, shape=(10,), dtype='int8', config={"write_empty_chunks": True})
173+
print(arr.config)
174+
```
175+
176+
To get an array view with a different config, use the `with_config` method.
177+
178+
```python exec="true" session="arrays" source="above" result="ansi"
179+
arr_f = arr.with_config({"order": "F"})
180+
print(arr_f.config)
181+
```
182+
157183
## Compressors
158184

159185
A number of different compressors can be used with Zarr. Zarr includes Blosc,

0 commit comments

Comments
 (0)