ZarrNDSource

ZarrNDSource exposes a Zarr v2 or v3 array through ProxyNDSource. Zarr decodes each logical chunk and Blosc2 stores the converted compressed chunk in the surrounding Proxy or RemoteArray cache.

The source is assumed immutable for the cache lifetime. It supports scalar and zero-length arrays, and fixed-size boolean, integer, floating-point, complex, structured, string, datetime, and timedelta dtypes. Variable-length strings, object dtypes, and ZIP stores are not supported. Concurrent reads temporarily hold decoded chunks and conversion buffers in addition to the compressed cache.

Install local support with pip install "blosc2[zarr]". Remote stores also need blosc2[fsspec] and the protocol driver, such as s3fs.

class blosc2.ZarrNDSource(store, *, storage_options: dict | None = None, max_concurrency: int = 8, blocks=None, cparams=None, _traffic: Traffic | None = None, _urlpath: str | None = None, _path: str | None = None)[source]

Read an immutable Zarr array as Blosc2-compressed logical chunks.

Replacing data beneath the same store identity violates this adapter’s contract and may leave previously converted chunks stale. Peak working memory includes concurrently decoded Zarr chunks and their Blosc2 conversion buffers; max_cache_bytes only limits retained compressed chunks.

Attributes:
attrs

The user attributes of the remote array.

blocks

The block shape of the source.

chunks

The chunk shape of the source.

cparams

The compression parameters of the source.

dtype

The dtype of the source.

meta

The fixed-length metadata of the source.

shape

The shape of the source.

vlmeta

The variable-length metadata of the source.

Methods

aget_chunk(nchunk)

Return the compressed chunk in self asynchronously.

get_chunk(nchunk)

Return the compressed chunk in self.

__init__(store, *, storage_options: dict | None = None, max_concurrency: int = 8, blocks=None, cparams=None, _traffic: Traffic | None = None, _urlpath: str | None = None, _path: str | None = None)[source]
get_chunk(nchunk: int) bytes[source]

Return the compressed chunk in self.

Parameters:

nchunk (int) – The unidimensional index of the chunk to retrieve.

Returns:

out – The compressed chunk.

Return type:

bytes object