zarr ==== .. py:module:: zarr Submodules ---------- .. toctree:: :maxdepth: 1 /api/zarr/abc/index /api/zarr/api/index /api/zarr/buffer/index /api/zarr/codecs/index /api/zarr/convenience/index /api/zarr/creation/index /api/zarr/dtype/index /api/zarr/errors/index /api/zarr/registry/index /api/zarr/storage/index /api/zarr/testing/index Attributes ---------- .. autoapisummary:: zarr.config Classes ------- .. autoapisummary:: zarr.Array zarr.AsyncArray zarr.AsyncGroup zarr.Group Functions --------- .. autoapisummary:: zarr.array zarr.consolidate_metadata zarr.copy zarr.copy_all zarr.copy_store zarr.create zarr.create_array zarr.create_group zarr.create_hierarchy zarr.empty zarr.empty_like zarr.from_array zarr.full zarr.full_like zarr.group zarr.load zarr.ones zarr.ones_like zarr.open zarr.open_array zarr.open_consolidated zarr.open_group zarr.open_like zarr.print_debug_info zarr.save zarr.save_array zarr.save_group zarr.tree zarr.zeros zarr.zeros_like Package Contents ---------------- .. py:class:: Array A Zarr array. .. !! processed by numpydoc !! .. py:method:: append(data: numpy.typing.ArrayLike, axis: int = 0) -> zarr.core.common.ChunkCoords Append `data` to `axis`. :Parameters: **data** : array-like Data to be appended. **axis** : int Axis along which to append. :Returns: **new_shape** : tuple .. .. rubric:: Notes The size of all dimensions other than `axis` must match between this array and `data`. .. rubric:: Examples >>> import numpy as np >>> import zarr >>> a = np.arange(10000000, dtype='i4').reshape(10000, 1000) >>> z = zarr.array(a, chunks=(1000, 100)) >>> z.shape (10000, 1000) >>> z.append(a) (20000, 1000) >>> z.append(np.vstack([a, a]), axis=1) (20000, 2000) >>> z.shape (20000, 2000) .. !! processed by numpydoc !! .. py:method:: create(store: zarr.storage.StoreLike, *, shape: zarr.core.common.ChunkCoords, dtype: zarr.core.dtype.ZDTypeLike, zarr_format: zarr.core.common.ZarrFormat = 3, fill_value: Any | None = DEFAULT_FILL_VALUE, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_shape: zarr.core.common.ChunkCoords | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncoding | tuple[Literal['default'], Literal['.', '/']] | tuple[Literal['v2'], Literal['.', '/']] | None = None, codecs: collections.abc.Iterable[zarr.abc.codec.Codec | dict[str, zarr.core.common.JSON]] | None = None, dimension_names: zarr.core.common.DimensionNames = None, chunks: zarr.core.common.ChunkCoords | None = None, dimension_separator: Literal['.', '/'] | None = None, order: zarr.core.common.MemoryOrder | None = None, filters: list[dict[str, zarr.core.common.JSON]] | None = None, compressor: CompressorLike = 'auto', overwrite: bool = False, config: zarr.core.array_spec.ArrayConfigLike | None = None) -> Array :classmethod: Creates a new Array instance from an initialized store. .. deprecated:: 3.0.0 Deprecated in favor of :func:`zarr.create_array`. :Parameters: **store** : StoreLike The array store that has already been initialized. **shape** : ChunkCoords The shape of the array. **dtype** : ZDTypeLike The data type of the array. **chunk_shape** : ChunkCoords, optional The shape of the Array's chunks. Zarr format 3 only. Zarr format 2 arrays should use `chunks` instead. If not specified, default are guessed based on the shape and dtype. **chunk_key_encoding** : ChunkKeyEncodingLike, optional A specification of how the chunk keys are represented in storage. Zarr format 3 only. Zarr format 2 arrays should use `dimension_separator` instead. Default is ``("default", "/")``. **codecs** : Sequence of Codecs or dicts, optional An iterable of Codec or dict serializations of Codecs. The elements of this collection specify the transformation from array values to stored bytes. Zarr format 3 only. Zarr format 2 arrays should use ``filters`` and ``compressor`` instead. If no codecs are provided, default codecs will be used: - For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``. - For Unicode strings, the default is ``VLenUTF8Codec`` and ``ZstdCodec``. - For bytes or objects, the default is ``VLenBytesCodec`` and ``ZstdCodec``. These defaults can be changed by modifying the value of ``array.v3_default_filters``, ``array.v3_default_serializer`` and ``array.v3_default_compressors`` in :mod:`zarr.core.config`. **dimension_names** : Iterable[str | None], optional The names of the dimensions (default is None). Zarr format 3 only. Zarr format 2 arrays should not use this parameter. **chunks** : ChunkCoords, optional The shape of the array's chunks. Zarr format 2 only. Zarr format 3 arrays should use ``chunk_shape`` instead. If not specified, default are guessed based on the shape and dtype. **dimension_separator** : Literal[".", "/"], optional The dimension separator (default is "."). Zarr format 2 only. Zarr format 3 arrays should use ``chunk_key_encoding`` instead. **order** : Literal["C", "F"], optional The memory of the array (default is "C"). If ``zarr_format`` is 2, this parameter sets the memory order of the array. If `zarr_format`` is 3, then this parameter is deprecated, because memory order is a runtime parameter for Zarr 3 arrays. The recommended way to specify the memory order for Zarr 3 arrays is via the ``config`` parameter, e.g. ``{'order': 'C'}``. **filters** : list[dict[str, JSON]], optional Sequence of filters to use to encode chunk data prior to compression. Zarr format 2 only. Zarr format 3 arrays should use ``codecs`` instead. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v2_default_filters`` in :mod:`zarr.core.config`. **compressor** : dict[str, JSON], optional Primary compressor to compress chunk data. Zarr format 2 only. Zarr format 3 arrays should use ``codecs`` instead. If no ``compressor`` is provided, a default compressor will be used: - For numeric arrays, the default is ``ZstdCodec``. - For Unicode strings, the default is ``VLenUTF8Codec``. - For bytes or objects, the default is ``VLenBytesCodec``. These defaults can be changed by modifying the value of ``array.v2_default_compressor`` in :mod:`zarr.core.config`. **overwrite** : bool, optional Whether to raise an error if the store already exists (default is False). :Returns: Array Array created from the store. .. !! processed by numpydoc !! .. py:method:: from_dict(store_path: zarr.storage._common.StorePath, data: dict[str, zarr.core.common.JSON]) -> Array :classmethod: Create a Zarr array from a dictionary. :Parameters: **store_path** : StorePath The path within the store where the array should be created. **data** : dict A dictionary representing the array data. This dictionary should include necessary metadata for the array, such as shape, dtype, fill value, and attributes. :Returns: Array The created Zarr array. :Raises: ValueError If the dictionary data is invalid or missing required fields for array creation. .. !! processed by numpydoc !! .. py:method:: get_basic_selection(selection: zarr.core.indexing.BasicSelection = Ellipsis, *, out: zarr.core.buffer.NDBuffer | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None, fields: zarr.core.indexing.Fields | None = None) -> zarr.core.buffer.NDArrayLikeOrScalar Retrieve data for an item or region of the array. :Parameters: **selection** : tuple A tuple specifying the requested item or region for each dimension of the array. May be any combination of int and/or slice or ellipsis for multidimensional arrays. **out** : NDBuffer, optional If given, load the selected data directly into this buffer. **prototype** : BufferPrototype, optional The prototype of the buffer to use for the output data. If not provided, the default buffer prototype is used. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to extract data for. :Returns: NDArrayLikeOrScalar An array-like or scalar containing the data for the requested region. .. seealso:: :obj:`set_basic_selection`, :obj:`get_mask_selection`, :obj:`set_mask_selection` .. :obj:`get_coordinate_selection`, :obj:`set_coordinate_selection`, :obj:`get_orthogonal_selection` .. :obj:`set_orthogonal_selection`, :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Slices with step > 1 are supported, but slices with negative step are not. For arrays with a structured dtype, see Zarr format 2 for examples of how to use the `fields` parameter. This method provides the implementation for accessing data via the square bracket notation (__getitem__). See :func:`__getitem__` for examples using the alternative notation. .. rubric:: Examples Setup a 1-dimensional array:: >>> import zarr >>> import numpy as np >>> data = np.arange(100, dtype="uint16") >>> z = zarr.create_array( >>> StorePath(MemoryStore(mode="w")), >>> shape=data.shape, >>> chunks=(3,), >>> dtype=data.dtype, >>> ) >>> z[:] = data Retrieve a single item:: >>> z.get_basic_selection(5) 5 Retrieve a region via slicing:: >>> z.get_basic_selection(slice(5)) array([0, 1, 2, 3, 4]) >>> z.get_basic_selection(slice(-5, None)) array([95, 96, 97, 98, 99]) >>> z.get_basic_selection(slice(5, 10)) array([5, 6, 7, 8, 9]) >>> z.get_basic_selection(slice(5, 10, 2)) array([5, 7, 9]) >>> z.get_basic_selection(slice(None, None, 2)) array([ 0, 2, 4, ..., 94, 96, 98]) Setup a 3-dimensional array:: >>> data = np.arange(1000).reshape(10, 10, 10) >>> z = zarr.create_array( >>> StorePath(MemoryStore(mode="w")), >>> shape=data.shape, >>> chunks=(5, 5, 5), >>> dtype=data.dtype, >>> ) >>> z[:] = data Retrieve an item:: >>> z.get_basic_selection((1, 2, 3)) 123 Retrieve a region via slicing and Ellipsis:: >>> z.get_basic_selection((slice(1, 3), slice(1, 3), 0)) array([[110, 120], [210, 220]]) >>> z.get_basic_selection(0, (slice(1, 3), slice(None))) array([[10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [20, 21, 22, 23, 24, 25, 26, 27, 28, 29]]) >>> z.get_basic_selection((..., 5)) array([[ 2 12 22 32 42 52 62 72 82 92] [102 112 122 132 142 152 162 172 182 192] ... [802 812 822 832 842 852 862 872 882 892] [902 912 922 932 942 952 962 972 982 992]] .. !! processed by numpydoc !! .. py:method:: get_block_selection(selection: zarr.core.indexing.BasicSelection, *, out: zarr.core.buffer.NDBuffer | None = None, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> zarr.core.buffer.NDArrayLikeOrScalar Retrieve a selection of individual items, by providing the indices (coordinates) for each selected item. :Parameters: **selection** : int or slice or tuple of int or slice An integer (coordinate) or slice for each dimension of the array. **out** : NDBuffer, optional If given, load the selected data directly into this buffer. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to extract data for. **prototype** : BufferPrototype, optional The prototype of the buffer to use for the output data. If not provided, the default buffer prototype is used. :Returns: NDArrayLikeOrScalar An array-like or scalar containing the data for the requested block selection. .. seealso:: :obj:`get_basic_selection`, :obj:`set_basic_selection`, :obj:`get_mask_selection`, :obj:`set_mask_selection` .. :obj:`get_orthogonal_selection`, :obj:`set_orthogonal_selection`, :obj:`get_coordinate_selection` .. :obj:`set_coordinate_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Block indexing is a convenience indexing method to work on individual chunks with chunk index slicing. It has the same concept as Dask's `Array.blocks` indexing. Slices are supported. However, only with a step size of one. Block index arrays may be multidimensional to index multidimensional arrays. For example:: >>> z.blocks[0, 1:3] array([[ 3, 4, 5, 6, 7, 8], [13, 14, 15, 16, 17, 18], [23, 24, 25, 26, 27, 28]]) .. rubric:: Examples Setup a 2-dimensional array:: >>> import zarr >>> import numpy as np >>> data = np.arange(0, 100, dtype="uint16").reshape((10, 10)) >>> z = zarr.create_array( >>> StorePath(MemoryStore(mode="w")), >>> shape=data.shape, >>> chunks=(3, 3), >>> dtype=data.dtype, >>> ) >>> z[:] = data Retrieve items by specifying their block coordinates:: >>> z.get_block_selection((1, slice(None))) array([[30, 31, 32, 33, 34, 35, 36, 37, 38, 39], [40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [50, 51, 52, 53, 54, 55, 56, 57, 58, 59]]) Which is equivalent to:: >>> z[3:6, :] array([[30, 31, 32, 33, 34, 35, 36, 37, 38, 39], [40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [50, 51, 52, 53, 54, 55, 56, 57, 58, 59]]) For convenience, the block selection functionality is also available via the `blocks` property, e.g.:: >>> z.blocks[1] array([[30, 31, 32, 33, 34, 35, 36, 37, 38, 39], [40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [50, 51, 52, 53, 54, 55, 56, 57, 58, 59]]) .. !! processed by numpydoc !! .. py:method:: get_coordinate_selection(selection: zarr.core.indexing.CoordinateSelection, *, out: zarr.core.buffer.NDBuffer | None = None, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> zarr.core.buffer.NDArrayLikeOrScalar Retrieve a selection of individual items, by providing the indices (coordinates) for each selected item. :Parameters: **selection** : tuple An integer (coordinate) array for each dimension of the array. **out** : NDBuffer, optional If given, load the selected data directly into this buffer. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to extract data for. **prototype** : BufferPrototype, optional The prototype of the buffer to use for the output data. If not provided, the default buffer prototype is used. :Returns: NDArrayLikeOrScalar An array-like or scalar containing the data for the requested coordinate selection. .. seealso:: :obj:`get_basic_selection`, :obj:`set_basic_selection`, :obj:`get_mask_selection`, :obj:`set_mask_selection` .. :obj:`get_orthogonal_selection`, :obj:`set_orthogonal_selection`, :obj:`set_coordinate_selection` .. :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Coordinate indexing is also known as point selection, and is a form of vectorized or inner indexing. Slices are not supported. Coordinate arrays must be provided for all dimensions of the array. Coordinate arrays may be multidimensional, in which case the output array will also be multidimensional. Coordinate arrays are broadcast against each other before being applied. The shape of the output will be the same as the shape of each coordinate array after broadcasting. .. rubric:: Examples Setup a 2-dimensional array:: >>> import zarr >>> import numpy as np >>> data = np.arange(0, 100, dtype="uint16").reshape((10, 10)) >>> z = zarr.create_array( >>> StorePath(MemoryStore(mode="w")), >>> shape=data.shape, >>> chunks=(3, 3), >>> dtype=data.dtype, >>> ) >>> z[:] = data Retrieve items by specifying their coordinates:: >>> z.get_coordinate_selection(([1, 4], [1, 4])) array([11, 44]) For convenience, the coordinate selection functionality is also available via the `vindex` property, e.g.:: >>> z.vindex[[1, 4], [1, 4]] array([11, 44]) .. !! processed by numpydoc !! .. py:method:: get_mask_selection(mask: zarr.core.indexing.MaskSelection, *, out: zarr.core.buffer.NDBuffer | None = None, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> zarr.core.buffer.NDArrayLikeOrScalar Retrieve a selection of individual items, by providing a Boolean array of the same shape as the array against which the selection is being made, where True values indicate a selected item. :Parameters: **mask** : ndarray, bool A Boolean array of the same shape as the array against which the selection is being made. **out** : NDBuffer, optional If given, load the selected data directly into this buffer. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to extract data for. **prototype** : BufferPrototype, optional The prototype of the buffer to use for the output data. If not provided, the default buffer prototype is used. :Returns: NDArrayLikeOrScalar An array-like or scalar containing the data for the requested selection. .. seealso:: :obj:`get_basic_selection`, :obj:`set_basic_selection`, :obj:`set_mask_selection` .. :obj:`get_orthogonal_selection`, :obj:`set_orthogonal_selection`, :obj:`get_coordinate_selection` .. :obj:`set_coordinate_selection`, :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Mask indexing is a form of vectorized or inner indexing, and is equivalent to coordinate indexing. Internally the mask array is converted to coordinate arrays by calling `np.nonzero`. .. rubric:: Examples Setup a 2-dimensional array:: >>> import zarr >>> import numpy as np >>> data = np.arange(100).reshape(10, 10) >>> z = zarr.create_array( >>> StorePath(MemoryStore(mode="w")), >>> shape=data.shape, >>> chunks=data.shape, >>> dtype=data.dtype, >>> ) >>> z[:] = data Retrieve items by specifying a mask:: >>> sel = np.zeros_like(z, dtype=bool) >>> sel[1, 1] = True >>> sel[4, 4] = True >>> z.get_mask_selection(sel) array([11, 44]) For convenience, the mask selection functionality is also available via the `vindex` property, e.g.:: >>> z.vindex[sel] array([11, 44]) .. !! processed by numpydoc !! .. py:method:: get_orthogonal_selection(selection: zarr.core.indexing.OrthogonalSelection, *, out: zarr.core.buffer.NDBuffer | None = None, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> zarr.core.buffer.NDArrayLikeOrScalar Retrieve data by making a selection for each dimension of the array. For example, if an array has 2 dimensions, allows selecting specific rows and/or columns. The selection for each dimension can be either an integer (indexing a single item), a slice, an array of integers, or a Boolean array where True values indicate a selection. :Parameters: **selection** : tuple A selection for each dimension of the array. May be any combination of int, slice, integer array or Boolean array. **out** : NDBuffer, optional If given, load the selected data directly into this buffer. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to extract data for. **prototype** : BufferPrototype, optional The prototype of the buffer to use for the output data. If not provided, the default buffer prototype is used. :Returns: NDArrayLikeOrScalar An array-like or scalar containing the data for the requested selection. .. seealso:: :obj:`get_basic_selection`, :obj:`set_basic_selection`, :obj:`get_mask_selection`, :obj:`set_mask_selection` .. :obj:`get_coordinate_selection`, :obj:`set_coordinate_selection`, :obj:`set_orthogonal_selection` .. :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Orthogonal indexing is also known as outer indexing. Slices with step > 1 are supported, but slices with negative step are not. .. rubric:: Examples Setup a 2-dimensional array:: >>> import zarr >>> import numpy as np >>> data = np.arange(100).reshape(10, 10) >>> z = zarr.create_array( >>> StorePath(MemoryStore(mode="w")), >>> shape=data.shape, >>> chunks=data.shape, >>> dtype=data.dtype, >>> ) >>> z[:] = data Retrieve rows and columns via any combination of int, slice, integer array and/or Boolean array:: >>> z.get_orthogonal_selection(([1, 4], slice(None))) array([[10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [40, 41, 42, 43, 44, 45, 46, 47, 48, 49]]) >>> z.get_orthogonal_selection((slice(None), [1, 4])) array([[ 1, 4], [11, 14], [21, 24], [31, 34], [41, 44], [51, 54], [61, 64], [71, 74], [81, 84], [91, 94]]) >>> z.get_orthogonal_selection(([1, 4], [1, 4])) array([[11, 14], [41, 44]]) >>> sel = np.zeros(z.shape[0], dtype=bool) >>> sel[1] = True >>> sel[4] = True >>> z.get_orthogonal_selection((sel, sel)) array([[11, 14], [41, 44]]) For convenience, the orthogonal selection functionality is also available via the `oindex` property, e.g.:: >>> z.oindex[[1, 4], :] array([[10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [40, 41, 42, 43, 44, 45, 46, 47, 48, 49]]) >>> z.oindex[:, [1, 4]] array([[ 1, 4], [11, 14], [21, 24], [31, 34], [41, 44], [51, 54], [61, 64], [71, 74], [81, 84], [91, 94]]) >>> z.oindex[[1, 4], [1, 4]] array([[11, 14], [41, 44]]) >>> sel = np.zeros(z.shape[0], dtype=bool) >>> sel[1] = True >>> sel[4] = True >>> z.oindex[sel, sel] array([[11, 14], [41, 44]]) .. !! processed by numpydoc !! .. py:method:: info_complete() -> Any Returns all the information about an array, including information from the Store. In addition to the statically known information like ``name`` and ``zarr_format``, this includes additional information like the size of the array in bytes and the number of chunks written. Note that this method will need to read metadata from the store. :Returns: ArrayInfo .. .. seealso:: :obj:`Array.info` The statically known subset of metadata about an array. .. !! processed by numpydoc !! .. py:method:: nbytes_stored() -> int Determine the size, in bytes, of the array actually written to the store. :Returns: **size** : int .. .. !! processed by numpydoc !! .. py:method:: open(store: zarr.storage.StoreLike) -> Array :classmethod: Opens an existing Array from a store. :Parameters: **store** : Store Store containing the Array. :Returns: Array Array opened from the store. .. !! processed by numpydoc !! .. py:method:: resize(new_shape: zarr.core.common.ShapeLike) -> None Change the shape of the array by growing or shrinking one or more dimensions. :Parameters: **new_shape** : tuple New shape of the array. .. rubric:: Notes If one or more dimensions are shrunk, any chunks falling outside the new array shape will be deleted from the underlying store. However, it is noteworthy that the chunks partially falling inside the new array (i.e. boundary chunks) will remain intact, and therefore, the data falling outside the new array but inside the boundary chunks would be restored by a subsequent resize operation that grows the array size. .. rubric:: Examples >>> import zarr >>> z = zarr.zeros(shape=(10000, 10000), >>> chunk_shape=(1000, 1000), >>> dtype="i4",) >>> z.shape (10000, 10000) >>> z = z.resize(20000, 1000) >>> z.shape (20000, 1000) >>> z2 = z.resize(50, 50) >>> z.shape (20000, 1000) >>> z2.shape (50, 50) .. !! processed by numpydoc !! .. py:method:: set_basic_selection(selection: zarr.core.indexing.BasicSelection, value: numpy.typing.ArrayLike, *, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> None Modify data for an item or region of the array. :Parameters: **selection** : tuple A tuple specifying the requested item or region for each dimension of the array. May be any combination of int and/or slice or ellipsis for multidimensional arrays. **value** : npt.ArrayLike An array-like containing values to be stored into the array. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to set data for. **prototype** : BufferPrototype, optional The prototype of the buffer used for setting the data. If not provided, the default buffer prototype is used. .. seealso:: :obj:`get_basic_selection`, :obj:`get_mask_selection`, :obj:`set_mask_selection` .. :obj:`get_coordinate_selection`, :obj:`set_coordinate_selection`, :obj:`get_orthogonal_selection` .. :obj:`set_orthogonal_selection`, :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes For arrays with a structured dtype, see Zarr format 2 for examples of how to use the `fields` parameter. This method provides the underlying implementation for modifying data via square bracket notation, see :func:`__setitem__` for equivalent examples using the alternative notation. .. rubric:: Examples Setup a 1-dimensional array:: >>> import zarr >>> z = zarr.zeros( >>> shape=(100,), >>> store=StorePath(MemoryStore(mode="w")), >>> chunk_shape=(100,), >>> dtype="i4", >>> ) Set all array elements to the same scalar value:: >>> z.set_basic_selection(..., 42) >>> z[...] array([42, 42, 42, ..., 42, 42, 42]) Set a portion of the array:: >>> z.set_basic_selection(slice(10), np.arange(10)) >>> z.set_basic_selection(slice(-10, None), np.arange(10)[::-1]) >>> z[...] array([ 0, 1, 2, ..., 2, 1, 0]) Setup a 2-dimensional array:: >>> z = zarr.zeros( >>> shape=(5, 5), >>> store=StorePath(MemoryStore(mode="w")), >>> chunk_shape=(5, 5), >>> dtype="i4", >>> ) Set all array elements to the same scalar value:: >>> z.set_basic_selection(..., 42) Set a portion of the array:: >>> z.set_basic_selection((0, slice(None)), np.arange(z.shape[1])) >>> z.set_basic_selection((slice(None), 0), np.arange(z.shape[0])) >>> z[...] array([[ 0, 1, 2, 3, 4], [ 1, 42, 42, 42, 42], [ 2, 42, 42, 42, 42], [ 3, 42, 42, 42, 42], [ 4, 42, 42, 42, 42]]) .. !! processed by numpydoc !! .. py:method:: set_block_selection(selection: zarr.core.indexing.BasicSelection, value: numpy.typing.ArrayLike, *, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> None Modify a selection of individual blocks, by providing the chunk indices (coordinates) for each block to be modified. :Parameters: **selection** : tuple An integer (coordinate) or slice for each dimension of the array. **value** : npt.ArrayLike An array-like containing the data to be stored in the block selection. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to set data for. **prototype** : BufferPrototype, optional The prototype of the buffer used for setting the data. If not provided, the default buffer prototype is used. .. seealso:: :obj:`get_basic_selection`, :obj:`set_basic_selection`, :obj:`get_mask_selection`, :obj:`set_mask_selection` .. :obj:`get_orthogonal_selection`, :obj:`set_orthogonal_selection`, :obj:`get_coordinate_selection` .. :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Block indexing is a convenience indexing method to work on individual chunks with chunk index slicing. It has the same concept as Dask's `Array.blocks` indexing. Slices are supported. However, only with a step size of one. .. rubric:: Examples Set up a 2-dimensional array:: >>> import zarr >>> z = zarr.zeros( >>> shape=(6, 6), >>> store=StorePath(MemoryStore(mode="w")), >>> chunk_shape=(2, 2), >>> dtype="i4", >>> ) Set data for a selection of items:: >>> z.set_block_selection((1, 0), 1) >>> z[...] array([[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]) For convenience, this functionality is also available via the `blocks` property. E.g.:: >>> z.blocks[2, 1] = 4 >>> z[...] array([[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0], [0, 0, 4, 4, 0, 0], [0, 0, 4, 4, 0, 0]]) >>> z.blocks[:, 2] = 7 >>> z[...] array([[0, 0, 0, 0, 7, 7], [0, 0, 0, 0, 7, 7], [1, 1, 0, 0, 7, 7], [1, 1, 0, 0, 7, 7], [0, 0, 4, 4, 7, 7], [0, 0, 4, 4, 7, 7]]) .. !! processed by numpydoc !! .. py:method:: set_coordinate_selection(selection: zarr.core.indexing.CoordinateSelection, value: numpy.typing.ArrayLike, *, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> None Modify a selection of individual items, by providing the indices (coordinates) for each item to be modified. :Parameters: **selection** : tuple An integer (coordinate) array for each dimension of the array. **value** : npt.ArrayLike An array-like containing values to be stored into the array. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to set data for. .. seealso:: :obj:`get_basic_selection`, :obj:`set_basic_selection`, :obj:`get_mask_selection`, :obj:`set_mask_selection` .. :obj:`get_orthogonal_selection`, :obj:`set_orthogonal_selection`, :obj:`get_coordinate_selection` .. :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Coordinate indexing is also known as point selection, and is a form of vectorized or inner indexing. Slices are not supported. Coordinate arrays must be provided for all dimensions of the array. .. rubric:: Examples Setup a 2-dimensional array:: >>> import zarr >>> z = zarr.zeros( >>> shape=(5, 5), >>> store=StorePath(MemoryStore(mode="w")), >>> chunk_shape=(5, 5), >>> dtype="i4", >>> ) Set data for a selection of items:: >>> z.set_coordinate_selection(([1, 4], [1, 4]), 1) >>> z[...] array([[0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) For convenience, this functionality is also available via the `vindex` property. E.g.:: >>> z.vindex[[1, 4], [1, 4]] = 2 >>> z[...] array([[0, 0, 0, 0, 0], [0, 2, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) .. !! processed by numpydoc !! .. py:method:: set_mask_selection(mask: zarr.core.indexing.MaskSelection, value: numpy.typing.ArrayLike, *, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> None Modify a selection of individual items, by providing a Boolean array of the same shape as the array against which the selection is being made, where True values indicate a selected item. :Parameters: **mask** : ndarray, bool A Boolean array of the same shape as the array against which the selection is being made. **value** : npt.ArrayLike An array-like containing values to be stored into the array. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to set data for. .. seealso:: :obj:`get_basic_selection`, :obj:`set_basic_selection`, :obj:`get_mask_selection` .. :obj:`get_orthogonal_selection`, :obj:`set_orthogonal_selection`, :obj:`get_coordinate_selection` .. :obj:`set_coordinate_selection`, :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Mask indexing is a form of vectorized or inner indexing, and is equivalent to coordinate indexing. Internally the mask array is converted to coordinate arrays by calling `np.nonzero`. .. rubric:: Examples Setup a 2-dimensional array:: >>> import zarr >>> z = zarr.zeros( >>> shape=(5, 5), >>> store=StorePath(MemoryStore(mode="w")), >>> chunk_shape=(5, 5), >>> dtype="i4", >>> ) Set data for a selection of items:: >>> sel = np.zeros_like(z, dtype=bool) >>> sel[1, 1] = True >>> sel[4, 4] = True >>> z.set_mask_selection(sel, 1) >>> z[...] array([[0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 1]]) For convenience, this functionality is also available via the `vindex` property. E.g.:: >>> z.vindex[sel] = 2 >>> z[...] array([[0, 0, 0, 0, 0], [0, 2, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 2]]) .. !! processed by numpydoc !! .. py:method:: set_orthogonal_selection(selection: zarr.core.indexing.OrthogonalSelection, value: numpy.typing.ArrayLike, *, fields: zarr.core.indexing.Fields | None = None, prototype: zarr.core.buffer.BufferPrototype | None = None) -> None Modify data via a selection for each dimension of the array. :Parameters: **selection** : tuple A selection for each dimension of the array. May be any combination of int, slice, integer array or Boolean array. **value** : npt.ArrayLike An array-like array containing the data to be stored in the array. **fields** : str or sequence of str, optional For arrays with a structured dtype, one or more fields can be specified to set data for. **prototype** : BufferPrototype, optional The prototype of the buffer used for setting the data. If not provided, the default buffer prototype is used. .. seealso:: :obj:`get_basic_selection`, :obj:`set_basic_selection`, :obj:`get_mask_selection`, :obj:`set_mask_selection` .. :obj:`get_coordinate_selection`, :obj:`set_coordinate_selection`, :obj:`get_orthogonal_selection` .. :obj:`get_block_selection`, :obj:`set_block_selection` .. :obj:`vindex`, :obj:`oindex`, :obj:`blocks`, :obj:`__getitem__`, :obj:`__setitem__` .. .. rubric:: Notes Orthogonal indexing is also known as outer indexing. Slices with step > 1 are supported, but slices with negative step are not. .. rubric:: Examples Setup a 2-dimensional array:: >>> import zarr >>> z = zarr.zeros( >>> shape=(5, 5), >>> store=StorePath(MemoryStore(mode="w")), >>> chunk_shape=(5, 5), >>> dtype="i4", >>> ) Set data for a selection of rows:: >>> z.set_orthogonal_selection(([1, 4], slice(None)), 1) >>> z[...] array([[0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [1, 1, 1, 1, 1]]) Set data for a selection of columns:: >>> z.set_orthogonal_selection((slice(None), [1, 4]), 2) >>> z[...] array([[0, 2, 0, 0, 2], [1, 2, 1, 1, 2], [0, 2, 0, 0, 2], [0, 2, 0, 0, 2], [1, 2, 1, 1, 2]]) Set data for a selection of rows and columns:: >>> z.set_orthogonal_selection(([1, 4], [1, 4]), 3) >>> z[...] array([[0, 2, 0, 0, 2], [1, 3, 1, 1, 3], [0, 2, 0, 0, 2], [0, 2, 0, 0, 2], [1, 3, 1, 1, 3]]) Set data from a 2D array:: >>> values = np.arange(10).reshape(2, 5) >>> z.set_orthogonal_selection(([0, 3], ...), values) >>> z[...] array([[0, 1, 2, 3, 4], [1, 3, 1, 1, 3], [0, 2, 0, 0, 2], [5, 6, 7, 8, 9], [1, 3, 1, 1, 3]]) For convenience, this functionality is also available via the `oindex` property. E.g.:: >>> z.oindex[[1, 4], [1, 4]] = 4 >>> z[...] array([[0, 1, 2, 3, 4], [1, 4, 1, 1, 4], [0, 2, 0, 0, 2], [5, 6, 7, 8, 9], [1, 4, 1, 1, 4]]) .. !! processed by numpydoc !! .. py:method:: update_attributes(new_attributes: dict[str, zarr.core.common.JSON]) -> Array Update the array's attributes. :Parameters: **new_attributes** : dict A dictionary of new attributes to update or add to the array. The keys represent attribute names, and the values must be JSON-compatible. :Returns: Array The array with the updated attributes. :Raises: ValueError If the attributes are invalid or incompatible with the array's metadata. .. rubric:: Notes - The updated attributes will be merged with existing attributes, and any conflicts will be overwritten by the new values. .. !! processed by numpydoc !! .. py:property:: attrs :type: zarr.core.attributes.Attributes Returns a MutableMapping containing user-defined attributes. :Returns: **attrs** : MutableMapping A MutableMapping object containing user-defined attributes. .. rubric:: Notes Note that attribute values must be JSON serializable. .. !! processed by numpydoc !! .. py:property:: basename :type: str Final component of name. .. !! processed by numpydoc !! .. py:property:: blocks :type: zarr.core.indexing.BlockIndex Shortcut for blocked chunked indexing, see :func:`get_block_selection` and :func:`set_block_selection` for documentation and examples. .. !! processed by numpydoc !! .. py:property:: cdata_shape :type: zarr.core.common.ChunkCoords The shape of the chunk grid for this array. .. !! processed by numpydoc !! .. py:property:: chunks :type: zarr.core.common.ChunkCoords Returns a tuple of integers describing the length of each dimension of a chunk of the array. If sharding is used the inner chunk shape is returned. Only defined for arrays using using `RegularChunkGrid`. If array doesn't use `RegularChunkGrid`, `NotImplementedError` is raised. :Returns: tuple A tuple of integers representing the length of each dimension of a chunk. .. !! processed by numpydoc !! .. py:property:: compressor :type: numcodecs.abc.Codec | None Compressor that is applied to each chunk of the array. .. deprecated:: 3.0.0 `array.compressor` is deprecated and will be removed in a future release. Use `array.compressors` instead. .. !! processed by numpydoc !! .. py:property:: compressors :type: tuple[numcodecs.abc.Codec, Ellipsis] | tuple[zarr.abc.codec.BytesBytesCodec, Ellipsis] Compressors that are applied to each chunk of the array. Compressors are applied in order, and after any filters are applied (if any are specified) and the data is serialized into bytes. .. !! processed by numpydoc !! .. py:property:: dtype :type: numpy.dtype[Any] Returns the NumPy data type. :Returns: np.dtype The NumPy data type. .. !! processed by numpydoc !! .. py:property:: fill_value :type: Any .. py:property:: filters :type: tuple[numcodecs.abc.Codec, Ellipsis] | tuple[zarr.abc.codec.ArrayArrayCodec, Ellipsis] Filters that are applied to each chunk of the array, in order, before serializing that chunk to bytes. .. !! processed by numpydoc !! .. py:property:: info :type: Any Return the statically known information for an array. :Returns: ArrayInfo .. .. seealso:: :obj:`Array.info_complete` All information about a group, including dynamic information like the number of bytes and chunks written. .. rubric:: Examples >>> arr = zarr.create(shape=(10,), chunks=(2,), dtype="float32") >>> arr.info Type : Array Zarr format : 3 Data type : DataType.float32 Shape : (10,) Chunk shape : (2,) Order : C Read-only : False Store type : MemoryStore Codecs : [BytesCodec(endian=)] No. bytes : 40 .. !! processed by numpydoc !! .. py:property:: metadata :type: zarr.core.metadata.ArrayMetadata .. py:property:: name :type: str Array name following h5py convention. .. !! processed by numpydoc !! .. py:property:: nbytes :type: int The total number of bytes that can be stored in the chunks of this array. .. rubric:: Notes This value is calculated by multiplying the number of elements in the array and the size of each element, the latter of which is determined by the dtype of the array. For this reason, ``nbytes`` will likely be inaccurate for arrays with variable-length dtypes. It is not possible to determine the size of an array with variable-length elements from the shape and dtype alone. .. !! processed by numpydoc !! .. py:property:: nchunks :type: int The number of chunks in the stored representation of this array. .. !! processed by numpydoc !! .. py:property:: nchunks_initialized :type: int Calculate the number of chunks that have been initialized, i.e. the number of chunks that have been persisted to the storage backend. :Returns: **nchunks_initialized** : int The number of chunks that have been initialized. .. rubric:: Notes On :class:`Array` this is a (synchronous) property, unlike asynchronous function :meth:`AsyncArray.nchunks_initialized`. .. rubric:: Examples >>> arr = await zarr.create(shape=(10,), chunks=(2,)) >>> arr.nchunks_initialized 0 >>> arr[:5] = 1 >>> arr.nchunks_initialized 3 .. !! processed by numpydoc !! .. py:property:: ndim :type: int Returns the number of dimensions in the array. :Returns: int The number of dimensions in the array. .. !! processed by numpydoc !! .. py:property:: oindex :type: zarr.core.indexing.OIndex Shortcut for orthogonal (outer) indexing, see :func:`get_orthogonal_selection` and :func:`set_orthogonal_selection` for documentation and examples. .. !! processed by numpydoc !! .. py:property:: order :type: zarr.core.common.MemoryOrder .. py:property:: path :type: str Storage path. .. !! processed by numpydoc !! .. py:property:: read_only :type: bool .. py:property:: serializer :type: None | zarr.abc.codec.ArrayBytesCodec Array-to-bytes codec to use for serializing the chunks into bytes. .. !! processed by numpydoc !! .. py:property:: shape :type: zarr.core.common.ChunkCoords Returns the shape of the array. :Returns: ChunkCoords The shape of the array. .. !! processed by numpydoc !! .. py:property:: shards :type: zarr.core.common.ChunkCoords | None Returns a tuple of integers describing the length of each dimension of a shard of the array. Returns None if sharding is not used. Only defined for arrays using using `RegularChunkGrid`. If array doesn't use `RegularChunkGrid`, `NotImplementedError` is raised. :Returns: tuple | None A tuple of integers representing the length of each dimension of a shard or None if sharding is not used. .. !! processed by numpydoc !! .. py:property:: size :type: int Returns the total number of elements in the array. :Returns: int Total number of elements in the array. .. !! processed by numpydoc !! .. py:property:: store :type: zarr.abc.store.Store .. py:property:: store_path :type: zarr.storage._common.StorePath .. py:property:: vindex :type: zarr.core.indexing.VIndex Shortcut for vectorized (inner) indexing, see :func:`get_coordinate_selection`, :func:`set_coordinate_selection`, :func:`get_mask_selection` and :func:`set_mask_selection` for documentation and examples. .. !! processed by numpydoc !! .. py:class:: AsyncArray(metadata: zarr.core.metadata.ArrayV2Metadata | zarr.core.metadata.ArrayV2MetadataDict, store_path: zarr.storage._common.StorePath, config: zarr.core.array_spec.ArrayConfigLike | None = None) AsyncArray(metadata: zarr.core.metadata.ArrayV3Metadata | zarr.core.metadata.ArrayV3MetadataDict, store_path: zarr.storage._common.StorePath, config: zarr.core.array_spec.ArrayConfigLike | None = None) Bases: :py:obj:`Generic`\ [\ :py:obj:`zarr.core.metadata.T_ArrayMetadata`\ ] An asynchronous array class representing a chunked array stored in a Zarr store. :Parameters: **metadata** : ArrayMetadata The metadata of the array. **store_path** : StorePath The path to the Zarr store. **config** : ArrayConfigLike, optional The runtime configuration of the array, by default None. :Attributes: **metadata** : ArrayMetadata The metadata of the array. **store_path** : StorePath The path to the Zarr store. **codec_pipeline** : CodecPipeline The codec pipeline used for encoding and decoding chunks. **_config** : ArrayConfig The runtime configuration of the array. .. !! processed by numpydoc !! .. py:method:: append(data: numpy.typing.ArrayLike, axis: int = 0) -> zarr.core.common.ChunkCoords :async: Append `data` to `axis`. :Parameters: **data** : array-like Data to be appended. **axis** : int Axis along which to append. :Returns: **new_shape** : tuple .. .. rubric:: Notes The size of all dimensions other than `axis` must match between this array and `data`. .. !! processed by numpydoc !! .. py:method:: create(store: zarr.storage.StoreLike, *, shape: zarr.core.common.ShapeLike, dtype: zarr.core.dtype.ZDTypeLike, zarr_format: Literal[2], fill_value: Any | None = DEFAULT_FILL_VALUE, attributes: dict[str, zarr.core.common.JSON] | None = None, chunks: zarr.core.common.ShapeLike | None = None, dimension_separator: Literal['.', '/'] | None = None, order: zarr.core.common.MemoryOrder | None = None, filters: list[dict[str, zarr.core.common.JSON]] | None = None, compressor: zarr.core.metadata.v2.CompressorLikev2 | Literal['auto'] = 'auto', overwrite: bool = False, data: numpy.typing.ArrayLike | None = None, config: zarr.core.array_spec.ArrayConfigLike | None = None) -> AsyncArray[zarr.core.metadata.ArrayV2Metadata] create(store: zarr.storage.StoreLike, *, shape: zarr.core.common.ShapeLike, dtype: zarr.core.dtype.ZDTypeLike, zarr_format: Literal[3], fill_value: Any | None = DEFAULT_FILL_VALUE, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_shape: zarr.core.common.ShapeLike | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncoding | tuple[Literal['default'], Literal['.', '/']] | tuple[Literal['v2'], Literal['.', '/']] | None = None, codecs: collections.abc.Iterable[zarr.abc.codec.Codec | dict[str, zarr.core.common.JSON]] | None = None, dimension_names: zarr.core.common.DimensionNames = None, overwrite: bool = False, data: numpy.typing.ArrayLike | None = None, config: zarr.core.array_spec.ArrayConfigLike | None = None) -> AsyncArray[zarr.core.metadata.ArrayV3Metadata] create(store: zarr.storage.StoreLike, *, shape: zarr.core.common.ShapeLike, dtype: zarr.core.dtype.ZDTypeLike, zarr_format: Literal[3] = 3, fill_value: Any | None = DEFAULT_FILL_VALUE, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_shape: zarr.core.common.ShapeLike | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncoding | tuple[Literal['default'], Literal['.', '/']] | tuple[Literal['v2'], Literal['.', '/']] | None = None, codecs: collections.abc.Iterable[zarr.abc.codec.Codec | dict[str, zarr.core.common.JSON]] | None = None, dimension_names: zarr.core.common.DimensionNames = None, overwrite: bool = False, data: numpy.typing.ArrayLike | None = None, config: zarr.core.array_spec.ArrayConfigLike | None = None) -> AsyncArray[zarr.core.metadata.ArrayV3Metadata] create(store: zarr.storage.StoreLike, *, shape: zarr.core.common.ShapeLike, dtype: zarr.core.dtype.ZDTypeLike, zarr_format: zarr.core.common.ZarrFormat, fill_value: Any | None = DEFAULT_FILL_VALUE, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_shape: zarr.core.common.ShapeLike | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncoding | tuple[Literal['default'], Literal['.', '/']] | tuple[Literal['v2'], Literal['.', '/']] | None = None, codecs: collections.abc.Iterable[zarr.abc.codec.Codec | dict[str, zarr.core.common.JSON]] | None = None, dimension_names: zarr.core.common.DimensionNames = None, chunks: zarr.core.common.ShapeLike | None = None, dimension_separator: Literal['.', '/'] | None = None, order: zarr.core.common.MemoryOrder | None = None, filters: list[dict[str, zarr.core.common.JSON]] | None = None, compressor: CompressorLike = 'auto', overwrite: bool = False, data: numpy.typing.ArrayLike | None = None, config: zarr.core.array_spec.ArrayConfigLike | None = None) -> AsyncArray[zarr.core.metadata.ArrayV3Metadata] | AsyncArray[zarr.core.metadata.ArrayV2Metadata] :classmethod: :async: Method to create a new asynchronous array instance. .. deprecated:: 3.0.0 Deprecated in favor of :func:`zarr.api.asynchronous.create_array`. :Parameters: **store** : StoreLike The store where the array will be created. **shape** : ShapeLike The shape of the array. **dtype** : ZDTypeLike The data type of the array. **zarr_format** : ZarrFormat, optional The Zarr format version (default is 3). **fill_value** : Any, optional The fill value of the array (default is None). **attributes** : dict[str, JSON], optional The attributes of the array (default is None). **chunk_shape** : ChunkCoords, optional The shape of the array's chunks Zarr format 3 only. Zarr format 2 arrays should use `chunks` instead. If not specified, default are guessed based on the shape and dtype. **chunk_key_encoding** : ChunkKeyEncodingLike, optional A specification of how the chunk keys are represented in storage. Zarr format 3 only. Zarr format 2 arrays should use `dimension_separator` instead. Default is ``("default", "/")``. **codecs** : Sequence of Codecs or dicts, optional An iterable of Codec or dict serializations of Codecs. The elements of this collection specify the transformation from array values to stored bytes. Zarr format 3 only. Zarr format 2 arrays should use ``filters`` and ``compressor`` instead. If no codecs are provided, default codecs will be used: - For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``. - For Unicode strings, the default is ``VLenUTF8Codec`` and ``ZstdCodec``. - For bytes or objects, the default is ``VLenBytesCodec`` and ``ZstdCodec``. These defaults can be changed by modifying the value of ``array.v3_default_filters``, ``array.v3_default_serializer`` and ``array.v3_default_compressors`` in :mod:`zarr.core.config`. **dimension_names** : Iterable[str | None], optional The names of the dimensions (default is None). Zarr format 3 only. Zarr format 2 arrays should not use this parameter. **chunks** : ShapeLike, optional The shape of the array's chunks. Zarr format 2 only. Zarr format 3 arrays should use ``chunk_shape`` instead. If not specified, default are guessed based on the shape and dtype. **dimension_separator** : Literal[".", "/"], optional The dimension separator (default is "."). Zarr format 2 only. Zarr format 3 arrays should use ``chunk_key_encoding`` instead. **order** : Literal["C", "F"], optional The memory of the array (default is "C"). If ``zarr_format`` is 2, this parameter sets the memory order of the array. If `zarr_format`` is 3, then this parameter is deprecated, because memory order is a runtime parameter for Zarr 3 arrays. The recommended way to specify the memory order for Zarr 3 arrays is via the ``config`` parameter, e.g. ``{'config': 'C'}``. **filters** : list[dict[str, JSON]], optional Sequence of filters to use to encode chunk data prior to compression. Zarr format 2 only. Zarr format 3 arrays should use ``codecs`` instead. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v2_default_filters`` in :mod:`zarr.core.config`. **compressor** : dict[str, JSON], optional The compressor used to compress the data (default is None). Zarr format 2 only. Zarr format 3 arrays should use ``codecs`` instead. If no ``compressor`` is provided, a default compressor will be used: - For numeric arrays, the default is ``ZstdCodec``. - For Unicode strings, the default is ``VLenUTF8Codec``. - For bytes or objects, the default is ``VLenBytesCodec``. These defaults can be changed by modifying the value of ``array.v2_default_compressor`` in :mod:`zarr.core.config`. **overwrite** : bool, optional Whether to raise an error if the store already exists (default is False). **data** : npt.ArrayLike, optional The data to be inserted into the array (default is None). **config** : ArrayConfigLike, optional Runtime configuration for the array. :Returns: AsyncArray The created asynchronous array instance. .. !! processed by numpydoc !! .. py:method:: from_dict(store_path: zarr.storage._common.StorePath, data: dict[str, zarr.core.common.JSON]) -> AsyncArray[zarr.core.metadata.ArrayV3Metadata] | AsyncArray[zarr.core.metadata.ArrayV2Metadata] :classmethod: Create a Zarr array from a dictionary, with support for both Zarr format 2 and 3 metadata. :Parameters: **store_path** : StorePath The path within the store where the array should be created. **data** : dict A dictionary representing the array data. This dictionary should include necessary metadata for the array, such as shape, dtype, and other attributes. The format of the metadata will determine whether a Zarr format 2 or 3 array is created. :Returns: AsyncArray[ArrayV3Metadata] or AsyncArray[ArrayV2Metadata] The created Zarr array, either using Zarr format 2 or 3 metadata based on the provided data. :Raises: ValueError If the dictionary data is invalid or incompatible with either Zarr format 2 or 3 array creation. .. !! processed by numpydoc !! .. py:method:: getitem(selection: zarr.core.indexing.BasicSelection, *, prototype: zarr.core.buffer.BufferPrototype | None = None) -> zarr.core.buffer.NDArrayLikeOrScalar :async: Asynchronous function that retrieves a subset of the array's data based on the provided selection. :Parameters: **selection** : BasicSelection A selection object specifying the subset of data to retrieve. **prototype** : BufferPrototype, optional A buffer prototype to use for the retrieved data (default is None). :Returns: NDArrayLikeOrScalar The retrieved subset of the array's data. .. rubric:: Examples >>> import zarr >>> store = zarr.storage.MemoryStore() >>> async_arr = await zarr.api.asynchronous.create_array( ... store=store, ... shape=(100,100), ... chunks=(10,10), ... dtype='i4', ... fill_value=0) >>> await async_arr.getitem((0,1)) # doctest: +ELLIPSIS array(0, dtype=int32) .. !! processed by numpydoc !! .. py:method:: info_complete() -> Any :async: Return all the information for an array, including dynamic information like a storage size. In addition to the static information, this provides - The count of chunks initialized - The sum of the bytes written :Returns: ArrayInfo .. .. seealso:: :obj:`AsyncArray.info` A property giving just the statically known information about an array. .. !! processed by numpydoc !! .. py:method:: nbytes_stored() -> int :async: .. py:method:: nchunks_initialized() -> int :async: Calculate the number of chunks that have been initialized, i.e. the number of chunks that have been persisted to the storage backend. :Returns: **nchunks_initialized** : int The number of chunks that have been initialized. .. rubric:: Notes On :class:`AsyncArray` this is an asynchronous method, unlike the (synchronous) property :attr:`Array.nchunks_initialized`. .. rubric:: Examples >>> arr = await zarr.api.asynchronous.create(shape=(10,), chunks=(2,)) >>> await arr.nchunks_initialized() 0 >>> await arr.setitem(slice(5), 1) >>> await arr.nchunks_initialized() 3 .. !! processed by numpydoc !! .. py:method:: open(store: zarr.storage.StoreLike, zarr_format: zarr.core.common.ZarrFormat | None = 3) -> AsyncArray[zarr.core.metadata.ArrayV3Metadata] | AsyncArray[zarr.core.metadata.ArrayV2Metadata] :classmethod: :async: Async method to open an existing Zarr array from a given store. :Parameters: **store** : StoreLike The store containing the Zarr array. **zarr_format** : ZarrFormat | None, optional The Zarr format version (default is 3). :Returns: AsyncArray The opened Zarr array. .. rubric:: Examples >>> import zarr >>> store = zarr.storage.MemoryStore() >>> async_arr = await AsyncArray.open(store) # doctest: +ELLIPSIS .. !! processed by numpydoc !! .. py:method:: resize(new_shape: zarr.core.common.ShapeLike, delete_outside_chunks: bool = True) -> None :async: Asynchronously resize the array to a new shape. :Parameters: **new_shape** : ChunkCoords The desired new shape of the array. **delete_outside_chunks** : bool, optional If True (default), chunks that fall outside the new shape will be deleted. If False, the data in those chunks will be preserved. :Returns: AsyncArray The resized array. :Raises: ValueError If the new shape is incompatible with the current array's chunking configuration. .. rubric:: Notes - This method is asynchronous and should be awaited. .. !! processed by numpydoc !! .. py:method:: setitem(selection: zarr.core.indexing.BasicSelection, value: numpy.typing.ArrayLike, prototype: zarr.core.buffer.BufferPrototype | None = None) -> None :async: Asynchronously set values in the array using basic indexing. :Parameters: **selection** : BasicSelection The selection defining the region of the array to set. **value** : numpy.typing.ArrayLike The values to be written into the selected region of the array. **prototype** : BufferPrototype or None, optional A prototype buffer that defines the structure and properties of the array chunks being modified. If None, the default buffer prototype is used. Default is None. :Returns: None This method does not return any value. :Raises: IndexError If the selection is out of bounds for the array. ValueError If the values are not compatible with the array's dtype or shape. .. rubric:: Notes - This method is asynchronous and should be awaited. - Supports basic indexing, where the selection is contiguous and does not involve advanced indexing. .. !! processed by numpydoc !! .. py:method:: update_attributes(new_attributes: dict[str, zarr.core.common.JSON]) -> Self :async: Asynchronously update the array's attributes. :Parameters: **new_attributes** : dict of str to JSON A dictionary of new attributes to update or add to the array. The keys represent attribute names, and the values must be JSON-compatible. :Returns: AsyncArray The array with the updated attributes. :Raises: ValueError If the attributes are invalid or incompatible with the array's metadata. .. rubric:: Notes - This method is asynchronous and should be awaited. - The updated attributes will be merged with existing attributes, and any conflicts will be overwritten by the new values. .. !! processed by numpydoc !! .. py:property:: attrs :type: dict[str, zarr.core.common.JSON] Returns the attributes of the array. :Returns: dict Attributes of the array .. !! processed by numpydoc !! .. py:property:: basename :type: str Final component of name. :Returns: str The basename or final component of the array name. .. !! processed by numpydoc !! .. py:property:: cdata_shape :type: zarr.core.common.ChunkCoords The shape of the chunk grid for this array. :Returns: Tuple[int] The shape of the chunk grid for this array. .. !! processed by numpydoc !! .. py:property:: chunks :type: zarr.core.common.ChunkCoords Returns the chunk shape of the Array. If sharding is used the inner chunk shape is returned. Only defined for arrays using using `RegularChunkGrid`. If array doesn't use `RegularChunkGrid`, `NotImplementedError` is raised. :Returns: ChunkCoords: The chunk shape of the Array. .. !! processed by numpydoc !! .. py:attribute:: codec_pipeline :type: zarr.abc.codec.CodecPipeline .. py:property:: compressor :type: numcodecs.abc.Codec | None Compressor that is applied to each chunk of the array. .. deprecated:: 3.0.0 `array.compressor` is deprecated and will be removed in a future release. Use `array.compressors` instead. .. !! processed by numpydoc !! .. py:property:: compressors :type: tuple[numcodecs.abc.Codec, Ellipsis] | tuple[zarr.abc.codec.BytesBytesCodec, Ellipsis] Compressors that are applied to each chunk of the array. Compressors are applied in order, and after any filters are applied (if any are specified) and the data is serialized into bytes. .. !! processed by numpydoc !! .. py:property:: dtype :type: zarr.core.dtype.wrapper.TBaseDType Returns the data type of the array. :Returns: np.dtype Data type of the array .. !! processed by numpydoc !! .. py:property:: filters :type: tuple[numcodecs.abc.Codec, Ellipsis] | tuple[zarr.abc.codec.ArrayArrayCodec, Ellipsis] Filters that are applied to each chunk of the array, in order, before serializing that chunk to bytes. .. !! processed by numpydoc !! .. py:property:: info :type: Any Return the statically known information for an array. :Returns: ArrayInfo .. .. seealso:: :obj:`AsyncArray.info_complete` All information about a group, including dynamic information like the number of bytes and chunks written. .. rubric:: Examples >>> arr = await zarr.api.asynchronous.create( ... path="array", shape=(3, 4, 5), chunks=(2, 2, 2)) ... ) >>> arr.info Type : Array Zarr format : 3 Data type : DataType.float64 Shape : (3, 4, 5) Chunk shape : (2, 2, 2) Order : C Read-only : False Store type : MemoryStore Codecs : [{'endian': }] No. bytes : 480 .. !! processed by numpydoc !! .. py:attribute:: metadata :type: zarr.core.metadata.T_ArrayMetadata .. py:property:: name :type: str Array name following h5py convention. :Returns: str The name of the array. .. !! processed by numpydoc !! .. py:property:: nbytes :type: int The total number of bytes that can be stored in the chunks of this array. .. rubric:: Notes This value is calculated by multiplying the number of elements in the array and the size of each element, the latter of which is determined by the dtype of the array. For this reason, ``nbytes`` will likely be inaccurate for arrays with variable-length dtypes. It is not possible to determine the size of an array with variable-length elements from the shape and dtype alone. .. !! processed by numpydoc !! .. py:property:: nchunks :type: int The number of chunks in the stored representation of this array. :Returns: int The total number of chunks in the array. .. !! processed by numpydoc !! .. py:property:: ndim :type: int Returns the number of dimensions in the Array. :Returns: int The number of dimensions in the Array. .. !! processed by numpydoc !! .. py:property:: order :type: zarr.core.common.MemoryOrder Returns the memory order of the array. :Returns: bool Memory order of the array .. !! processed by numpydoc !! .. py:property:: path :type: str Storage path. :Returns: str The path to the array in the Zarr store. .. !! processed by numpydoc !! .. py:property:: read_only :type: bool Returns True if the array is read-only. :Returns: bool True if the array is read-only .. !! processed by numpydoc !! .. py:property:: serializer :type: zarr.abc.codec.ArrayBytesCodec | None Array-to-bytes codec to use for serializing the chunks into bytes. .. !! processed by numpydoc !! .. py:property:: shape :type: zarr.core.common.ChunkCoords Returns the shape of the Array. :Returns: tuple The shape of the Array. .. !! processed by numpydoc !! .. py:property:: shards :type: zarr.core.common.ChunkCoords | None Returns the shard shape of the Array. Returns None if sharding is not used. Only defined for arrays using using `RegularChunkGrid`. If array doesn't use `RegularChunkGrid`, `NotImplementedError` is raised. :Returns: ChunkCoords: The shard shape of the Array. .. !! processed by numpydoc !! .. py:property:: size :type: int Returns the total number of elements in the array :Returns: int Total number of elements in the array .. !! processed by numpydoc !! .. py:property:: store :type: zarr.abc.store.Store .. py:attribute:: store_path :type: zarr.storage._common.StorePath .. py:class:: AsyncGroup Asynchronous Group object. .. !! processed by numpydoc !! .. py:method:: array_keys() -> collections.abc.AsyncGenerator[str, None] :async: Iterate over array names. .. !! processed by numpydoc !! .. py:method:: array_values() -> collections.abc.AsyncGenerator[zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata], None] :async: Iterate over array values. .. !! processed by numpydoc !! .. py:method:: arrays() -> collections.abc.AsyncGenerator[tuple[str, zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata]], None] :async: Iterate over arrays. .. !! processed by numpydoc !! .. py:method:: contains(member: str) -> bool :async: Check if a member exists in the group. :Parameters: **member** : str Member name. :Returns: bool .. .. !! processed by numpydoc !! .. py:method:: create_array(name: str, *, shape: zarr.core.common.ShapeLike | None = None, dtype: zarr.core.dtype.ZDTypeLike | None = None, data: numpy.ndarray[Any, numpy.dtype[Any]] | None = None, chunks: zarr.core.common.ChunkCoords | Literal['auto'] = 'auto', shards: zarr.core.array.ShardsLike | None = None, filters: zarr.core.array.FiltersLike = 'auto', compressors: zarr.core.array.CompressorsLike = 'auto', compressor: zarr.core.array.CompressorLike = 'auto', serializer: zarr.core.array.SerializerLike = 'auto', fill_value: Any | None = DEFAULT_FILL_VALUE, order: zarr.core.common.MemoryOrder | None = None, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncodingLike | None = None, dimension_names: zarr.core.common.DimensionNames = None, storage_options: dict[str, Any] | None = None, overwrite: bool = False, config: zarr.core.array_spec.ArrayConfigLike | None = None, write_data: bool = True) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create an array within this group. This method lightly wraps :func:`zarr.core.array.create_array`. :Parameters: **name** : str The name of the array relative to the group. If ``path`` is ``None``, the array will be located at the root of the store. **shape** : ChunkCoords Shape of the array. **dtype** : npt.DTypeLike Data type of the array. **chunks** : ChunkCoords, optional Chunk shape of the array. If not specified, default are guessed based on the shape and dtype. **shards** : ChunkCoords, optional Shard shape of the array. The default value of ``None`` results in no sharding at all. **filters** : Iterable[Codec], optional Iterable of filters to apply to each chunk of the array, in order, before serializing that chunk to bytes. For Zarr format 3, a "filter" is a codec that takes an array and returns an array, and these values must be instances of ``ArrayArrayCodec``, or dict representations of ``ArrayArrayCodec``. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v3_default_filters`` in :mod:`zarr.core.config`. Use ``None`` to omit default filters. For Zarr format 2, a "filter" can be any numcodecs codec; you should ensure that the the order if your filters is consistent with the behavior of each filter. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v2_default_filters`` in :mod:`zarr.core.config`. Use ``None`` to omit default filters. **compressors** : Iterable[Codec], optional List of compressors to apply to the array. Compressors are applied in order, and after any filters are applied (if any are specified) and the data is serialized into bytes. For Zarr format 3, a "compressor" is a codec that takes a bytestream, and returns another bytestream. Multiple compressors my be provided for Zarr format 3. If no ``compressors`` are provided, a default set of compressors will be used. These defaults can be changed by modifying the value of ``array.v3_default_compressors`` in :mod:`zarr.core.config`. Use ``None`` to omit default compressors. For Zarr format 2, a "compressor" can be any numcodecs codec. Only a single compressor may be provided for Zarr format 2. If no ``compressor`` is provided, a default compressor will be used. in :mod:`zarr.core.config`. Use ``None`` to omit the default compressor. **compressor** : Codec, optional Deprecated in favor of ``compressors``. **serializer** : dict[str, JSON] | ArrayBytesCodec, optional Array-to-bytes codec to use for encoding the array data. Zarr format 3 only. Zarr format 2 arrays use implicit array-to-bytes conversion. If no ``serializer`` is provided, a default serializer will be used. These defaults can be changed by modifying the value of ``array.v3_default_serializer`` in :mod:`zarr.core.config`. **fill_value** : Any, optional Fill value for the array. **order** : {"C", "F"}, optional The memory of the array (default is "C"). For Zarr format 2, this parameter sets the memory order of the array. For Zarr format 3, this parameter is deprecated, because memory order is a runtime parameter for Zarr format 3 arrays. The recommended way to specify the memory order for Zarr format 3 arrays is via the ``config`` parameter, e.g. ``{'config': 'C'}``. If no ``order`` is provided, a default order will be used. This default can be changed by modifying the value of ``array.order`` in :mod:`zarr.core.config`. **attributes** : dict, optional Attributes for the array. **chunk_key_encoding** : ChunkKeyEncoding, optional A specification of how the chunk keys are represented in storage. For Zarr format 3, the default is ``{"name": "default", "separator": "/"}}``. For Zarr format 2, the default is ``{"name": "v2", "separator": "."}}``. **dimension_names** : Iterable[str], optional The names of the dimensions (default is None). Zarr format 3 only. Zarr format 2 arrays should not use this parameter. **storage_options** : dict, optional If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **overwrite** : bool, default False Whether to overwrite an array with the same name in the store, if one exists. **config** : ArrayConfig or ArrayConfigLike, optional Runtime configuration for the array. **write_data** : bool If a pre-existing array-like object was provided to this function via the ``data`` parameter then ``write_data`` determines whether the values in that array-like object should be written to the Zarr array created by this function. If ``write_data`` is ``False``, then the array will be left empty. :Returns: AsyncArray .. .. !! processed by numpydoc !! .. py:method:: create_dataset(name: str, *, shape: zarr.core.common.ShapeLike, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create an array. .. deprecated:: 3.0.0 The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.create_array` instead. Arrays are known as "datasets" in HDF5 terminology. For compatibility with h5py, Zarr groups also implement the :func:`zarr.AsyncGroup.require_dataset` method. :Parameters: **name** : str Array name. **\*\*kwargs** : dict Additional arguments passed to :func:`zarr.AsyncGroup.create_array`. :Returns: **a** : AsyncArray .. .. !! processed by numpydoc !! .. py:method:: create_group(name: str, *, overwrite: bool = False, attributes: dict[str, Any] | None = None) -> AsyncGroup :async: Create a sub-group. :Parameters: **name** : str Group name. **overwrite** : bool, optional If True, do not raise an error if the group already exists. **attributes** : dict, optional Group attributes. :Returns: **g** : AsyncGroup .. .. !! processed by numpydoc !! .. py:method:: create_hierarchy(nodes: dict[str, zarr.core.metadata.ArrayV2Metadata | zarr.core.metadata.ArrayV3Metadata | GroupMetadata], *, overwrite: bool = False) -> collections.abc.AsyncIterator[tuple[str, AsyncGroup | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata]]] :async: Create a hierarchy of arrays or groups rooted at this group. This function will parse its input to ensure that the hierarchy is complete. Any implicit groups will be inserted as needed. For example, an input like ```{'a/b': GroupMetadata}``` will be parsed to ```{'': GroupMetadata, 'a': GroupMetadata, 'b': Groupmetadata}```. Explicitly specifying a root group, e.g. with ``nodes = {'': GroupMetadata()}`` is an error because this group instance is the root group. After input parsing, this function then creates all the nodes in the hierarchy concurrently. Arrays and Groups are yielded in the order they are created. This order is not stable and should not be relied on. :Parameters: **nodes** : dict[str, GroupMetadata | ArrayV3Metadata | ArrayV2Metadata] A dictionary defining the hierarchy. The keys are the paths of the nodes in the hierarchy, relative to the path of the group. The values are instances of ``GroupMetadata`` or ``ArrayMetadata``. Note that all values must have the same ``zarr_format`` as the parent group -- it is an error to mix zarr versions in the same hierarchy. Leading "/" characters from keys will be removed. **overwrite** : bool Whether to overwrite existing nodes. Defaults to ``False``, in which case an error is raised instead of overwriting an existing array or group. This function will not erase an existing group unless that group is explicitly named in ``nodes``. If ``nodes`` defines implicit groups, e.g. ``{`'a/b/c': GroupMetadata}``, and a group already exists at path ``a``, then this function will leave the group at ``a`` as-is. :Yields: tuple[str, AsyncArray | AsyncGroup]. .. .. !! processed by numpydoc !! .. py:method:: delitem(key: str) -> None :async: Delete a group member. :Parameters: **key** : str Array or group name .. !! processed by numpydoc !! .. py:method:: empty(*, name: str, shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create an empty array with the specified shape in this Group. The contents will be filled with the array's fill value or zeros if no fill value is provided. :Parameters: **name** : str Name of the array. **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. .. rubric:: Notes The contents of an empty Zarr array are not defined. On attempting to retrieve data from an empty Zarr array, any values may be returned, and these are not guaranteed to be stable from one access to the next. .. !! processed by numpydoc !! .. py:method:: empty_like(*, name: str, data: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create an empty sub-array like `data`. The contents will be filled with the array's fill value or zeros if no fill value is provided. :Parameters: **name** : str Name of the array. **data** : array-like The array to create an empty array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: AsyncArray The new array. .. !! processed by numpydoc !! .. py:method:: from_dict(store_path: zarr.storage.StorePath, data: dict[str, Any]) -> AsyncGroup :classmethod: .. py:method:: from_store(store: zarr.storage.StoreLike, *, attributes: dict[str, Any] | None = None, overwrite: bool = False, zarr_format: zarr.core.common.ZarrFormat = 3) -> AsyncGroup :classmethod: :async: .. py:method:: full(*, name: str, shape: zarr.core.common.ChunkCoords, fill_value: Any | None, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create an array, with "fill_value" being used as the default value for uninitialized portions of the array. :Parameters: **name** : str Name of the array. **shape** : int or tuple of int Shape of the empty array. **fill_value** : scalar Value to fill the array with. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: AsyncArray The new array. .. !! processed by numpydoc !! .. py:method:: full_like(*, name: str, data: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create a sub-array like `data` filled with the `fill_value` of `data` . :Parameters: **name** : str Name of the array. **data** : array-like The array to create the new array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: AsyncArray The new array. .. !! processed by numpydoc !! .. py:method:: get(key: str, default: DefaultT | None = None) -> zarr.core.array.AsyncArray[Any] | AsyncGroup | DefaultT | None :async: Obtain a group member, returning default if not found. :Parameters: **key** : str Group member name. **default** : object Default value to return if key is not found (default: None). :Returns: object Group member (AsyncArray or AsyncGroup) or default if not found. .. !! processed by numpydoc !! .. py:method:: getitem(key: str) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] | AsyncGroup :async: Get a subarray or subgroup from the group. :Parameters: **key** : str Array or group name :Returns: AsyncArray or AsyncGroup .. .. !! processed by numpydoc !! .. py:method:: group_keys() -> collections.abc.AsyncGenerator[str, None] :async: Iterate over group names. .. !! processed by numpydoc !! .. py:method:: group_values() -> collections.abc.AsyncGenerator[AsyncGroup, None] :async: Iterate over group values. .. !! processed by numpydoc !! .. py:method:: groups() -> collections.abc.AsyncGenerator[tuple[str, AsyncGroup], None] :async: Iterate over subgroups. .. !! processed by numpydoc !! .. py:method:: info_complete() -> Any :async: Return all the information for a group. This includes dynamic information like the number of child Groups or Arrays. If this group doesn't contain consolidated metadata then this will need to read from the backing Store. :Returns: GroupInfo .. .. seealso:: :obj:`AsyncGroup.info` .. .. !! processed by numpydoc !! .. py:method:: keys() -> collections.abc.AsyncGenerator[str, None] :async: Iterate over member names. .. !! processed by numpydoc !! .. py:method:: members(max_depth: int | None = 0, *, use_consolidated_for_children: bool = True) -> collections.abc.AsyncGenerator[tuple[str, zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] | AsyncGroup], None] :async: Returns an AsyncGenerator over the arrays and groups contained in this group. This method requires that `store_path.store` supports directory listing. The results are not guaranteed to be ordered. :Parameters: **max_depth** : int, default 0 The maximum number of levels of the hierarchy to include. By default, (``max_depth=0``) only immediate children are included. Set ``max_depth=None`` to include all nodes, and some positive integer to consider children within that many levels of the root Group. **use_consolidated_for_children** : bool, default True Whether to use the consolidated metadata of child groups loaded from the store. Note that this only affects groups loaded from the store. If the current Group already has consolidated metadata, it will always be used. :Returns: path: A string giving the path to the target, relative to the Group ``self``. value: AsyncArray or AsyncGroup The AsyncArray or AsyncGroup that is a child of ``self``. .. !! processed by numpydoc !! .. py:method:: move(source: str, dest: str) -> None :abstractmethod: :async: Move a sub-group or sub-array from one path to another. .. rubric:: Notes Not implemented .. !! processed by numpydoc !! .. py:method:: nmembers(max_depth: int | None = 0) -> int :async: Count the number of members in this group. :Parameters: **max_depth** : int, default 0 The maximum number of levels of the hierarchy to include. By default, (``max_depth=0``) only immediate children are included. Set ``max_depth=None`` to include all nodes, and some positive integer to consider children within that many levels of the root Group. :Returns: **count** : int .. .. !! processed by numpydoc !! .. py:method:: ones(*, name: str, shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create an array, with one being used as the default value for uninitialized portions of the array. :Parameters: **name** : str Name of the array. **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: AsyncArray The new array. .. !! processed by numpydoc !! .. py:method:: ones_like(*, name: str, data: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create a sub-array of ones like `data`. :Parameters: **name** : str Name of the array. **data** : array-like The array to create the new array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: AsyncArray The new array. .. !! processed by numpydoc !! .. py:method:: open(store: zarr.storage.StoreLike, zarr_format: zarr.core.common.ZarrFormat | None = 3, use_consolidated: bool | str | None = None) -> AsyncGroup :classmethod: :async: Open a new AsyncGroup :Parameters: **store** : StoreLike .. **zarr_format** : {2, 3}, optional .. **use_consolidated** : bool or str, default None Whether to use consolidated metadata. By default, consolidated metadata is used if it's present in the store (in the ``zarr.json`` for Zarr format 3 and in the ``.zmetadata`` file for Zarr format 2) and the Store supports it. To explicitly require consolidated metadata, set ``use_consolidated=True``. In this case, if the Store doesn't support consolidation or consolidated metadata is not found, a ``ValueError`` exception is raised. To explicitly *not* use consolidated metadata, set ``use_consolidated=False``, which will fall back to using the regular, non consolidated metadata. Zarr format 2 allowed configuring the key storing the consolidated metadata (``.zmetadata`` by default). Specify the custom key as ``use_consolidated`` to load consolidated metadata from a non-default key. .. !! processed by numpydoc !! .. py:method:: require_array(name: str, *, shape: zarr.core.common.ShapeLike, dtype: numpy.typing.DTypeLike = None, exact: bool = False, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Obtain an array, creating if it doesn't exist. Other `kwargs` are as per :func:`zarr.AsyncGroup.create_dataset`. :Parameters: **name** : str Array name. **shape** : int or tuple of ints Array shape. **dtype** : str or dtype, optional NumPy dtype. **exact** : bool, optional If True, require `dtype` to match exactly. If false, require `dtype` can be cast from array dtype. :Returns: **a** : AsyncArray .. .. !! processed by numpydoc !! .. py:method:: require_dataset(name: str, *, shape: zarr.core.common.ChunkCoords, dtype: numpy.typing.DTypeLike = None, exact: bool = False, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Obtain an array, creating if it doesn't exist. .. deprecated:: 3.0.0 The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.require_dataset` instead. Arrays are known as "datasets" in HDF5 terminology. For compatibility with h5py, Zarr groups also implement the :func:`zarr.AsyncGroup.create_dataset` method. Other `kwargs` are as per :func:`zarr.AsyncGroup.create_dataset`. :Parameters: **name** : str Array name. **shape** : int or tuple of ints Array shape. **dtype** : str or dtype, optional NumPy dtype. **exact** : bool, optional If True, require `dtype` to match exactly. If false, require `dtype` can be cast from array dtype. :Returns: **a** : AsyncArray .. .. !! processed by numpydoc !! .. py:method:: require_group(name: str, overwrite: bool = False) -> AsyncGroup :async: Obtain a sub-group, creating one if it doesn't exist. :Parameters: **name** : str Group name. **overwrite** : bool, optional Overwrite any existing group with given `name` if present. :Returns: **g** : AsyncGroup .. .. !! processed by numpydoc !! .. py:method:: require_groups(*names: str) -> tuple[AsyncGroup, Ellipsis] :async: Convenience method to require multiple groups in a single call. :Parameters: **\*names** : str Group names. :Returns: Tuple[AsyncGroup, ...] .. .. !! processed by numpydoc !! .. py:method:: setitem(key: str, value: Any) -> None :async: Fastpath for creating a new array New arrays will be created with default array settings for the array type. :Parameters: **key** : str Array name **value** : array-like Array data .. !! processed by numpydoc !! .. py:method:: tree(expand: bool | None = None, level: int | None = None) -> Any :async: Return a tree-like representation of a hierarchy. This requires the optional ``rich`` dependency. :Parameters: **expand** : bool, optional This keyword is not yet supported. A NotImplementedError is raised if it's used. **level** : int, optional The maximum depth below this Group to display in the tree. :Returns: TreeRepr A pretty-printable object displaying the hierarchy. .. !! processed by numpydoc !! .. py:method:: update_attributes(new_attributes: dict[str, Any]) -> AsyncGroup :async: Update group attributes. :Parameters: **new_attributes** : dict New attributes to set on the group. :Returns: **self** : AsyncGroup .. .. !! processed by numpydoc !! .. py:method:: zeros(*, name: str, shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create an array, with zero being used as the default value for uninitialized portions of the array. :Parameters: **name** : str Name of the array. **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: AsyncArray The new array. .. !! processed by numpydoc !! .. py:method:: zeros_like(*, name: str, data: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV2Metadata] | zarr.core.array.AsyncArray[zarr.core.metadata.ArrayV3Metadata] :async: Create a sub-array of zeros like `data`. :Parameters: **name** : str Name of the array. **data** : array-like The array to create the new array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: AsyncArray The new array. .. !! processed by numpydoc !! .. py:property:: attrs :type: dict[str, Any] .. py:property:: basename :type: str Final component of name. .. !! processed by numpydoc !! .. py:property:: info :type: Any Return a visual representation of the statically known information about a group. Note that this doesn't include dynamic information, like the number of child Groups or Arrays. :Returns: GroupInfo .. .. seealso:: :obj:`AsyncGroup.info_complete` All information about a group, including dynamic information .. !! processed by numpydoc !! .. py:attribute:: metadata :type: GroupMetadata .. py:property:: name :type: str Group name following h5py convention. .. !! processed by numpydoc !! .. py:property:: path :type: str Storage path. .. !! processed by numpydoc !! .. py:property:: read_only :type: bool .. py:property:: store :type: zarr.abc.store.Store .. py:attribute:: store_path :type: zarr.storage.StorePath .. py:property:: synchronizer :type: None .. py:class:: Group Bases: :py:obj:`zarr.core.sync.SyncMixin` A Zarr group. .. !! processed by numpydoc !! .. py:method:: array(name: str, *, shape: zarr.core.common.ShapeLike, dtype: numpy.typing.DTypeLike, chunks: zarr.core.common.ChunkCoords | Literal['auto'] = 'auto', shards: zarr.core.common.ChunkCoords | Literal['auto'] | None = None, filters: zarr.core.array.FiltersLike = 'auto', compressors: zarr.core.array.CompressorsLike = 'auto', compressor: zarr.core.array.CompressorLike = None, serializer: zarr.core.array.SerializerLike = 'auto', fill_value: Any | None = DEFAULT_FILL_VALUE, order: zarr.core.common.MemoryOrder | None = None, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncodingLike | None = None, dimension_names: zarr.core.common.DimensionNames = None, storage_options: dict[str, Any] | None = None, overwrite: bool = False, config: zarr.core.array_spec.ArrayConfig | zarr.core.array_spec.ArrayConfigLike | None = None, data: numpy.typing.ArrayLike | None = None) -> zarr.core.array.Array Create an array within this group. .. deprecated:: 3.0.0 Use `Group.create_array` instead. This method lightly wraps :func:`zarr.core.array.create_array`. :Parameters: **name** : str The name of the array relative to the group. If ``path`` is ``None``, the array will be located at the root of the store. **shape** : ChunkCoords Shape of the array. **dtype** : npt.DTypeLike Data type of the array. **chunks** : ChunkCoords, optional Chunk shape of the array. If not specified, default are guessed based on the shape and dtype. **shards** : ChunkCoords, optional Shard shape of the array. The default value of ``None`` results in no sharding at all. **filters** : Iterable[Codec], optional Iterable of filters to apply to each chunk of the array, in order, before serializing that chunk to bytes. For Zarr format 3, a "filter" is a codec that takes an array and returns an array, and these values must be instances of ``ArrayArrayCodec``, or dict representations of ``ArrayArrayCodec``. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v3_default_filters`` in :mod:`zarr.core.config`. Use ``None`` to omit default filters. For Zarr format 2, a "filter" can be any numcodecs codec; you should ensure that the the order if your filters is consistent with the behavior of each filter. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v2_default_filters`` in :mod:`zarr.core.config`. Use ``None`` to omit default filters. **compressors** : Iterable[Codec], optional List of compressors to apply to the array. Compressors are applied in order, and after any filters are applied (if any are specified) and the data is serialized into bytes. For Zarr format 3, a "compressor" is a codec that takes a bytestream, and returns another bytestream. Multiple compressors my be provided for Zarr format 3. If no ``compressors`` are provided, a default set of compressors will be used. These defaults can be changed by modifying the value of ``array.v3_default_compressors`` in :mod:`zarr.core.config`. Use ``None`` to omit default compressors. For Zarr format 2, a "compressor" can be any numcodecs codec. Only a single compressor may be provided for Zarr format 2. If no ``compressor`` is provided, a default compressor will be used. in :mod:`zarr.core.config`. Use ``None`` to omit the default compressor. **compressor** : Codec, optional Deprecated in favor of ``compressors``. **serializer** : dict[str, JSON] | ArrayBytesCodec, optional Array-to-bytes codec to use for encoding the array data. Zarr format 3 only. Zarr format 2 arrays use implicit array-to-bytes conversion. If no ``serializer`` is provided, a default serializer will be used. These defaults can be changed by modifying the value of ``array.v3_default_serializer`` in :mod:`zarr.core.config`. **fill_value** : Any, optional Fill value for the array. **order** : {"C", "F"}, optional The memory of the array (default is "C"). For Zarr format 2, this parameter sets the memory order of the array. For Zarr format 3, this parameter is deprecated, because memory order is a runtime parameter for Zarr format 3 arrays. The recommended way to specify the memory order for Zarr format 3 arrays is via the ``config`` parameter, e.g. ``{'config': 'C'}``. If no ``order`` is provided, a default order will be used. This default can be changed by modifying the value of ``array.order`` in :mod:`zarr.core.config`. **attributes** : dict, optional Attributes for the array. **chunk_key_encoding** : ChunkKeyEncoding, optional A specification of how the chunk keys are represented in storage. For Zarr format 3, the default is ``{"name": "default", "separator": "/"}}``. For Zarr format 2, the default is ``{"name": "v2", "separator": "."}}``. **dimension_names** : Iterable[str], optional The names of the dimensions (default is None). Zarr format 3 only. Zarr format 2 arrays should not use this parameter. **storage_options** : dict, optional If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **overwrite** : bool, default False Whether to overwrite an array with the same name in the store, if one exists. **config** : ArrayConfig or ArrayConfigLike, optional Runtime configuration for the array. **data** : array_like The data to fill the array with. :Returns: AsyncArray .. .. !! processed by numpydoc !! .. py:method:: array_keys() -> collections.abc.Generator[str, None] Return an iterator over group member names. .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> group.create_array("subarray", shape=(10,), chunks=(10,)) >>> for name in group.array_keys(): ... print(name) subarray .. !! processed by numpydoc !! .. py:method:: array_values() -> collections.abc.Generator[zarr.core.array.Array, None] Return an iterator over group members. .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> group.create_array("subarray", shape=(10,), chunks=(10,)) >>> for subarray in group.array_values(): ... print(subarray) .. !! processed by numpydoc !! .. py:method:: arrays() -> collections.abc.Generator[tuple[str, zarr.core.array.Array], None] Return the sub-arrays of this group as a generator of (name, array) pairs .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> group.create_array("subarray", shape=(10,), chunks=(10,)) >>> for name, subarray in group.arrays(): ... print(name, subarray) subarray .. !! processed by numpydoc !! .. py:method:: create(*args: Any, **kwargs: Any) -> zarr.core.array.Array .. py:method:: create_array(name: str, *, shape: zarr.core.common.ShapeLike | None = None, dtype: zarr.core.dtype.ZDTypeLike | None = None, data: numpy.ndarray[Any, numpy.dtype[Any]] | None = None, chunks: zarr.core.common.ChunkCoords | Literal['auto'] = 'auto', shards: zarr.core.array.ShardsLike | None = None, filters: zarr.core.array.FiltersLike = 'auto', compressors: zarr.core.array.CompressorsLike = 'auto', compressor: zarr.core.array.CompressorLike = 'auto', serializer: zarr.core.array.SerializerLike = 'auto', fill_value: Any | None = DEFAULT_FILL_VALUE, order: zarr.core.common.MemoryOrder | None = None, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncodingLike | None = None, dimension_names: zarr.core.common.DimensionNames = None, storage_options: dict[str, Any] | None = None, overwrite: bool = False, config: zarr.core.array_spec.ArrayConfigLike | None = None, write_data: bool = True) -> zarr.core.array.Array Create an array within this group. This method lightly wraps :func:`zarr.core.array.create_array`. :Parameters: **name** : str The name of the array relative to the group. If ``path`` is ``None``, the array will be located at the root of the store. **shape** : ChunkCoords, optional Shape of the array. Can be ``None`` if ``data`` is provided. **dtype** : npt.DTypeLike | None Data type of the array. Can be ``None`` if ``data`` is provided. **data** : Array-like data to use for initializing the array. If this parameter is provided, the ``shape`` and ``dtype`` parameters must be identical to ``data.shape`` and ``data.dtype``, or ``None``. **chunks** : ChunkCoords, optional Chunk shape of the array. If not specified, default are guessed based on the shape and dtype. **shards** : ChunkCoords, optional Shard shape of the array. The default value of ``None`` results in no sharding at all. **filters** : Iterable[Codec], optional Iterable of filters to apply to each chunk of the array, in order, before serializing that chunk to bytes. For Zarr format 3, a "filter" is a codec that takes an array and returns an array, and these values must be instances of ``ArrayArrayCodec``, or dict representations of ``ArrayArrayCodec``. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v3_default_filters`` in :mod:`zarr.core.config`. Use ``None`` to omit default filters. For Zarr format 2, a "filter" can be any numcodecs codec; you should ensure that the the order if your filters is consistent with the behavior of each filter. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v2_default_filters`` in :mod:`zarr.core.config`. Use ``None`` to omit default filters. **compressors** : Iterable[Codec], optional List of compressors to apply to the array. Compressors are applied in order, and after any filters are applied (if any are specified) and the data is serialized into bytes. For Zarr format 3, a "compressor" is a codec that takes a bytestream, and returns another bytestream. Multiple compressors my be provided for Zarr format 3. If no ``compressors`` are provided, a default set of compressors will be used. These defaults can be changed by modifying the value of ``array.v3_default_compressors`` in :mod:`zarr.core.config`. Use ``None`` to omit default compressors. For Zarr format 2, a "compressor" can be any numcodecs codec. Only a single compressor may be provided for Zarr format 2. If no ``compressor`` is provided, a default compressor will be used. in :mod:`zarr.core.config`. Use ``None`` to omit the default compressor. **compressor** : Codec, optional Deprecated in favor of ``compressors``. **serializer** : dict[str, JSON] | ArrayBytesCodec, optional Array-to-bytes codec to use for encoding the array data. Zarr format 3 only. Zarr format 2 arrays use implicit array-to-bytes conversion. If no ``serializer`` is provided, a default serializer will be used. These defaults can be changed by modifying the value of ``array.v3_default_serializer`` in :mod:`zarr.core.config`. **fill_value** : Any, optional Fill value for the array. **order** : {"C", "F"}, optional The memory of the array (default is "C"). For Zarr format 2, this parameter sets the memory order of the array. For Zarr format 3, this parameter is deprecated, because memory order is a runtime parameter for Zarr format 3 arrays. The recommended way to specify the memory order for Zarr format 3 arrays is via the ``config`` parameter, e.g. ``{'config': 'C'}``. If no ``order`` is provided, a default order will be used. This default can be changed by modifying the value of ``array.order`` in :mod:`zarr.core.config`. **attributes** : dict, optional Attributes for the array. **chunk_key_encoding** : ChunkKeyEncoding, optional A specification of how the chunk keys are represented in storage. For Zarr format 3, the default is ``{"name": "default", "separator": "/"}}``. For Zarr format 2, the default is ``{"name": "v2", "separator": "."}}``. **dimension_names** : Iterable[str], optional The names of the dimensions (default is None). Zarr format 3 only. Zarr format 2 arrays should not use this parameter. **storage_options** : dict, optional If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **overwrite** : bool, default False Whether to overwrite an array with the same name in the store, if one exists. **config** : ArrayConfig or ArrayConfigLike, optional Runtime configuration for the array. **write_data** : bool If a pre-existing array-like object was provided to this function via the ``data`` parameter then ``write_data`` determines whether the values in that array-like object should be written to the Zarr array created by this function. If ``write_data`` is ``False``, then the array will be left empty. :Returns: AsyncArray .. .. !! processed by numpydoc !! .. py:method:: create_dataset(name: str, **kwargs: Any) -> zarr.core.array.Array Create an array. .. deprecated:: 3.0.0 The h5py compatibility methods will be removed in 3.1.0. Use `Group.create_array` instead. Arrays are known as "datasets" in HDF5 terminology. For compatibility with h5py, Zarr groups also implement the :func:`zarr.Group.require_dataset` method. :Parameters: **name** : str Array name. **\*\*kwargs** : dict Additional arguments passed to :func:`zarr.Group.create_array` :Returns: **a** : Array .. .. !! processed by numpydoc !! .. py:method:: create_group(name: str, **kwargs: Any) -> Group Create a sub-group. :Parameters: **name** : str Name of the new subgroup. :Returns: Group .. .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> subgroup = group.create_group("subgroup") >>> subgroup .. !! processed by numpydoc !! .. py:method:: create_hierarchy(nodes: dict[str, zarr.core.metadata.ArrayV2Metadata | zarr.core.metadata.ArrayV3Metadata | GroupMetadata], *, overwrite: bool = False) -> collections.abc.Iterator[tuple[str, Group | zarr.core.array.Array]] Create a hierarchy of arrays or groups rooted at this group. This function will parse its input to ensure that the hierarchy is complete. Any implicit groups will be inserted as needed. For example, an input like ```{'a/b': GroupMetadata}``` will be parsed to ```{'': GroupMetadata, 'a': GroupMetadata, 'b': Groupmetadata}```. Explicitly specifying a root group, e.g. with ``nodes = {'': GroupMetadata()}`` is an error because this group instance is the root group. After input parsing, this function then creates all the nodes in the hierarchy concurrently. Arrays and Groups are yielded in the order they are created. This order is not stable and should not be relied on. :Parameters: **nodes** : dict[str, GroupMetadata | ArrayV3Metadata | ArrayV2Metadata] A dictionary defining the hierarchy. The keys are the paths of the nodes in the hierarchy, relative to the path of the group. The values are instances of ``GroupMetadata`` or ``ArrayMetadata``. Note that all values must have the same ``zarr_format`` as the parent group -- it is an error to mix zarr versions in the same hierarchy. Leading "/" characters from keys will be removed. **overwrite** : bool Whether to overwrite existing nodes. Defaults to ``False``, in which case an error is raised instead of overwriting an existing array or group. This function will not erase an existing group unless that group is explicitly named in ``nodes``. If ``nodes`` defines implicit groups, e.g. ``{`'a/b/c': GroupMetadata}``, and a group already exists at path ``a``, then this function will leave the group at ``a`` as-is. :Yields: tuple[str, Array | Group]. .. .. rubric:: Examples >>> import zarr >>> from zarr.core.group import GroupMetadata >>> root = zarr.create_group(store={}) >>> for key, val in root.create_hierarchy({'a/b/c': GroupMetadata()}): ... print(key, val) ... .. !! processed by numpydoc !! .. py:method:: empty(*, name: str, shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.Array Create an empty array with the specified shape in this Group. The contents will be filled with the array's fill value or zeros if no fill value is provided. :Parameters: **name** : str Name of the array. **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. .. rubric:: Notes The contents of an empty Zarr array are not defined. On attempting to retrieve data from an empty Zarr array, any values may be returned, and these are not guaranteed to be stable from one access to the next. .. !! processed by numpydoc !! .. py:method:: empty_like(*, name: str, data: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.Array Create an empty sub-array like `data`. The contents will be filled with the array's fill value or zeros if no fill value is provided. :Parameters: **name** : str Name of the array. **data** : array-like The array to create an empty array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. rubric:: Notes The contents of an empty Zarr array are not defined. On attempting to retrieve data from an empty Zarr array, any values may be returned, and these are not guaranteed to be stable from one access to the next. .. !! processed by numpydoc !! .. py:method:: from_store(store: zarr.storage.StoreLike, *, attributes: dict[str, Any] | None = None, zarr_format: zarr.core.common.ZarrFormat = 3, overwrite: bool = False) -> Group :classmethod: Instantiate a group from an initialized store. :Parameters: **store** : StoreLike StoreLike containing the Group. **attributes** : dict, optional A dictionary of JSON-serializable values with user-defined attributes. **zarr_format** : {2, 3}, optional Zarr storage format version. **overwrite** : bool, optional If True, do not raise an error if the group already exists. :Returns: Group Group instantiated from the store. :Raises: ContainsArrayError, ContainsGroupError, ContainsArrayAndGroupError .. .. !! processed by numpydoc !! .. py:method:: full(*, name: str, shape: zarr.core.common.ChunkCoords, fill_value: Any | None, **kwargs: Any) -> zarr.core.array.Array Create an array, with "fill_value" being used as the default value for uninitialized portions of the array. :Parameters: **name** : str Name of the array. **shape** : int or tuple of int Shape of the empty array. **fill_value** : scalar Value to fill the array with. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:method:: full_like(*, name: str, data: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.Array Create a sub-array like `data` filled with the `fill_value` of `data` . :Parameters: **name** : str Name of the array. **data** : array-like The array to create the new array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:method:: get(path: str, default: DefaultT | None = None) -> zarr.core.array.Array | Group | DefaultT | None Obtain a group member, returning default if not found. :Parameters: **path** : str Group member name. **default** : object Default value to return if key is not found (default: None). :Returns: object Group member (Array or Group) or default if not found. .. rubric:: Examples >>> import zarr >>> group = Group.from_store(zarr.storage.MemoryStore() >>> group.create_array(name="subarray", shape=(10,), chunks=(10,)) >>> group.create_group(name="subgroup") >>> group.get("subarray") >>> group.get("subgroup") >>> group.get("nonexistent", None) .. !! processed by numpydoc !! .. py:method:: group_keys() -> collections.abc.Generator[str, None] Return an iterator over group member names. .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> group.create_group("subgroup") >>> for name in group.group_keys(): ... print(name) subgroup .. !! processed by numpydoc !! .. py:method:: group_values() -> collections.abc.Generator[Group, None] Return an iterator over group members. .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> group.create_group("subgroup") >>> for subgroup in group.group_values(): ... print(subgroup) .. !! processed by numpydoc !! .. py:method:: groups() -> collections.abc.Generator[tuple[str, Group], None] Return the sub-groups of this group as a generator of (name, group) pairs. .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> group.create_group("subgroup") >>> for name, subgroup in group.groups(): ... print(name, subgroup) subgroup .. !! processed by numpydoc !! .. py:method:: info_complete() -> Any Return information for a group. If this group doesn't contain consolidated metadata then this will need to read from the backing Store. :Returns: GroupInfo .. .. seealso:: :obj:`Group.info` .. .. !! processed by numpydoc !! .. py:method:: keys() -> collections.abc.Generator[str, None] Return an iterator over group member names. .. rubric:: Examples >>> import zarr >>> g1 = zarr.group() >>> g2 = g1.create_group('foo') >>> g3 = g1.create_group('bar') >>> d1 = g1.create_array('baz', shape=(10,), chunks=(10,)) >>> d2 = g1.create_array('quux', shape=(10,), chunks=(10,)) >>> for name in g1.keys(): ... print(name) baz bar foo quux .. !! processed by numpydoc !! .. py:method:: members(max_depth: int | None = 0, *, use_consolidated_for_children: bool = True) -> tuple[tuple[str, zarr.core.array.Array | Group], Ellipsis] Returns an AsyncGenerator over the arrays and groups contained in this group. This method requires that `store_path.store` supports directory listing. The results are not guaranteed to be ordered. :Parameters: **max_depth** : int, default 0 The maximum number of levels of the hierarchy to include. By default, (``max_depth=0``) only immediate children are included. Set ``max_depth=None`` to include all nodes, and some positive integer to consider children within that many levels of the root Group. **use_consolidated_for_children** : bool, default True Whether to use the consolidated metadata of child groups loaded from the store. Note that this only affects groups loaded from the store. If the current Group already has consolidated metadata, it will always be used. :Returns: path: A string giving the path to the target, relative to the Group ``self``. value: AsyncArray or AsyncGroup The AsyncArray or AsyncGroup that is a child of ``self``. .. !! processed by numpydoc !! .. py:method:: move(source: str, dest: str) -> None Move a sub-group or sub-array from one path to another. .. rubric:: Notes Not implemented .. !! processed by numpydoc !! .. py:method:: nmembers(max_depth: int | None = 0) -> int Count the number of members in this group. :Parameters: **max_depth** : int, default 0 The maximum number of levels of the hierarchy to include. By default, (``max_depth=0``) only immediate children are included. Set ``max_depth=None`` to include all nodes, and some positive integer to consider children within that many levels of the root Group. :Returns: **count** : int .. .. !! processed by numpydoc !! .. py:method:: ones(*, name: str, shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.Array Create an array, with one being used as the default value for uninitialized portions of the array. :Parameters: **name** : str Name of the array. **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:method:: ones_like(*, name: str, data: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.Array Create a sub-array of ones like `data`. :Parameters: **name** : str Name of the array. **data** : array-like The array to create the new array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:method:: open(store: zarr.storage.StoreLike, zarr_format: zarr.core.common.ZarrFormat | None = 3) -> Group :classmethod: Open a group from an initialized store. :Parameters: **store** : StoreLike Store containing the Group. **zarr_format** : {2, 3, None}, optional Zarr storage format version. :Returns: Group Group instantiated from the store. .. !! processed by numpydoc !! .. py:method:: require_array(name: str, *, shape: zarr.core.common.ShapeLike, **kwargs: Any) -> zarr.core.array.Array Obtain an array, creating if it doesn't exist. Other `kwargs` are as per :func:`zarr.Group.create_array`. :Parameters: **name** : str Array name. **\*\*kwargs** See :func:`zarr.Group.create_array`. :Returns: **a** : Array .. .. !! processed by numpydoc !! .. py:method:: require_dataset(name: str, *, shape: zarr.core.common.ShapeLike, **kwargs: Any) -> zarr.core.array.Array Obtain an array, creating if it doesn't exist. .. deprecated:: 3.0.0 The h5py compatibility methods will be removed in 3.1.0. Use `Group.require_array` instead. Arrays are known as "datasets" in HDF5 terminology. For compatibility with h5py, Zarr groups also implement the :func:`zarr.Group.create_dataset` method. Other `kwargs` are as per :func:`zarr.Group.create_dataset`. :Parameters: **name** : str Array name. **\*\*kwargs** See :func:`zarr.Group.create_dataset`. :Returns: **a** : Array .. .. !! processed by numpydoc !! .. py:method:: require_group(name: str, **kwargs: Any) -> Group Obtain a sub-group, creating one if it doesn't exist. :Parameters: **name** : str Group name. :Returns: **g** : Group .. .. !! processed by numpydoc !! .. py:method:: require_groups(*names: str) -> tuple[Group, Ellipsis] Convenience method to require multiple groups in a single call. :Parameters: **\*names** : str Group names. :Returns: **groups** : tuple of Groups .. .. !! processed by numpydoc !! .. py:method:: tree(expand: bool | None = None, level: int | None = None) -> Any Return a tree-like representation of a hierarchy. This requires the optional ``rich`` dependency. :Parameters: **expand** : bool, optional This keyword is not yet supported. A NotImplementedError is raised if it's used. **level** : int, optional The maximum depth below this Group to display in the tree. :Returns: TreeRepr A pretty-printable object displaying the hierarchy. .. !! processed by numpydoc !! .. py:method:: update_attributes(new_attributes: dict[str, Any]) -> Group Update the attributes of this group. .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> group.update_attributes({"foo": "bar"}) >>> group.attrs.asdict() {'foo': 'bar'} .. !! processed by numpydoc !! .. py:method:: update_attributes_async(new_attributes: dict[str, Any]) -> Group :async: Update the attributes of this group. .. rubric:: Examples >>> import zarr >>> group = zarr.group() >>> await group.update_attributes_async({"foo": "bar"}) >>> group.attrs.asdict() {'foo': 'bar'} .. !! processed by numpydoc !! .. py:method:: zeros(*, name: str, shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.Array Create an array, with zero being used as the default value for uninitialized portions of the array. :Parameters: **name** : str Name of the array. **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:method:: zeros_like(*, name: str, data: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.Array Create a sub-array of zeros like `data`. :Parameters: **name** : str Name of the array. **data** : array-like The array to create the new array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:property:: attrs :type: zarr.core.attributes.Attributes Attributes of this Group .. !! processed by numpydoc !! .. py:property:: basename :type: str Final component of name. .. !! processed by numpydoc !! .. py:property:: info :type: Any Return the statically known information for a group. :Returns: GroupInfo .. .. seealso:: :obj:`Group.info_complete` All information about a group, including dynamic information like the children members. .. !! processed by numpydoc !! .. py:property:: metadata :type: GroupMetadata Group metadata. .. !! processed by numpydoc !! .. py:property:: name :type: str Group name following h5py convention. .. !! processed by numpydoc !! .. py:property:: path :type: str Storage path. .. !! processed by numpydoc !! .. py:property:: read_only :type: bool .. py:property:: store :type: zarr.abc.store.Store .. py:property:: store_path :type: zarr.storage.StorePath Path-like interface for the Store. .. !! processed by numpydoc !! .. py:property:: synchronizer :type: None .. py:function:: array(data: numpy.typing.ArrayLike | zarr.core.array.Array, **kwargs: Any) -> zarr.core.array.Array Create an array filled with `data`. :Parameters: **data** : array_like The data to fill the array with. **\*\*kwargs** Passed through to :func:`create`. :Returns: **array** : Array The new array. .. !! processed by numpydoc !! .. py:function:: consolidate_metadata(store: zarr.storage.StoreLike, path: str | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None) -> zarr.core.group.Group Consolidate the metadata of all nodes in a hierarchy. Upon completion, the metadata of the root node in the Zarr hierarchy will be updated to include all the metadata of child nodes. For Stores that do not use consolidated metadata, this operation raises a `TypeError`. :Parameters: **store** : StoreLike The store-like object whose metadata you wish to consolidate. **path** : str, optional A path to a group in the store to consolidate at. Only children below that group will be consolidated. By default, the root node is used so all the metadata in the store is consolidated. **zarr_format** : {2, 3, None}, optional The zarr format of the hierarchy. By default the zarr format is inferred. :Returns: group: Group The group, with the ``consolidated_metadata`` field set to include the metadata of each child node. If the Store doesn't support consolidated metadata, this function raises a `TypeError`. See ``Store.supports_consolidated_metadata``. .. !! processed by numpydoc !! .. py:function:: copy(*args: Any, **kwargs: Any) -> tuple[int, int, int] .. py:function:: copy_all(*args: Any, **kwargs: Any) -> tuple[int, int, int] .. py:function:: copy_store(*args: Any, **kwargs: Any) -> tuple[int, int, int] .. py:function:: create(shape: zarr.core.common.ChunkCoords | int, *, chunks: zarr.core.common.ChunkCoords | int | bool | None = None, dtype: zarr.core.dtype.ZDTypeLike | None = None, compressor: zarr.core.array.CompressorLike = 'auto', fill_value: Any | None = DEFAULT_FILL_VALUE, order: zarr.core.common.MemoryOrder | None = None, store: str | zarr.storage.StoreLike | None = None, synchronizer: Any | None = None, overwrite: bool = False, path: zarr.api.asynchronous.PathLike | None = None, chunk_store: zarr.storage.StoreLike | None = None, filters: collections.abc.Iterable[dict[str, zarr.core.common.JSON] | numcodecs.abc.Codec] | None = None, cache_metadata: bool | None = None, cache_attrs: bool | None = None, read_only: bool | None = None, object_codec: zarr.abc.codec.Codec | None = None, dimension_separator: Literal['.', '/'] | None = None, write_empty_chunks: bool | None = None, zarr_version: zarr.core.common.ZarrFormat | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, meta_array: Any | None = None, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_shape: zarr.core.common.ChunkCoords | int | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncoding | tuple[Literal['default'], Literal['.', '/']] | tuple[Literal['v2'], Literal['.', '/']] | None = None, codecs: collections.abc.Iterable[zarr.abc.codec.Codec | dict[str, zarr.core.common.JSON]] | None = None, dimension_names: zarr.core.common.DimensionNames = None, storage_options: dict[str, Any] | None = None, config: zarr.core.array_spec.ArrayConfigLike | None = None, **kwargs: Any) -> zarr.core.array.Array Create an array. :Parameters: **shape** : int or tuple of ints Array shape. **chunks** : int or tuple of ints, optional Chunk shape. If True, will be guessed from `shape` and `dtype`. If False, will be set to `shape`, i.e., single chunk for the whole array. If an int, the chunk size in each dimension will be given by the value of `chunks`. Default is True. **dtype** : str or dtype, optional NumPy dtype. **compressor** : Codec, optional Primary compressor. **fill_value** : object Default value to use for uninitialized portions of the array. **order** : {'C', 'F'}, optional Deprecated in favor of the ``config`` keyword argument. Pass ``{'order': }`` to ``create`` instead of using this parameter. Memory layout to be used within each chunk. If not specified, the ``array.order`` parameter in the global config will be used. **store** : Store or str Store or path to directory in file system or name of zip file. **synchronizer** : object, optional Array synchronizer. **overwrite** : bool, optional If True, delete all pre-existing data in `store` at `path` before creating the array. **path** : str, optional Path under which array is stored. **chunk_store** : MutableMapping, optional Separate storage for chunks. If not provided, `store` will be used for storage of both chunks and metadata. **filters** : sequence of Codecs, optional Sequence of filters to use to encode chunk data prior to compression. **cache_metadata** : bool, optional If True, array configuration metadata will be cached for the lifetime of the object. If False, array metadata will be reloaded prior to all data access and modification operations (may incur overhead depending on storage and data access pattern). **cache_attrs** : bool, optional If True (default), user attributes will be cached for attribute read operations. If False, user attributes are reloaded from the store prior to all attribute read operations. **read_only** : bool, optional True if array should be protected against modification. **object_codec** : Codec, optional A codec to encode object arrays, only needed if dtype=object. **dimension_separator** : {'.', '/'}, optional Separator placed between the dimensions of a chunk. **write_empty_chunks** : bool, optional Deprecated in favor of the ``config`` keyword argument. Pass ``{'write_empty_chunks': }`` to ``create`` instead of using this parameter. If True, all chunks will be stored regardless of their contents. If False, each chunk is compared to the array's fill value prior to storing. If a chunk is uniformly equal to the fill value, then that chunk is not be stored, and the store entry for that chunk's key is deleted. **zarr_format** : {2, 3, None}, optional The zarr format to use when saving. **meta_array** : array-like, optional An array instance to use for determining arrays to create and return to users. Use `numpy.empty(())` by default. **storage_options** : dict If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **config** : ArrayConfigLike, optional Runtime configuration of the array. If provided, will override the default values from `zarr.config.array`. :Returns: **z** : Array The array. .. !! processed by numpydoc !! .. py:function:: create_array(store: str | zarr.storage.StoreLike, *, name: str | None = None, shape: zarr.core.common.ShapeLike | None = None, dtype: zarr.core.dtype.ZDTypeLike | None = None, data: numpy.ndarray[Any, numpy.dtype[Any]] | None = None, chunks: zarr.core.common.ChunkCoords | Literal['auto'] = 'auto', shards: zarr.core.array.ShardsLike | None = None, filters: zarr.core.array.FiltersLike = 'auto', compressors: zarr.core.array.CompressorsLike = 'auto', serializer: zarr.core.array.SerializerLike = 'auto', fill_value: Any | None = DEFAULT_FILL_VALUE, order: zarr.core.common.MemoryOrder | None = None, zarr_format: zarr.core.common.ZarrFormat | None = 3, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncodingLike | None = None, dimension_names: zarr.core.common.DimensionNames = None, storage_options: dict[str, Any] | None = None, overwrite: bool = False, config: zarr.core.array_spec.ArrayConfigLike | None = None, write_data: bool = True) -> zarr.core.array.Array Create an array. This function wraps :func:`zarr.core.array.create_array`. :Parameters: **store** : str or Store Store or path to directory in file system or name of zip file. **name** : str or None, optional The name of the array within the store. If ``name`` is ``None``, the array will be located at the root of the store. **shape** : ChunkCoords, optional Shape of the array. Can be ``None`` if ``data`` is provided. **dtype** : ZDTypeLike, optional Data type of the array. Can be ``None`` if ``data`` is provided. **data** : np.ndarray, optional Array-like data to use for initializing the array. If this parameter is provided, the ``shape`` and ``dtype`` parameters must be identical to ``data.shape`` and ``data.dtype``, or ``None``. **chunks** : ChunkCoords, optional Chunk shape of the array. If not specified, default are guessed based on the shape and dtype. **shards** : ChunkCoords, optional Shard shape of the array. The default value of ``None`` results in no sharding at all. **filters** : Iterable[Codec], optional Iterable of filters to apply to each chunk of the array, in order, before serializing that chunk to bytes. For Zarr format 3, a "filter" is a codec that takes an array and returns an array, and these values must be instances of ``ArrayArrayCodec``, or dict representations of ``ArrayArrayCodec``. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v3_default_filters`` in :mod:`zarr.core.config`. Use ``None`` to omit default filters. For Zarr format 2, a "filter" can be any numcodecs codec; you should ensure that the the order if your filters is consistent with the behavior of each filter. If no ``filters`` are provided, a default set of filters will be used. These defaults can be changed by modifying the value of ``array.v2_default_filters`` in :mod:`zarr.core.config`. Use ``None`` to omit default filters. **compressors** : Iterable[Codec], optional List of compressors to apply to the array. Compressors are applied in order, and after any filters are applied (if any are specified) and the data is serialized into bytes. For Zarr format 3, a "compressor" is a codec that takes a bytestream, and returns another bytestream. Multiple compressors my be provided for Zarr format 3. If no ``compressors`` are provided, a default set of compressors will be used. These defaults can be changed by modifying the value of ``array.v3_default_compressors`` in :mod:`zarr.core.config`. Use ``None`` to omit default compressors. For Zarr format 2, a "compressor" can be any numcodecs codec. Only a single compressor may be provided for Zarr format 2. If no ``compressor`` is provided, a default compressor will be used. in :mod:`zarr.core.config`. Use ``None`` to omit the default compressor. **serializer** : dict[str, JSON] | ArrayBytesCodec, optional Array-to-bytes codec to use for encoding the array data. Zarr format 3 only. Zarr format 2 arrays use implicit array-to-bytes conversion. If no ``serializer`` is provided, a default serializer will be used. These defaults can be changed by modifying the value of ``array.v3_default_serializer`` in :mod:`zarr.core.config`. **fill_value** : Any, optional Fill value for the array. **order** : {"C", "F"}, optional The memory of the array (default is "C"). For Zarr format 2, this parameter sets the memory order of the array. For Zarr format 3, this parameter is deprecated, because memory order is a runtime parameter for Zarr format 3 arrays. The recommended way to specify the memory order for Zarr format 3 arrays is via the ``config`` parameter, e.g. ``{'config': 'C'}``. If no ``order`` is provided, a default order will be used. This default can be changed by modifying the value of ``array.order`` in :mod:`zarr.core.config`. **zarr_format** : {2, 3}, optional The zarr format to use when saving. **attributes** : dict, optional Attributes for the array. **chunk_key_encoding** : ChunkKeyEncoding, optional A specification of how the chunk keys are represented in storage. For Zarr format 3, the default is ``{"name": "default", "separator": "/"}}``. For Zarr format 2, the default is ``{"name": "v2", "separator": "."}}``. **dimension_names** : Iterable[str], optional The names of the dimensions (default is None). Zarr format 3 only. Zarr format 2 arrays should not use this parameter. **storage_options** : dict, optional If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **overwrite** : bool, default False Whether to overwrite an array with the same name in the store, if one exists. If `True`, all existing paths in the store will be deleted. **config** : ArrayConfigLike, optional Runtime configuration for the array. **write_data** : bool If a pre-existing array-like object was provided to this function via the ``data`` parameter then ``write_data`` determines whether the values in that array-like object should be written to the Zarr array created by this function. If ``write_data`` is ``False``, then the array will be left empty. :Returns: Array The array. .. rubric:: Examples >>> import zarr >>> store = zarr.storage.MemoryStore() >>> arr = await zarr.create_array( >>> store=store, >>> shape=(100,100), >>> chunks=(10,10), >>> dtype='i4', >>> fill_value=0) .. !! processed by numpydoc !! .. py:function:: create_group(store: zarr.storage.StoreLike, *, path: str | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, overwrite: bool = False, attributes: dict[str, Any] | None = None, storage_options: dict[str, Any] | None = None) -> zarr.core.group.Group Create a group. :Parameters: **store** : Store or str Store or path to directory in file system. **path** : str, optional Group path within store. **overwrite** : bool, optional If True, pre-existing data at ``path`` will be deleted before creating the group. **zarr_format** : {2, 3, None}, optional The zarr format to use when saving. If no ``zarr_format`` is provided, the default format will be used. This default can be changed by modifying the value of ``default_zarr_format`` in :mod:`zarr.core.config`. **storage_options** : dict If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. :Returns: Group The new group. .. !! processed by numpydoc !! .. py:function:: create_hierarchy(*, store: zarr.abc.store.Store, nodes: dict[str, zarr.core.group.GroupMetadata | zarr.core.metadata.ArrayV2Metadata | zarr.core.metadata.ArrayV3Metadata], overwrite: bool = False) -> collections.abc.Iterator[tuple[str, zarr.core.group.Group | zarr.core.array.Array]] Create a complete zarr hierarchy from a collection of metadata objects. This function will parse its input to ensure that the hierarchy is complete. Any implicit groups will be inserted as needed. For example, an input like ```{'a/b': GroupMetadata}``` will be parsed to ```{'': GroupMetadata, 'a': GroupMetadata, 'b': Groupmetadata}``` After input parsing, this function then creates all the nodes in the hierarchy concurrently. Arrays and Groups are yielded in the order they are created. This order is not stable and should not be relied on. :Parameters: **store** : Store The storage backend to use. **nodes** : dict[str, GroupMetadata | ArrayV3Metadata | ArrayV2Metadata] A dictionary defining the hierarchy. The keys are the paths of the nodes in the hierarchy, relative to the root of the ``Store``. The root of the store can be specified with the empty string ``''``. The values are instances of ``GroupMetadata`` or ``ArrayMetadata``. Note that all values must have the same ``zarr_format`` -- it is an error to mix zarr versions in the same hierarchy. Leading "/" characters from keys will be removed. **overwrite** : bool Whether to overwrite existing nodes. Defaults to ``False``, in which case an error is raised instead of overwriting an existing array or group. This function will not erase an existing group unless that group is explicitly named in ``nodes``. If ``nodes`` defines implicit groups, e.g. ``{`'a/b/c': GroupMetadata}``, and a group already exists at path ``a``, then this function will leave the group at ``a`` as-is. :Yields: tuple[str, Group | Array] This function yields (path, node) pairs, in the order the nodes were created. .. rubric:: Examples >>> from zarr import create_hierarchy >>> from zarr.storage import MemoryStore >>> from zarr.core.group import GroupMetadata >>> store = MemoryStore() >>> nodes = {'a': GroupMetadata(attributes={'name': 'leaf'})} >>> nodes_created = dict(create_hierarchy(store=store, nodes=nodes)) >>> print(nodes) # {'a': GroupMetadata(attributes={'name': 'leaf'}, zarr_format=3, consolidated_metadata=None, node_type='group')} .. !! processed by numpydoc !! .. py:function:: empty(shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.Array Create an empty array with the specified shape. The contents will be filled with the array's fill value or zeros if no fill value is provided. :Parameters: **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. rubric:: Notes The contents of an empty Zarr array are not defined. On attempting to retrieve data from an empty Zarr array, any values may be returned, and these are not guaranteed to be stable from one access to the next. .. !! processed by numpydoc !! .. py:function:: empty_like(a: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.Array Create an empty array like another array. The contents will be filled with the array's fill value or zeros if no fill value is provided. :Parameters: **a** : array-like The array to create an empty array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. rubric:: Notes The contents of an empty Zarr array are not defined. On attempting to retrieve data from an empty Zarr array, any values may be returned, and these are not guaranteed to be stable from one access to the next. .. !! processed by numpydoc !! .. py:function:: from_array(store: str | zarr.storage.StoreLike, *, data: zarr.core.array.Array | numpy.typing.ArrayLike, write_data: bool = True, name: str | None = None, chunks: Literal['auto', 'keep'] | zarr.core.common.ChunkCoords = 'keep', shards: zarr.core.array.ShardsLike | None | Literal['keep'] = 'keep', filters: zarr.core.array.FiltersLike | Literal['keep'] = 'keep', compressors: zarr.core.array.CompressorsLike | Literal['keep'] = 'keep', serializer: zarr.core.array.SerializerLike | Literal['keep'] = 'keep', fill_value: Any | None = DEFAULT_FILL_VALUE, order: zarr.core.common.MemoryOrder | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, attributes: dict[str, zarr.core.common.JSON] | None = None, chunk_key_encoding: zarr.core.chunk_key_encodings.ChunkKeyEncodingLike | None = None, dimension_names: zarr.core.common.DimensionNames = None, storage_options: dict[str, Any] | None = None, overwrite: bool = False, config: zarr.core.array_spec.ArrayConfigLike | None = None) -> zarr.core.array.Array Create an array from an existing array or array-like. :Parameters: **store** : str or Store Store or path to directory in file system or name of zip file for the new array. **data** : Array | array-like The array to copy. **write_data** : bool, default True Whether to copy the data from the input array to the new array. If ``write_data`` is ``False``, the new array will be created with the same metadata as the input array, but without any data. **name** : str or None, optional The name of the array within the store. If ``name`` is ``None``, the array will be located at the root of the store. **chunks** : ChunkCoords or "auto" or "keep", optional Chunk shape of the array. Following values are supported: - "auto": Automatically determine the chunk shape based on the array's shape and dtype. - "keep": Retain the chunk shape of the data array if it is a zarr Array. - ChunkCoords: A tuple of integers representing the chunk shape. If not specified, defaults to "keep" if data is a zarr Array, otherwise "auto". **shards** : ChunkCoords, optional Shard shape of the array. Following values are supported: - "auto": Automatically determine the shard shape based on the array's shape and chunk shape. - "keep": Retain the shard shape of the data array if it is a zarr Array. - ChunkCoords: A tuple of integers representing the shard shape. - None: No sharding. If not specified, defaults to "keep" if data is a zarr Array, otherwise None. **filters** : Iterable[Codec] or "auto" or "keep", optional Iterable of filters to apply to each chunk of the array, in order, before serializing that chunk to bytes. For Zarr format 3, a "filter" is a codec that takes an array and returns an array, and these values must be instances of ``ArrayArrayCodec``, or dict representations of ``ArrayArrayCodec``. For Zarr format 2, a "filter" can be any numcodecs codec; you should ensure that the the order if your filters is consistent with the behavior of each filter. Following values are supported: - Iterable[Codec]: List of filters to apply to the array. - "auto": Automatically determine the filters based on the array's dtype. - "keep": Retain the filters of the data array if it is a zarr Array. If no ``filters`` are provided, defaults to "keep" if data is a zarr Array, otherwise "auto". **compressors** : Iterable[Codec] or "auto" or "keep", optional List of compressors to apply to the array. Compressors are applied in order, and after any filters are applied (if any are specified) and the data is serialized into bytes. For Zarr format 3, a "compressor" is a codec that takes a bytestream, and returns another bytestream. Multiple compressors my be provided for Zarr format 3. For Zarr format 2, a "compressor" can be any numcodecs codec. Only a single compressor may be provided for Zarr format 2. Following values are supported: - Iterable[Codec]: List of compressors to apply to the array. - "auto": Automatically determine the compressors based on the array's dtype. - "keep": Retain the compressors of the input array if it is a zarr Array. If no ``compressors`` are provided, defaults to "keep" if data is a zarr Array, otherwise "auto". **serializer** : dict[str, JSON] | ArrayBytesCodec or "auto" or "keep", optional Array-to-bytes codec to use for encoding the array data. Zarr format 3 only. Zarr format 2 arrays use implicit array-to-bytes conversion. Following values are supported: - dict[str, JSON]: A dict representation of an ``ArrayBytesCodec``. - ArrayBytesCodec: An instance of ``ArrayBytesCodec``. - "auto": a default serializer will be used. These defaults can be changed by modifying the value of ``array.v3_default_serializer`` in :mod:`zarr.core.config`. - "keep": Retain the serializer of the input array if it is a zarr Array. **fill_value** : Any, optional Fill value for the array. If not specified, defaults to the fill value of the data array. **order** : {"C", "F"}, optional The memory of the array (default is "C"). For Zarr format 2, this parameter sets the memory order of the array. For Zarr format 3, this parameter is deprecated, because memory order is a runtime parameter for Zarr format 3 arrays. The recommended way to specify the memory order for Zarr format 3 arrays is via the ``config`` parameter, e.g. ``{'config': 'C'}``. If not specified, defaults to the memory order of the data array. **zarr_format** : {2, 3}, optional The zarr format to use when saving. If not specified, defaults to the zarr format of the data array. **attributes** : dict, optional Attributes for the array. If not specified, defaults to the attributes of the data array. **chunk_key_encoding** : ChunkKeyEncoding, optional A specification of how the chunk keys are represented in storage. For Zarr format 3, the default is ``{"name": "default", "separator": "/"}}``. For Zarr format 2, the default is ``{"name": "v2", "separator": "."}}``. If not specified and the data array has the same zarr format as the target array, the chunk key encoding of the data array is used. **dimension_names** : Iterable[str], optional The names of the dimensions (default is None). Zarr format 3 only. Zarr format 2 arrays should not use this parameter. If not specified, defaults to the dimension names of the data array. **storage_options** : dict, optional If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **overwrite** : bool, default False Whether to overwrite an array with the same name in the store, if one exists. **config** : ArrayConfig or ArrayConfigLike, optional Runtime configuration for the array. :Returns: Array The array. .. rubric:: Examples Create an array from an existing Array:: >>> import zarr >>> store = zarr.storage.MemoryStore() >>> store2 = zarr.storage.LocalStore('example.zarr') >>> arr = zarr.create_array( >>> store=store, >>> shape=(100,100), >>> chunks=(10,10), >>> dtype='int32', >>> fill_value=0) >>> arr2 = zarr.from_array(store2, data=arr) Create an array from an existing NumPy array:: >>> import numpy as np >>> arr3 = zarr.from_array( zarr.storage.MemoryStore(), >>> data=np.arange(10000, dtype='i4').reshape(100, 100), >>> ) Create an array from any array-like object:: >>> arr4 = zarr.from_array( >>> zarr.storage.MemoryStore(), >>> data=[[1, 2], [3, 4]], >>> ) >>> arr4[...] array([[1, 2],[3, 4]]) Create an array from an existing Array without copying the data:: >>> arr5 = zarr.from_array( >>> zarr.storage.MemoryStore(), >>> data=arr4, >>> write_data=False, >>> ) >>> arr5[...] array([[0, 0],[0, 0]]) .. !! processed by numpydoc !! .. py:function:: full(shape: zarr.core.common.ChunkCoords, fill_value: Any, **kwargs: Any) -> zarr.core.array.Array Create an array with a default fill value. :Parameters: **shape** : int or tuple of int Shape of the empty array. **fill_value** : scalar Fill value. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:function:: full_like(a: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.Array Create a filled array like another array. :Parameters: **a** : array-like The array to create an empty array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:function:: group(store: zarr.storage.StoreLike | None = None, *, overwrite: bool = False, chunk_store: zarr.storage.StoreLike | None = None, cache_attrs: bool | None = None, synchronizer: Any | None = None, path: str | None = None, zarr_version: zarr.core.common.ZarrFormat | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, meta_array: Any | None = None, attributes: dict[str, zarr.core.common.JSON] | None = None, storage_options: dict[str, Any] | None = None) -> zarr.core.group.Group Create a group. :Parameters: **store** : Store or str, optional Store or path to directory in file system. **overwrite** : bool, optional If True, delete any pre-existing data in `store` at `path` before creating the group. **chunk_store** : Store, optional Separate storage for chunks. If not provided, `store` will be used for storage of both chunks and metadata. **cache_attrs** : bool, optional If True (default), user attributes will be cached for attribute read operations. If False, user attributes are reloaded from the store prior to all attribute read operations. **synchronizer** : object, optional Array synchronizer. **path** : str, optional Group path within store. **meta_array** : array-like, optional An array instance to use for determining arrays to create and return to users. Use `numpy.empty(())` by default. **zarr_format** : {2, 3, None}, optional The zarr format to use when saving. **storage_options** : dict If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. :Returns: **g** : Group The new group. .. !! processed by numpydoc !! .. py:function:: load(store: zarr.storage.StoreLike, path: str | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, zarr_version: zarr.core.common.ZarrFormat | None = None) -> zarr.core.buffer.NDArrayLikeOrScalar | dict[str, zarr.core.buffer.NDArrayLikeOrScalar] Load data from an array or group into memory. :Parameters: **store** : Store or str Store or path to directory in file system or name of zip file. **path** : str or None, optional The path within the store from which to load. :Returns: out If the path contains an array, out will be a numpy array. If the path contains a group, out will be a dict-like object where keys are array names and values are numpy arrays. .. seealso:: :obj:`save`, :obj:`savez` .. .. rubric:: Notes If loading data from a group of arrays, data will not be immediately loaded into memory. Rather, arrays will be loaded into memory as they are requested. .. !! processed by numpydoc !! .. py:function:: ones(shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.Array Create an array with a fill value of one. :Parameters: **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:function:: ones_like(a: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.Array Create an array of ones like another array. :Parameters: **a** : array-like The array to create an empty array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:function:: open(store: zarr.storage.StoreLike | None = None, *, mode: zarr.core.common.AccessModeLiteral | None = None, zarr_version: zarr.core.common.ZarrFormat | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, path: str | None = None, storage_options: dict[str, Any] | None = None, **kwargs: Any) -> zarr.core.array.Array | zarr.core.group.Group Open a group or array using file-mode-like semantics. :Parameters: **store** : Store or str, optional Store or path to directory in file system or name of zip file. **mode** : {'r', 'r+', 'a', 'w', 'w-'}, optional Persistence mode: 'r' means read only (must exist); 'r+' means read/write (must exist); 'a' means read/write (create if doesn't exist); 'w' means create (overwrite if exists); 'w-' means create (fail if exists). If the store is read-only, the default is 'r'; otherwise, it is 'a'. **zarr_format** : {2, 3, None}, optional The zarr format to use when saving. **path** : str or None, optional The path within the store to open. **storage_options** : dict If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **\*\*kwargs** Additional parameters are passed through to :func:`zarr.api.asynchronous.open_array` or :func:`zarr.api.asynchronous.open_group`. :Returns: **z** : array or group Return type depends on what exists in the given store. .. !! processed by numpydoc !! .. py:function:: open_array(store: zarr.storage.StoreLike | None = None, *, zarr_version: zarr.core.common.ZarrFormat | None = None, path: zarr.api.asynchronous.PathLike = '', storage_options: dict[str, Any] | None = None, **kwargs: Any) -> zarr.core.array.Array Open an array using file-mode-like semantics. :Parameters: **store** : Store or str Store or path to directory in file system or name of zip file. **zarr_version** : {2, 3, None}, optional The zarr format to use when saving. **path** : str, optional Path in store to array. **storage_options** : dict If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **\*\*kwargs** Any keyword arguments to pass to ``create``. :Returns: AsyncArray The opened array. .. !! processed by numpydoc !! .. py:function:: open_consolidated(*args: Any, use_consolidated: Literal[True] = True, **kwargs: Any) -> zarr.core.group.Group Alias for :func:`open_group` with ``use_consolidated=True``. .. !! processed by numpydoc !! .. py:function:: open_group(store: zarr.storage.StoreLike | None = None, *, mode: zarr.core.common.AccessModeLiteral = 'a', cache_attrs: bool | None = None, synchronizer: Any = None, path: str | None = None, chunk_store: zarr.storage.StoreLike | None = None, storage_options: dict[str, Any] | None = None, zarr_version: zarr.core.common.ZarrFormat | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, meta_array: Any | None = None, attributes: dict[str, zarr.core.common.JSON] | None = None, use_consolidated: bool | str | None = None) -> zarr.core.group.Group Open a group using file-mode-like semantics. :Parameters: **store** : Store, str, or mapping, optional Store or path to directory in file system or name of zip file. Strings are interpreted as paths on the local file system and used as the ``root`` argument to :class:`zarr.storage.LocalStore`. Dictionaries are used as the ``store_dict`` argument in :class:`zarr.storage.MemoryStore``. By default (``store=None``) a new :class:`zarr.storage.MemoryStore` is created. **mode** : {'r', 'r+', 'a', 'w', 'w-'}, optional Persistence mode: 'r' means read only (must exist); 'r+' means read/write (must exist); 'a' means read/write (create if doesn't exist); 'w' means create (overwrite if exists); 'w-' means create (fail if exists). **cache_attrs** : bool, optional If True (default), user attributes will be cached for attribute read operations. If False, user attributes are reloaded from the store prior to all attribute read operations. **synchronizer** : object, optional Array synchronizer. **path** : str, optional Group path within store. **chunk_store** : Store or str, optional Store or path to directory in file system or name of zip file. **storage_options** : dict If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **meta_array** : array-like, optional An array instance to use for determining arrays to create and return to users. Use `numpy.empty(())` by default. **attributes** : dict A dictionary of JSON-serializable values with user-defined attributes. **use_consolidated** : bool or str, default None Whether to use consolidated metadata. By default, consolidated metadata is used if it's present in the store (in the ``zarr.json`` for Zarr format 3 and in the ``.zmetadata`` file for Zarr format 2). To explicitly require consolidated metadata, set ``use_consolidated=True``, which will raise an exception if consolidated metadata is not found. To explicitly *not* use consolidated metadata, set ``use_consolidated=False``, which will fall back to using the regular, non consolidated metadata. Zarr format 2 allows configuring the key storing the consolidated metadata (``.zmetadata`` by default). Specify the custom key as ``use_consolidated`` to load consolidated metadata from a non-default key. :Returns: **g** : Group The new group. .. !! processed by numpydoc !! .. py:function:: open_like(a: zarr.api.asynchronous.ArrayLike, path: str, **kwargs: Any) -> zarr.core.array.Array Open a persistent array like another array. :Parameters: **a** : Array The shape and data-type of a define these same attributes of the returned array. **path** : str The path to the new array. **\*\*kwargs** Any keyword arguments to pass to the array constructor. :Returns: AsyncArray The opened array. .. !! processed by numpydoc !! .. py:function:: print_debug_info() -> None Print version info for use in bug reports. .. !! processed by numpydoc !! .. py:function:: save(store: zarr.storage.StoreLike, *args: zarr.core.buffer.NDArrayLike, zarr_version: zarr.core.common.ZarrFormat | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, path: str | None = None, **kwargs: Any) -> None Save an array or group of arrays to the local file system. :Parameters: **store** : Store or str Store or path to directory in file system or name of zip file. **\*args** : ndarray NumPy arrays with data to save. **zarr_format** : {2, 3, None}, optional The zarr format to use when saving. **path** : str or None, optional The path within the group where the arrays will be saved. **\*\*kwargs** NumPy arrays with data to save. .. !! processed by numpydoc !! .. py:function:: save_array(store: zarr.storage.StoreLike, arr: zarr.core.buffer.NDArrayLike, *, zarr_version: zarr.core.common.ZarrFormat | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, path: str | None = None, storage_options: dict[str, Any] | None = None, **kwargs: Any) -> None Save a NumPy array to the local file system. Follows a similar API to the NumPy save() function. :Parameters: **store** : Store or str Store or path to directory in file system or name of zip file. **arr** : ndarray NumPy array with data to save. **zarr_format** : {2, 3, None}, optional The zarr format to use when saving. **path** : str or None, optional The path within the store where the array will be saved. **storage_options** : dict If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **\*\*kwargs** Passed through to :func:`create`, e.g., compressor. .. !! processed by numpydoc !! .. py:function:: save_group(store: zarr.storage.StoreLike, *args: zarr.core.buffer.NDArrayLike, zarr_version: zarr.core.common.ZarrFormat | None = None, zarr_format: zarr.core.common.ZarrFormat | None = None, path: str | None = None, storage_options: dict[str, Any] | None = None, **kwargs: zarr.core.buffer.NDArrayLike) -> None Save several NumPy arrays to the local file system. Follows a similar API to the NumPy savez()/savez_compressed() functions. :Parameters: **store** : Store or str Store or path to directory in file system or name of zip file. **\*args** : ndarray NumPy arrays with data to save. **zarr_format** : {2, 3, None}, optional The zarr format to use when saving. **path** : str or None, optional Path within the store where the group will be saved. **storage_options** : dict If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise. **\*\*kwargs** NumPy arrays with data to save. .. !! processed by numpydoc !! .. py:function:: tree(grp: zarr.core.group.Group, expand: bool | None = None, level: int | None = None) -> Any Provide a rich display of the hierarchy. .. deprecated:: 3.0.0 `zarr.tree()` is deprecated and will be removed in a future release. Use `group.tree()` instead. :Parameters: **grp** : Group Zarr or h5py group. **expand** : bool, optional Only relevant for HTML representation. If True, tree will be fully expanded. **level** : int, optional Maximum depth to descend into hierarchy. :Returns: TreeRepr A pretty-printable object displaying the hierarchy. .. !! processed by numpydoc !! .. py:function:: zeros(shape: zarr.core.common.ChunkCoords, **kwargs: Any) -> zarr.core.array.Array Create an array with a fill value of zero. :Parameters: **shape** : int or tuple of int Shape of the empty array. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:function:: zeros_like(a: zarr.api.asynchronous.ArrayLike, **kwargs: Any) -> zarr.core.array.Array Create an array of zeros like another array. :Parameters: **a** : array-like The array to create an empty array like. **\*\*kwargs** Keyword arguments passed to :func:`zarr.api.asynchronous.create`. :Returns: Array The new array. .. !! processed by numpydoc !! .. py:data:: config