Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.75 KB

File metadata and controls

50 lines (36 loc) · 1.75 KB

Runtime configuration

[zarr.config][] is responsible for managing the configuration of zarr and is based on the donfig Python library.

Configuration values can be set using code like the following:

import zarr

print(zarr.config.get('array.order'))
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.

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
  • Threading options, e.g. 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:

from pprint import pprint
import io
output = io.StringIO()
zarr.config.pprint(stream=output, width=60)
print(output.getvalue())