Skip to content

Commit 30e59e3

Browse files
thewtexCopilot
andauthored
Update py/ngff_zarr/to_ngff_zarr.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f8817ba commit 30e59e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

py/ngff_zarr/to_ngff_zarr.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,12 @@ def to_ngff_zarr(
988988
# Get the chunks - these are now the shards if sharding is enabled
989989
chunks = tuple([c[0] for c in arr.chunks])
990990

991-
# For TensorStore, shards are the same as chunks when sharding is enabled
992-
shards = chunks if chunks_per_shard is not None else None
991+
# For TensorStore, calculate shards based on chunks_per_shard when sharding is enabled
992+
shards = (
993+
tuple(c // s for c, s in zip(chunks, chunks_per_shard))
994+
if chunks_per_shard is not None
995+
else None
996+
)
993997

994998
# Determine write method based on memory requirements
995999
if memory_usage(image) > config.memory_target and multiscales.scale_factors:

0 commit comments

Comments
 (0)