diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 088ffcc76dc..6a1fbb896b8 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -37,6 +37,10 @@ Deprecations Bug fixes ~~~~~~~~~ +- Update the parameters of :py:meth:`~xarray.DataArray.to_zarr` to match :py:meth:`~xarray.Dataset.to_zarr`. + This fixes the issue where using the ``zarr_version`` parameter would raise a deprecation warning telling the user to use + a non-existent ``zarr_format`` parameter instead. (:issue:`10163`, :pull:`10164`) + By `Karl Krauth `_. Documentation ~~~~~~~~~~~~~ diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index b5f3cd5c200..a240ed2da36 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -4242,6 +4242,9 @@ def to_zarr( safe_chunks: bool = True, storage_options: dict[str, str] | None = None, zarr_version: int | None = None, + zarr_format: int | None = None, + write_empty_chunks: bool | None = None, + chunkmanager_store_kwargs: dict[str, Any] | None = None, ) -> ZarrStore: ... # compute=False returns dask.Delayed @@ -4262,6 +4265,9 @@ def to_zarr( safe_chunks: bool = True, storage_options: dict[str, str] | None = None, zarr_version: int | None = None, + zarr_format: int | None = None, + write_empty_chunks: bool | None = None, + chunkmanager_store_kwargs: dict[str, Any] | None = None, ) -> Delayed: ... def to_zarr( @@ -4280,6 +4286,9 @@ def to_zarr( safe_chunks: bool = True, storage_options: dict[str, str] | None = None, zarr_version: int | None = None, + zarr_format: int | None = None, + write_empty_chunks: bool | None = None, + chunkmanager_store_kwargs: dict[str, Any] | None = None, ) -> ZarrStore | Delayed: """Write DataArray contents to a Zarr store @@ -4380,9 +4389,30 @@ def to_zarr( Any additional parameters for the storage backend (ignored for local paths). zarr_version : int or None, optional - The desired zarr spec version to target (currently 2 or 3). The - default of None will attempt to determine the zarr version from - ``store`` when possible, otherwise defaulting to 2. + + .. deprecated:: 2024.9.1 + Use ``zarr_format`` instead. + + zarr_format : int or None, optional + The desired zarr format to target (currently 2 or 3). The default + of None will attempt to determine the zarr version from ``store`` when + possible, otherwise defaulting to the default version used by + the zarr-python library installed. + write_empty_chunks : bool or None, optional + 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. This setting enables sparser storage, as only chunks with + non-fill-value data are stored, at the expense of overhead associated + with checking the data of each chunk. If None (default) fall back to + specification(s) in ``encoding`` or Zarr defaults. A ``ValueError`` + will be raised if the value of this (if not None) differs with + ``encoding``. + chunkmanager_store_kwargs : dict, optional + Additional keyword arguments passed on to the `ChunkManager.store` method used to store + chunked arrays. For example for a dask array additional kwargs will be passed eventually to + :py:func:`dask.array.store()`. Experimental API that should not be relied upon. Returns ------- @@ -4448,6 +4478,9 @@ def to_zarr( safe_chunks=safe_chunks, storage_options=storage_options, zarr_version=zarr_version, + zarr_format=zarr_format, + write_empty_chunks=write_empty_chunks, + chunkmanager_store_kwargs=chunkmanager_store_kwargs, ) def to_dict( pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy