ChunkGrid¶
zarrista.ChunkGrid ¶
The chunk grid of an array.
The chunk grid shows how the array shape divides into chunks.
array_shape
property
¶
The shape of the array, in elements along each dimension.
grid_shape
property
¶
The shape of the grid, in number of chunks along each dimension.
from_metadata
staticmethod
¶
from_metadata(
metadata: ZarrV3NamedConfigJSON, shape: Sequence[int]
) -> ChunkGrid
Construct a chunk grid from its Zarr v3 metadata and the array shape.
Parameters:
-
metadata(ZarrV3NamedConfigJSON) –The Zarr v3 metadata of the chunk grid.
-
shape(Sequence[int]) –The shape of the array, in elements along each dimension.
Returns:
-
ChunkGrid–The new chunk grid.
Raises:
-
PluginCreateError–If the metadata names an unsupported chunk grid, or if the metadata is not compatible with
shape.
rectilinear
staticmethod
¶
rectilinear(
array_shape: Sequence[int], *, chunk_shapes: Sequence[ChunkEdgeLengths]
) -> ChunkGrid
Construct a rectilinear grid with different chunk sizes along each dimension.
Parameters:
-
array_shape(Sequence[int]) –The shape of the array, in elements along each dimension.
-
chunk_shapes(Sequence[ChunkEdgeLengths]) –The chunk sizes along each dimension.
Returns:
-
ChunkGrid–The new chunk grid.
Raises:
-
ChunkGridCreateError–If
chunk_shapesis not compatible witharray_shape. -
ValueError–If a chunk size is zero.
regular
staticmethod
¶
Construct a regular grid with a fixed chunk shape.
Parameters:
-
array_shape(Sequence[int]) –The shape of the array, in elements along each dimension.
-
chunk_shape(Sequence[int]) –The shape of each chunk, in elements along each dimension.
Returns:
-
ChunkGrid–The new chunk grid.
Raises:
-
ChunkGridCreateError–If
chunk_shapeis not compatible witharray_shape. -
ValueError–If an element of
chunk_shapeis zero.
regular_bounded
staticmethod
¶
Construct a regular grid that clips the last chunks to the array bounds.
This chunk grid is experimental. Other Zarr V3 implementations can be incompatible with it.
Parameters:
-
array_shape(Sequence[int]) –The shape of the array, in elements along each dimension.
-
chunk_shape(Sequence[int]) –The maximum shape of a chunk, in elements along each dimension. The grid clips the chunks at the array bounds to a smaller shape.
Returns:
-
ChunkGrid–The new chunk grid.
Raises:
-
IncompatibleDimensionalityError–If
chunk_shapeandarray_shapehave a different number of dimensions. -
ValueError–If an element of
chunk_shapeis zero.
zarrista.ChunkKeyEncoding ¶
How an array maps chunk grid indices to store keys.
default
staticmethod
¶
default(sep: Literal['.', '/']) -> ChunkKeyEncoding
Construct the default chunk key encoding with the given separator.
Parameters:
-
sep(Literal['.', '/']) –The separator between the parts of a chunk key.
Returns:
-
ChunkKeyEncoding–The new chunk key encoding.
Raises:
-
ValueError–If
sepis not"."or"/".
from_metadata
staticmethod
¶
from_metadata(metadata: ZarrV3NamedConfigJSON) -> ChunkKeyEncoding
Construct a chunk key encoding from its Zarr v3 metadata.
Parameters:
-
metadata(ZarrV3NamedConfigJSON) –The Zarr v3 metadata of the chunk key encoding.
Returns:
-
ChunkKeyEncoding–The new chunk key encoding.
Raises:
-
PluginCreateError–If the metadata names an unsupported chunk key encoding, or if the configuration is not valid for it.
Types¶
zarrista._chunks.ChunkEdgeLengths
module-attribute
¶
The chunk sizes along one dimension.
An integer if the dimension has one chunk size, or a sequence of runs if the chunk sizes change along the dimension.