N5 (zarr.n5)#

This module contains a storage class and codec to support the N5 format.

class zarr.n5.N5Store(path, normalize_keys=False, dimension_separator: Literal['.', '/'] | None = '/')[source]#

Storage class using directories and files on a standard file system, following the N5 format (saalfeldlab/n5).


Location of directory to use as the root of the storage hierarchy.

normalize_keysbool, optional

If True, all store keys will be normalized to use lower case characters (e.g. ‘foo’ and ‘FOO’ will be treated as equivalent). This can be useful to avoid potential discrepancies between case-sensitive and case-insensitive file system. Default value is False.


This is an experimental feature.

Safe to write in multiple threads or processes.


Store a single array:

>>> import zarr
>>> store = zarr.N5Store('data/array.n5')
>>> z = zarr.zeros((10, 10), chunks=(5, 5), store=store, overwrite=True)
>>> z[...] = 42

Store a group:

>>> store = zarr.N5Store('data/group.n5')
>>> root = zarr.group(store=store, overwrite=True)
>>> foo = root.create_group('foo')
>>> bar = foo.zeros('bar', shape=(10, 10), chunks=(5, 5))
>>> bar[...] = 42