|
16 | 16 | ChunkCoords, |
17 | 17 | MemoryOrder, |
18 | 18 | ZarrFormat, |
| 19 | + _warn_order_kwarg, |
19 | 20 | _warn_write_empty_chunks_kwarg, |
20 | 21 | ) |
21 | 22 | from zarr.core.config import config |
@@ -725,6 +726,7 @@ async def create( |
725 | 726 | read_only: bool | None = None, |
726 | 727 | object_codec: Codec | None = None, # TODO: type has changed |
727 | 728 | dimension_separator: Literal[".", "/"] | None = None, |
| 729 | + write_empty_chunks: bool | None = None, |
728 | 730 | zarr_version: ZarrFormat | None = None, # deprecated |
729 | 731 | zarr_format: ZarrFormat | None = None, |
730 | 732 | meta_array: Any | None = None, # TODO: need type |
@@ -760,6 +762,7 @@ async def create( |
760 | 762 | fill_value : object |
761 | 763 | Default value to use for uninitialized portions of the array. |
762 | 764 | order : {'C', 'F'}, optional |
| 765 | + Deprecated in favor of the `array.order` configuration variable. |
763 | 766 | Memory layout to be used within each chunk. |
764 | 767 | Default is set in Zarr's config (`array.order`). |
765 | 768 | store : Store or str |
@@ -794,6 +797,19 @@ async def create( |
794 | 797 |
|
795 | 798 | .. versionadded:: 2.8 |
796 | 799 |
|
| 800 | + write_empty_chunks : bool, optional |
| 801 | + Deprecated in favor of the `array.write_empty_chunks` configuration variable. |
| 802 | +
|
| 803 | + If True (default), all chunks will be stored regardless of their |
| 804 | + contents. If False, each chunk is compared to the array's fill value |
| 805 | + prior to storing. If a chunk is uniformly equal to the fill value, then |
| 806 | + that chunk is not be stored, and the store entry for that chunk's key |
| 807 | + is deleted. This setting enables sparser storage, as only chunks with |
| 808 | + non-fill-value data are stored, at the expense of overhead associated |
| 809 | + with checking the data of each chunk. |
| 810 | +
|
| 811 | + .. versionadded:: 2.11 |
| 812 | +
|
797 | 813 | zarr_format : {2, 3, None}, optional |
798 | 814 | The zarr format to use when saving. |
799 | 815 | meta_array : array-like, optional |
@@ -839,17 +855,11 @@ async def create( |
839 | 855 | raise ValueError( |
840 | 856 | "dimension_separator is not supported for zarr format 3, use chunk_key_encoding instead" |
841 | 857 | ) |
842 | | - else: |
843 | | - warnings.warn( |
844 | | - "dimension_separator is not yet implemented", |
845 | | - RuntimeWarning, |
846 | | - stacklevel=2, |
847 | | - ) |
848 | 858 |
|
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) |
| 859 | + if order is not None: |
| 860 | + _warn_order_kwarg() |
| 861 | + if write_empty_chunks is not None: |
| 862 | + _warn_write_empty_chunks_kwarg() |
853 | 863 |
|
854 | 864 | if meta_array is not None: |
855 | 865 | warnings.warn("meta_array is not yet implemented", RuntimeWarning, stacklevel=2) |
@@ -878,6 +888,7 @@ async def create( |
878 | 888 | dimension_names=dimension_names, |
879 | 889 | attributes=attributes, |
880 | 890 | order=order, |
| 891 | + write_empty_chunks=write_empty_chunks, |
881 | 892 | **kwargs, |
882 | 893 | ) |
883 | 894 |
|
@@ -1051,10 +1062,10 @@ async def open_array( |
1051 | 1062 |
|
1052 | 1063 | zarr_format = _handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format) |
1053 | 1064 |
|
| 1065 | + if "order" in kwargs: |
| 1066 | + _warn_order_kwarg() |
1054 | 1067 | 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) |
| 1068 | + _warn_write_empty_chunks_kwarg() |
1058 | 1069 |
|
1059 | 1070 | try: |
1060 | 1071 | return await AsyncArray.open(store_path, zarr_format=zarr_format) |
|
0 commit comments