@@ -3801,7 +3801,7 @@ async def from_array(
38013801 write_data : bool = True ,
38023802 name : str | None = None ,
38033803 chunks : Literal ["auto" , "keep" ] | ChunkCoords = "keep" ,
3804- shards : ShardsLike | None = None ,
3804+ shards : ShardsLike | None | Literal [ "keep" ] = "keep" ,
38053805 filters : FiltersLike | Literal ["keep" ] = "keep" ,
38063806 compressors : CompressorsLike | Literal ["keep" ] = "keep" ,
38073807 serializer : SerializerLike | Literal ["keep" ] = "keep" ,
@@ -3840,7 +3840,15 @@ async def from_array(
38403840
38413841 If not specified, defaults to "keep" if data is a zarr Array, otherwise "auto".
38423842 shards : ChunkCoords, optional
3843- Shard shape of the array. The default value of ``None`` results in no sharding at all.
3843+ Shard shape of the array.
3844+ Following values are supported:
3845+
3846+ - "auto": Automatically determine the shard shape based on the array's shape and chunk shape.
3847+ - "keep": Retain the shard shape of the data array if it is a zarr Array.
3848+ - ChunkCoords: A tuple of integers representing the shard shape.
3849+ - None: No sharding.
3850+
3851+ If not specified, defaults to "keep" if data is a zarr Array, otherwise None.
38443852 filters : Iterable[Codec] or "auto" or "keep", optional
38453853 Iterable of filters to apply to each chunk of the array, in order, before serializing that
38463854 chunk to bytes.
@@ -3979,6 +3987,8 @@ async def from_array(
39793987 if isinstance (data , Array ):
39803988 if chunks == "keep" :
39813989 chunks = data .chunks
3990+ if shards == "keep" :
3991+ shards = data .shards
39823992 if zarr_format is None :
39833993 zarr_format = data .metadata .zarr_format
39843994 if filters == "keep" :
@@ -4010,6 +4020,8 @@ async def from_array(
40104020 else :
40114021 if chunks == "keep" :
40124022 chunks = "auto"
4023+ if shards == "keep" :
4024+ shards = None
40134025 if zarr_format is None :
40144026 zarr_format = 3
40154027 if filters == "keep" :
0 commit comments