|
16 | 16 | ChunkCoords, |
17 | 17 | MemoryOrder, |
18 | 18 | ZarrFormat, |
| 19 | + _warn_write_empty_chunks_kwarg, |
19 | 20 | ) |
20 | 21 | from zarr.core.config import config |
21 | 22 | from zarr.core.group import AsyncGroup, ConsolidatedMetadata, GroupMetadata |
@@ -724,7 +725,6 @@ async def create( |
724 | 725 | read_only: bool | None = None, |
725 | 726 | object_codec: Codec | None = None, # TODO: type has changed |
726 | 727 | dimension_separator: Literal[".", "/"] | None = None, |
727 | | - write_empty_chunks: bool = False, # TODO: default has changed |
728 | 728 | zarr_version: ZarrFormat | None = None, # deprecated |
729 | 729 | zarr_format: ZarrFormat | None = None, |
730 | 730 | meta_array: Any | None = None, # TODO: need type |
@@ -794,17 +794,6 @@ async def create( |
794 | 794 |
|
795 | 795 | .. versionadded:: 2.8 |
796 | 796 |
|
797 | | - write_empty_chunks : bool, optional |
798 | | - If True (default), all chunks will be stored regardless of their |
799 | | - contents. If False, each chunk is compared to the array's fill value |
800 | | - prior to storing. If a chunk is uniformly equal to the fill value, then |
801 | | - that chunk is not be stored, and the store entry for that chunk's key |
802 | | - is deleted. This setting enables sparser storage, as only chunks with |
803 | | - non-fill-value data are stored, at the expense of overhead associated |
804 | | - with checking the data of each chunk. |
805 | | -
|
806 | | - .. versionadded:: 2.11 |
807 | | -
|
808 | 797 | zarr_format : {2, 3, None}, optional |
809 | 798 | The zarr format to use when saving. |
810 | 799 | meta_array : array-like, optional |
@@ -856,8 +845,12 @@ async def create( |
856 | 845 | RuntimeWarning, |
857 | 846 | stacklevel=2, |
858 | 847 | ) |
859 | | - if write_empty_chunks: |
860 | | - warnings.warn("write_empty_chunks is not yet implemented", RuntimeWarning, stacklevel=2) |
| 848 | + |
| 849 | + if "write_empty_chunks" in kwargs: |
| 850 | + # warn users if the write_empty_chunks kwarg was used |
| 851 | + write_empty_chunks = kwargs.pop("write_empty_chunks") |
| 852 | + _warn_write_empty_chunks_kwarg(write_empty_chunks) |
| 853 | + |
861 | 854 | if meta_array is not None: |
862 | 855 | warnings.warn("meta_array is not yet implemented", RuntimeWarning, stacklevel=2) |
863 | 856 |
|
@@ -1058,6 +1051,11 @@ async def open_array( |
1058 | 1051 |
|
1059 | 1052 | zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format) |
1060 | 1053 |
|
| 1054 | + if "write_empty_chunks" in kwargs: |
| 1055 | + # warn users if the write_empty_chunks kwarg was used |
| 1056 | + write_empty_chunks = kwargs.pop("write_empty_chunks") |
| 1057 | + _warn_write_empty_chunks_kwarg(write_empty_chunks) |
| 1058 | + |
1061 | 1059 | try: |
1062 | 1060 | return await AsyncArray.open(store_path, zarr_format=zarr_format) |
1063 | 1061 | except FileNotFoundError: |
|
0 commit comments