zarr.creation
=============

.. py:module:: zarr.creation

.. autoapi-nested-parse::

   Helpers for creating arrays.

   .. warning::

       This sub-module is deprecated. All functions here are defined
       in the top level zarr namespace instead.

   ..
       !! processed by numpydoc !!


Functions
---------

.. autoapisummary::

   zarr.creation.array
   zarr.creation.create
   zarr.creation.empty
   zarr.creation.empty_like
   zarr.creation.full
   zarr.creation.full_like
   zarr.creation.ones
   zarr.creation.ones_like
   zarr.creation.open_array
   zarr.creation.open_like
   zarr.creation.zeros
   zarr.creation.zeros_like


Module Contents
---------------

.. py:function:: array(data: numpy.typing.ArrayLike, **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:: create(shape: zarr.core.common.ChunkCoords | int, *, chunks: zarr.core.common.ChunkCoords | int | bool | None = None, dtype: numpy.typing.DTypeLike | None = None, compressor: dict[str, zarr.core.common.JSON] | None = None, fill_value: Any | None = 0, 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: list[dict[str, zarr.core.common.JSON]] | 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: collections.abc.Iterable[str] | None = 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': <value>}`` 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': <value>}`` 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:: 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:: 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:: 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_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_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:: 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 !!

