@@ -638,24 +638,27 @@ def from_dict(
638638 data : dict [str , JSON ],
639639 ) -> AsyncArray [ArrayV3Metadata ] | AsyncArray [ArrayV2Metadata ]:
640640 """
641- Create a Zarr array from a dictionary.
641+ Create a Zarr array from a dictionary, with support for both Zarr v2 and v3 metadata .
642642
643643 Parameters
644644 ----------
645645 store_path : StorePath
646646 The path within the store where the array should be created.
647647
648648 data : dict of str to JSON
649- A dictionary representing the array data and metadata in JSON-serializable format.
649+ A dictionary representing the array data. This dictionary should include necessary metadata
650+ for the array, such as shape, dtype, and other attributes. The format of the metadata
651+ will determine whether a Zarr v2 or v3 array is created.
652+
650653 Returns
651654 -------
652- AsyncArray
653- The created Zarr array.
655+ AsyncArray[ArrayV3Metadata] or AsyncArray[ArrayV2Metadata]
656+ The created Zarr array, either using v2 or v3 metadata based on the provided data .
654657
655658 Raises
656659 ------
657660 ValueError
658- If the provided dictionary is not compatible with the Zarr array format .
661+ If the dictionary data is invalid or incompatible with either Zarr v2 or v3 array creation .
659662 """
660663 metadata = parse_array_metadata (data )
661664 return cls (metadata = metadata , store_path = store_path )
@@ -1180,7 +1183,6 @@ async def setitem(
11801183 )
11811184 return await self ._set_selection (indexer , value , prototype = prototype )
11821185
1183-
11841186 async def resize (self , new_shape : ChunkCoords , delete_outside_chunks : bool = True ) -> Self :
11851187 """
11861188 Asynchronously resize the array to a new shape.
@@ -1262,8 +1264,6 @@ async def update_attributes(self, new_attributes: dict[str, JSON]) -> Self:
12621264 - The updated attributes will be merged with existing attributes, and any conflicts will be
12631265 overwritten by the new values.
12641266 """
1265- new_metadata = self .metadata .update_attributes (new_attributes )
1266-
12671267 # Write new metadata
12681268 await self ._save_metadata (self .metadata )
12691269
@@ -1386,16 +1386,18 @@ def from_dict(
13861386 The path within the store where the array should be created.
13871387
13881388 data : dict of str to JSON
1389- A dictionary representing the array data and metadata in JSON-serializable format.
1389+ A dictionary representing the array data. This dictionary should include necessary metadata
1390+ for the array, such as shape, dtype, fill value, and attributes.
1391+
13901392 Returns
13911393 -------
1392- AsyncArray
1394+ Array
13931395 The created Zarr array.
13941396
13951397 Raises
13961398 ------
13971399 ValueError
1398- If the provided dictionary is not compatible with the Zarr array format .
1400+ If the dictionary data is invalid or missing required fields for array creation .
13991401 """
14001402 async_array = AsyncArray .from_dict (store_path = store_path , data = data )
14011403 return cls (async_array )
0 commit comments