Skip to content

Commit fc09989

Browse files
committed
add docstrings to creation in group.py
1 parent 58406c8 commit fc09989

File tree

1 file changed

+88
-21
lines changed

1 file changed

+88
-21
lines changed

src/zarr/core/group.py

Lines changed: 88 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,24 +1034,46 @@ async def create_array(
10341034
dtype : np.DtypeLike = float64
10351035
The data type of the array.
10361036
chunk_shape : tuple[int, ...] | None = None
1037-
The shape of the chunks of the array. V3 only.
1037+
The shape of the chunks of the array.
1038+
V3 only. V2 arrays should use `chunks` instead.
1039+
Default values are guessed based on the shape and dtype.
10381040
chunk_key_encoding : ChunkKeyEncoding | tuple[Literal["default"], Literal[".", "/"]] | tuple[Literal["v2"], Literal[".", "/"]] | None = None
10391041
A specification of how the chunk keys are represented in storage.
1042+
V3 only. V2 arrays should use `dimension_separator` instead.
1043+
Default is ("default", "/").
10401044
codecs : Iterable[Codec | dict[str, JSON]] | None = None
10411045
An iterable of Codec or dict serializations thereof. The elements of
10421046
this collection specify the transformation from array values to stored bytes.
1047+
V3 only. V2 arrays should use `filters` and `compressor` instead.
1048+
If no codecs are provided, default codecs will be used:
1049+
- For numeric arrays, the default is `BytesCodec` and `ZstdCodec`.
1050+
- For Unicode strings, the default is `VLenUTF8Codec`.
1051+
- For bytes or objects, the default is `VLenBytesCodec`.
1052+
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
10431053
dimension_names : Iterable[str] | None = None
10441054
The names of the dimensions of the array. V3 only.
10451055
chunks : ChunkCoords | None = None
1046-
The shape of the chunks of the array. V2 only.
1056+
The shape of the chunks of the array.
1057+
V2 only. V3 arrays should use `chunk_shape` instead.
1058+
Default values are guessed based on the shape and dtype.
10471059
dimension_separator : Literal[".", "/"] | None = None
1048-
The delimiter used for the chunk keys.
1060+
The delimiter used for the chunk keys. (default: ".")
1061+
V2 only. V3 arrays should use `chunk_key_encoding` instead.
10491062
order : Literal["C", "F"] | None = None
1050-
The memory order of the array.
1063+
The memory order of the array (default is specified in the Zarr config `array.order`).
10511064
filters : list[dict[str, JSON]] | None = None
1052-
Filters for the array.
1065+
Sequence of filters to use to encode chunk data prior to compression.
1066+
V2 only. V3 arrays should use `codecs` instead. If neither `compressor`
1067+
nor `filters` are provided, a default compressor will be used. (see
1068+
`compressor` for details)
10531069
compressor : dict[str, JSON] | None = None
1054-
The compressor for the array.
1070+
The compressor used to compress the data (default is None).
1071+
V2 only. V3 arrays should use `codecs` instead.
1072+
If neither `compressor` nor `filters` are provided, a default compressor will be used:
1073+
- For numeric arrays, the default is `ZstdCodec`.
1074+
- For Unicode strings, the default is `VLenUTF8Codec`.
1075+
- For bytes or objects, the default is `VLenBytesCodec`.
1076+
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
10551077
overwrite : bool = False
10561078
If True, a pre-existing array or group at the path of this array will
10571079
be overwritten. If False, the presence of a pre-existing array or group is
@@ -2222,7 +2244,7 @@ def create_array(
22222244
) -> Array:
22232245
"""Create a zarr array within this AsyncGroup.
22242246
2225-
This method lightly wraps AsyncArray.create.
2247+
This method lightly wraps `AsyncArray.create`.
22262248
22272249
Parameters
22282250
----------
@@ -2233,24 +2255,46 @@ def create_array(
22332255
dtype : np.DtypeLike = float64
22342256
The data type of the array.
22352257
chunk_shape : tuple[int, ...] | None = None
2236-
The shape of the chunks of the array. V3 only.
2258+
The shape of the chunks of the array.
2259+
V3 only. V2 arrays should use `chunks` instead.
2260+
Default values are guessed based on the shape and dtype.
22372261
chunk_key_encoding : ChunkKeyEncoding | tuple[Literal["default"], Literal[".", "/"]] | tuple[Literal["v2"], Literal[".", "/"]] | None = None
22382262
A specification of how the chunk keys are represented in storage.
2263+
V3 only. V2 arrays should use `dimension_separator` instead.
2264+
Default is ("default", "/").
22392265
codecs : Iterable[Codec | dict[str, JSON]] | None = None
2240-
An iterable of Codec or dict serializations thereof. The elements of this collection
2241-
specify the transformation from array values to stored bytes.
2266+
An iterable of Codec or dict serializations thereof. The elements of
2267+
this collection specify the transformation from array values to stored bytes.
2268+
V3 only. V2 arrays should use `filters` and `compressor` instead.
2269+
If no codecs are provided, default codecs will be used:
2270+
- For numeric arrays, the default is `BytesCodec` and `ZstdCodec`.
2271+
- For Unicode strings, the default is `VLenUTF8Codec`.
2272+
- For bytes or objects, the default is `VLenBytesCodec`.
2273+
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
22422274
dimension_names : Iterable[str] | None = None
22432275
The names of the dimensions of the array. V3 only.
22442276
chunks : ChunkCoords | None = None
2245-
The shape of the chunks of the array. V2 only.
2277+
The shape of the chunks of the array.
2278+
V2 only. V3 arrays should use `chunk_shape` instead.
2279+
Default values are guessed based on the shape and dtype.
22462280
dimension_separator : Literal[".", "/"] | None = None
2247-
The delimiter used for the chunk keys.
2281+
The delimiter used for the chunk keys. (default: ".")
2282+
V2 only. V3 arrays should use `chunk_key_encoding` instead.
22482283
order : Literal["C", "F"] | None = None
2249-
The memory order of the array.
2284+
The memory order of the array (default is specified in the Zarr config `array.order`).
22502285
filters : list[dict[str, JSON]] | None = None
2251-
Filters for the array.
2286+
Sequence of filters to use to encode chunk data prior to compression.
2287+
V2 only. V3 arrays should use `codecs` instead. If neither `compressor`
2288+
nor `filters` are provided, a default compressor will be used. (see
2289+
`compressor` for details)
22522290
compressor : dict[str, JSON] | None = None
2253-
The compressor for the array.
2291+
The compressor used to compress the data (default is None).
2292+
V2 only. V3 arrays should use `codecs` instead.
2293+
If neither `compressor` nor `filters` are provided, a default compressor will be used:
2294+
- For numeric arrays, the default is `ZstdCodec`.
2295+
- For Unicode strings, the default is `VLenUTF8Codec`.
2296+
- For bytes or objects, the default is `VLenBytesCodec`.
2297+
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
22542298
overwrite : bool = False
22552299
If True, a pre-existing array or group at the path of this array will
22562300
be overwritten. If False, the presence of a pre-existing array or group is
@@ -2260,6 +2304,7 @@ def create_array(
22602304
22612305
Returns
22622306
-------
2307+
22632308
Array
22642309
22652310
"""
@@ -2574,24 +2619,46 @@ def array(
25742619
dtype : np.DtypeLike = float64
25752620
The data type of the array.
25762621
chunk_shape : tuple[int, ...] | None = None
2577-
The shape of the chunks of the array. V3 only.
2622+
The shape of the chunks of the array.
2623+
V3 only. V2 arrays should use `chunks` instead.
2624+
Default values are guessed based on the shape and dtype.
25782625
chunk_key_encoding : ChunkKeyEncoding | tuple[Literal["default"], Literal[".", "/"]] | tuple[Literal["v2"], Literal[".", "/"]] | None = None
25792626
A specification of how the chunk keys are represented in storage.
2627+
V3 only. V2 arrays should use `dimension_separator` instead.
2628+
Default is ("default", "/").
25802629
codecs : Iterable[Codec | dict[str, JSON]] | None = None
25812630
An iterable of Codec or dict serializations thereof. The elements of
25822631
this collection specify the transformation from array values to stored bytes.
2632+
V3 only. V2 arrays should use `filters` and `compressor` instead.
2633+
If no codecs are provided, default codecs will be used:
2634+
- For numeric arrays, the default is `BytesCodec` and `ZstdCodec`.
2635+
- For Unicode strings, the default is `VLenUTF8Codec`.
2636+
- For bytes or objects, the default is `VLenBytesCodec`.
2637+
These defaults can be changed using the `array.v3_default_codecs` variable in the Zarr config.
25832638
dimension_names : Iterable[str] | None = None
25842639
The names of the dimensions of the array. V3 only.
25852640
chunks : ChunkCoords | None = None
2586-
The shape of the chunks of the array. V2 only.
2641+
The shape of the chunks of the array.
2642+
V2 only. V3 arrays should use `chunk_shape` instead.
2643+
Default values are guessed based on the shape and dtype.
25872644
dimension_separator : Literal[".", "/"] | None = None
2588-
The delimiter used for the chunk keys.
2645+
The delimiter used for the chunk keys. (default: ".")
2646+
V2 only. V3 arrays should use `chunk_key_encoding` instead.
25892647
order : Literal["C", "F"] | None = None
2590-
The memory order of the array.
2648+
The memory order of the array (default is specified in the Zarr config `array.order`).
25912649
filters : list[dict[str, JSON]] | None = None
2592-
Filters for the array.
2650+
Sequence of filters to use to encode chunk data prior to compression.
2651+
V2 only. V3 arrays should use `codecs` instead. If neither `compressor`
2652+
nor `filters` are provided, a default compressor will be used. (see
2653+
`compressor` for details)
25932654
compressor : dict[str, JSON] | None = None
2594-
The compressor for the array.
2655+
The compressor used to compress the data (default is None).
2656+
V2 only. V3 arrays should use `codecs` instead.
2657+
If neither `compressor` nor `filters` are provided, a default compressor will be used:
2658+
- For numeric arrays, the default is `ZstdCodec`.
2659+
- For Unicode strings, the default is `VLenUTF8Codec`.
2660+
- For bytes or objects, the default is `VLenBytesCodec`.
2661+
These defaults can be changed using the `array.v2_default_compressor` variable in the Zarr config.
25952662
overwrite : bool = False
25962663
If True, a pre-existing array or group at the path of this array will
25972664
be overwritten. If False, the presence of a pre-existing array or group is

0 commit comments

Comments
 (0)