File: config.md

package info (click to toggle)
zarr 3.1.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,068 kB
  • sloc: python: 31,589; makefile: 10
file content (50 lines) | stat: -rw-r--r-- 1,831 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Runtime configuration

[`zarr.config`][] is responsible for managing the configuration of zarr and
is based on the [donfig](https://github.com/pytroll/donfig) Python library.

Configuration values can be set using code like the following:

```python exec="true" session="config" source="above" result="ansi"

import zarr

print(zarr.config.get('array.order'))
```

```python exec="true" session="config" source="above" result="ansi"
zarr.config.set({'array.order': 'F'})

print(zarr.config.get('array.order'))
```

Alternatively, configuration values can be set using environment variables, e.g.
`ZARR_ARRAY__ORDER=F`.

The configuration can also be read from a YAML file in standard locations.
For more information, see the
[donfig documentation](https://donfig.readthedocs.io/en/latest/).

Configuration options include the following:

- Default Zarr format `default_zarr_version`
- Default array order in memory `array.order`
- Whether empty chunks are written to storage `array.write_empty_chunks`
- Async and threading options, e.g. `async.concurrency` and `threading.max_workers`
- Selections of implementations of codecs, codec pipelines and buffers
- Enabling GPU support with `zarr.config.enable_gpu()`. See GPU support for more.

For selecting custom implementations of codecs, pipelines, buffers and ndbuffers,
first register the implementations in the registry and then select them in the config.
For example, an implementation of the bytes codec in a class `'custompackage.NewBytesCodec'`,
requires the value of `codecs.bytes.name` to be `'custompackage.NewBytesCodec'`.

This is the current default configuration:

```python exec="true" session="config" source="above" result="ansi"
from pprint import pprint
import io
output = io.StringIO()
zarr.config.pprint(stream=output, width=60)
print(output.getvalue())
```