MCPcopy Create free account
hub / github.com/dask/dask / _get_zarr_write_chunks

Function _get_zarr_write_chunks

dask/array/core.py:4127–4148  ·  view source on GitHub ↗

Get the appropriate chunk shape for writing to a Zarr array. For Zarr v3 arrays with sharding, returns the shard shape. For arrays without sharding, returns the chunk shape. For Zarr v2 arrays, returns the chunk shape. Parameters ---------- zarr_array : zarr.Array T

(zarr_array)

Source from the content-addressed store, hash-verified

4125
4126
4127def _get_zarr_write_chunks(zarr_array) -> tuple[int, ...]:
4128 """Get the appropriate chunk shape for writing to a Zarr array.
4129
4130 For Zarr v3 arrays with sharding, returns the shard shape.
4131 For arrays without sharding, returns the chunk shape.
4132 For Zarr v2 arrays, returns the chunk shape.
4133
4134 Parameters
4135 ----------
4136 zarr_array : zarr.Array
4137 The target zarr array
4138
4139 Returns
4140 -------
4141 tuple
4142 The chunk shape to use for rechunking the dask array
4143 """
4144 # Zarr V3 array with shards
4145 if hasattr(zarr_array, "shards") and zarr_array.shards is not None:
4146 return zarr_array.shards
4147 # Zarr V3 array without shards, or Zarr V2 array
4148 return zarr_array.chunks
4149
4150
4151def _check_regular_chunks(chunkset):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected