@@ -281,7 +281,7 @@ async def load(
281
281
282
282
Parameters
283
283
----------
284
- store : Store or str
284
+ store : StoreLike
285
285
Store or path to directory in file system or name of zip file.
286
286
path : str or None, optional
287
287
The path within the store from which to load.
@@ -325,7 +325,7 @@ async def open(
325
325
326
326
Parameters
327
327
----------
328
- store : Store or str, optional
328
+ store : StoreLike or None, default=None
329
329
Store or path to directory in file system or name of zip file.
330
330
mode : {'r', 'r+', 'a', 'w', 'w-'}, optional
331
331
Persistence mode: 'r' means read only (must exist); 'r+' means
@@ -338,8 +338,8 @@ async def open(
338
338
path : str or None, optional
339
339
The path within the store to open.
340
340
storage_options : dict
341
- If the store is backed by an fsspec-based implementation, then this dict will be passed to
342
- the Store constructor for that implementation. Ignored otherwise.
341
+ If using an fsspec URL to create the store, these will be passed to
342
+ the backend implementation. Ignored otherwise.
343
343
**kwargs
344
344
Additional parameters are passed through to :func:`zarr.creation.open_array` or
345
345
:func:`zarr.hierarchy.open_group`.
@@ -409,7 +409,7 @@ async def save(
409
409
410
410
Parameters
411
411
----------
412
- store : Store or str
412
+ store : StoreLike
413
413
Store or path to directory in file system or name of zip file.
414
414
*args : ndarray
415
415
NumPy arrays with data to save.
@@ -445,12 +445,13 @@ async def save_array(
445
445
446
446
Parameters
447
447
----------
448
- store : Store or str
448
+ store : StoreLike
449
449
Store or path to directory in file system or name of zip file.
450
450
arr : ndarray
451
451
NumPy array with data to save.
452
452
zarr_format : {2, 3, None}, optional
453
- The zarr format to use when saving (default is 3 if not specified).
453
+ The zarr format to use when saving. The default is ``None``, which will
454
+ use the default Zarr format defined in the global configuration object.
454
455
path : str or None, optional
455
456
The path within the store where the array will be saved.
456
457
storage_options : dict
@@ -500,7 +501,7 @@ async def save_group(
500
501
501
502
Parameters
502
503
----------
503
- store : Store or str
504
+ store : StoreLike
504
505
Store or path to directory in file system or name of zip file.
505
506
*args : ndarray
506
507
NumPy arrays with data to save.
@@ -649,14 +650,13 @@ async def group(
649
650
650
651
Parameters
651
652
----------
652
- store : Store or str, optional
653
- Store or path to directory in file system.
653
+ store : StoreLike or None, default=None
654
+ Store or path to directory in file system or name of zip file .
654
655
overwrite : bool, optional
655
656
If True, delete any pre-existing data in `store` at `path` before
656
657
creating the group.
657
- chunk_store : Store, optional
658
- Separate storage for chunks. If not provided, `store` will be used
659
- for storage of both chunks and metadata.
658
+ chunk_store : StoreLike or None, default=None
659
+ Separate storage for chunks. Not implemented.
660
660
cache_attrs : bool, optional
661
661
If True (default), user attributes will be cached for attribute read
662
662
operations. If False, user attributes are reloaded from the store prior
@@ -712,8 +712,8 @@ async def create_group(
712
712
713
713
Parameters
714
714
----------
715
- store : Store or str
716
- Store or path to directory in file system.
715
+ store : StoreLike
716
+ Store or path to directory in file system or name of zip file .
717
717
path : str, optional
718
718
Group path within store.
719
719
overwrite : bool, optional
@@ -768,7 +768,7 @@ async def open_group(
768
768
769
769
Parameters
770
770
----------
771
- store : Store, str, or mapping, optional
771
+ store : StoreLike or None, default=None
772
772
Store or path to directory in file system or name of zip file.
773
773
774
774
Strings are interpreted as paths on the local file system
@@ -793,7 +793,7 @@ async def open_group(
793
793
Array synchronizer.
794
794
path : str, optional
795
795
Group path within store.
796
- chunk_store : Store or str, optional
796
+ chunk_store : StoreLike or None, default=None
797
797
Store or path to directory in file system or name of zip file.
798
798
storage_options : dict
799
799
If using an fsspec URL to create the store, these will be passed to
@@ -869,7 +869,7 @@ async def create(
869
869
compressor : CompressorLike = "auto" ,
870
870
fill_value : Any | None = DEFAULT_FILL_VALUE ,
871
871
order : MemoryOrder | None = None ,
872
- store : str | StoreLike | None = None ,
872
+ store : StoreLike | None = None ,
873
873
synchronizer : Any | None = None ,
874
874
overwrite : bool = False ,
875
875
path : PathLike | None = None ,
@@ -906,65 +906,58 @@ async def create(
906
906
shape : int or tuple of ints
907
907
Array shape.
908
908
chunks : int or tuple of ints, optional
909
- The shape of the array's chunks.
910
- Zarr format 2 only. Zarr format 3 arrays should use `chunk_shape` instead.
911
- If not specified, default values are guessed based on the shape and dtype.
909
+ Chunk shape. If True, will be guessed from ``shape`` and ``dtype``. If
910
+ False, will be set to ``shape``, i.e., single chunk for the whole array.
911
+ If an int, the chunk size in each dimension will be given by the value
912
+ of ``chunks``. Default is True.
912
913
dtype : str or dtype, optional
913
914
NumPy dtype.
914
- chunk_shape : int or tuple of ints, optional
915
- The shape of the Array's chunks (default is None).
916
- Zarr format 3 only. Zarr format 2 arrays should use `chunks` instead.
917
- chunk_key_encoding : ChunkKeyEncoding, optional
918
- A specification of how the chunk keys are represented in storage.
919
- Zarr format 3 only. Zarr format 2 arrays should use `dimension_separator` instead.
920
- Default is ``("default", "/")``.
921
- codecs : Sequence of Codecs or dicts, optional
922
- An iterable of Codec or dict serializations of Codecs. The elements of
923
- this collection specify the transformation from array values to stored bytes.
924
- Zarr format 3 only. Zarr format 2 arrays should use ``filters`` and ``compressor`` instead.
925
-
926
- If no codecs are provided, default codecs will be used:
927
-
928
- - For numeric arrays, the default is ``BytesCodec`` and ``ZstdCodec``.
929
- - For Unicode strings, the default is ``VLenUTF8Codec`` and ``ZstdCodec``.
930
- - For bytes or objects, the default is ``VLenBytesCodec`` and ``ZstdCodec``.
931
-
932
- These defaults can be changed by modifying the value of ``array.v3_default_filters``,
933
- ``array.v3_default_serializer`` and ``array.v3_default_compressors`` in :mod:`zarr.core.config`.
934
915
compressor : Codec, optional
935
916
Primary compressor to compress chunk data.
936
917
Zarr format 2 only. Zarr format 3 arrays should use ``codecs`` instead.
937
918
938
- If neither ``compressor`` nor ``filters`` are provided, a default compressor will be used:
939
-
940
- - For numeric arrays, the default is ``ZstdCodec``.
941
- - For Unicode strings, the default is ``VLenUTF8Codec``.
942
- - For bytes or objects, the default is ``VLenBytesCodec``.
919
+ If neither ``compressor`` nor ``filters`` are provided, the default compressor
920
+ :class:`zarr.codecs.ZstdCodec` is used.
943
921
944
- These defaults can be changed by modifying the value of ``array.v2_default_compressor`` in :mod:`zarr.core.config` .
945
- fill_value : object
946
- Default value to use for uninitialized portions of the array.
922
+ If ``compressor`` is set to ``None``, no compression is used .
923
+ fill_value : Any, optional
924
+ Fill value for the array.
947
925
order : {'C', 'F'}, optional
948
926
Deprecated in favor of the ``config`` keyword argument.
949
927
Pass ``{'order': <value>}`` to ``create`` instead of using this parameter.
950
928
Memory layout to be used within each chunk.
951
929
If not specified, the ``array.order`` parameter in the global config will be used.
952
- store : Store or str
930
+ store : StoreLike or None, default=None
953
931
Store or path to directory in file system or name of zip file.
954
932
synchronizer : object, optional
955
933
Array synchronizer.
956
934
overwrite : bool, optional
957
- If True, delete all pre-existing data in `store` at `path` before
935
+ If True, delete all pre-existing data in `` store`` at `` path` ` before
958
936
creating the array.
959
937
path : str, optional
960
938
Path under which array is stored.
961
- chunk_store : MutableMapping, optional
962
- Separate storage for chunks. If not provided, `store` will be used
939
+ chunk_store : StoreLike or None, default=None
940
+ Separate storage for chunks. If not provided, `` store` ` will be used
963
941
for storage of both chunks and metadata.
964
- filters : sequence of Codecs, optional
965
- Sequence of filters to use to encode chunk data prior to compression.
966
- Zarr format 2 only. If no ``filters`` are provided, a default set of filters will be used.
967
- These defaults can be changed by modifying the value of ``array.v2_default_filters`` in :mod:`zarr.core.config`.
942
+ filters : Iterable[Codec] | Literal["auto"], optional
943
+ Iterable of filters to apply to each chunk of the array, in order, before serializing that
944
+ chunk to bytes.
945
+
946
+ For Zarr format 3, a "filter" is a codec that takes an array and returns an array,
947
+ and these values must be instances of :class:`zarr.abc.codec.ArrayArrayCodec`, or a
948
+ dict representations of :class:`zarr.abc.codec.ArrayArrayCodec`.
949
+
950
+ For Zarr format 2, a "filter" can be any numcodecs codec; you should ensure that the
951
+ the order if your filters is consistent with the behavior of each filter.
952
+
953
+ The default value of ``"auto"`` instructs Zarr to use a default used based on the data
954
+ type of the array and the Zarr format specified. For all data types in Zarr V3, and most
955
+ data types in Zarr V2, the default filters are empty. The only cases where default filters
956
+ are not empty is when the Zarr format is 2, and the data type is a variable-length data type like
957
+ :class:`zarr.dtype.VariableLengthUTF8` or :class:`zarr.dtype.VariableLengthUTF8`. In these cases,
958
+ the default filters contains a single element which is a codec specific to that particular data type.
959
+
960
+ To create an array with no filters, provide an empty iterable or the value ``None``.
968
961
cache_metadata : bool, optional
969
962
If True, array configuration metadata will be cached for the
970
963
lifetime of the object. If False, array metadata will be reloaded
@@ -981,7 +974,6 @@ async def create(
981
974
dimension_separator : {'.', '/'}, optional
982
975
Separator placed between the dimensions of a chunk.
983
976
Zarr format 2 only. Zarr format 3 arrays should use ``chunk_key_encoding`` instead.
984
- Default is ".".
985
977
write_empty_chunks : bool, optional
986
978
Deprecated in favor of the ``config`` keyword argument.
987
979
Pass ``{'write_empty_chunks': <value>}`` to ``create`` instead of using this parameter.
@@ -991,15 +983,36 @@ async def create(
991
983
that chunk is not be stored, and the store entry for that chunk's key
992
984
is deleted.
993
985
zarr_format : {2, 3, None}, optional
994
- The zarr format to use when saving.
995
- Default is 3.
986
+ The Zarr format to use when creating an array. The default is ``None``,
987
+ which instructs Zarr to choose the default Zarr format value defined in the
988
+ runtime configuration.
996
989
meta_array : array-like, optional
997
- An array instance to use for determining arrays to create and return
998
- to users. Use `numpy.empty(())` by default.
990
+ Not implemented.
991
+ attributes : dict[str, JSON], optional
992
+ A dictionary of user attributes to store with the array.
993
+ chunk_shape : int or tuple of ints, optional
994
+ The shape of the Array's chunks (default is None).
995
+ Zarr format 3 only. Zarr format 2 arrays should use `chunks` instead.
996
+ chunk_key_encoding : ChunkKeyEncoding, optional
997
+ A specification of how the chunk keys are represented in storage.
998
+ Zarr format 3 only. Zarr format 2 arrays should use `dimension_separator` instead.
999
+ Default is ``("default", "/")``.
1000
+ codecs : Sequence of Codecs or dicts, optional
1001
+ An iterable of Codec or dict serializations of Codecs. Zarr V3 only.
1002
+
1003
+ The elements of ``codecs`` specify the transformation from array values to stored bytes.
1004
+ Zarr format 3 only. Zarr format 2 arrays should use ``filters`` and ``compressor`` instead.
1005
+
1006
+ If no codecs are provided, default codecs will be used based on the data type of the array.
1007
+ For most data types, the default codecs are the tuple ``(BytesCodec(), ZstdCodec())``;
1008
+ data types that require a special :class:`zarr.abc.codec.ArrayBytesCodec`, like variable-length strings or bytes,
1009
+ will use the :class:`zarr.abc.codec.ArrayBytesCodec` required for the data type instead of :class:`zarr.codecs.BytesCodec`.
1010
+ dimension_names : Iterable[str | None] | None = None
1011
+ An iterable of dimension names. Zarr format 3 only.
999
1012
storage_options : dict
1000
1013
If using an fsspec URL to create the store, these will be passed to
1001
1014
the backend implementation. Ignored otherwise.
1002
- config : ArrayConfig or ArrayConfigLike, optional
1015
+ config : ArrayConfigLike, optional
1003
1016
Runtime configuration of the array. If provided, will override the
1004
1017
default values from `zarr.config.array`.
1005
1018
@@ -1224,7 +1237,7 @@ async def open_array(
1224
1237
1225
1238
Parameters
1226
1239
----------
1227
- store : Store or str
1240
+ store : StoreLike
1228
1241
Store or path to directory in file system or name of zip file.
1229
1242
zarr_version : {2, 3, None}, optional
1230
1243
The zarr format to use when saving. Deprecated in favor of zarr_format.
0 commit comments