Skip to content

Commit 901ed6a

Browse files
authored
Merge branch 'main' into n5
2 parents fc90aa7 + c6180cb commit 901ed6a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/zarrify/formats/zarr2.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,14 @@ def write_to_zarr(
8787
)
8888

8989
array_paths = self._find_arrays()
90+
logger.info(f"Found {len(array_paths)} zarr v2 arrays: {array_paths}")
9091

9192
dst_store = zarr.storage.LocalStore(dest)
9293
dst_root = zarr.open_group(store=dst_store, mode='a')
9394
self._copy_group_attrs(dst_root)
9495

9596
for rel_path in array_paths:
97+
logger.info(f"Processing array: {rel_path}")
9698
zarray_path = os.path.join(self.src_path, rel_path, '.zarray')
9799
with open(zarray_path) as f:
98100
zarray_meta = json.load(f)
@@ -126,8 +128,10 @@ def write_to_zarr(
126128
dest_arr = open_ts(dst_spec)
127129
dest_chunks = dest_arr.chunk_layout.write_chunk.shape
128130

131+
logger.info(f"{rel_path}: shape={shape}, dtype={dtype}, chunk={arr_chunk_shape}, shard={arr_shard_shape}")
129132
out_slices = slices_from_chunks(normalize_chunks(dest_chunks, shape=shape))
130133
out_slices_partitioned = tuple(partition_all(100000, out_slices))
134+
logger.info(f"{rel_path}: {len(out_slices)} total slices, {len(out_slices_partitioned)} batch(es)")
131135

132136
for idx, part in enumerate(out_slices_partitioned):
133137
logger.info(f"{rel_path}: {idx + 1} / {len(out_slices_partitioned)}")

src/zarrify/to_zarr.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,26 @@ def to_zarr(src : str,
102102
codec (str, optional): compression codec name ('zstd', 'gzip', 'blosc'). Defaults to 'zstd'.
103103
codec_level (int | None, optional): codec compression level. None uses per-codec default.
104104
"""
105+
logger.info(f"Initializing dataset from {src}")
105106
dataset = init_dataset(src, axes, scale, translation, units, optimize_reads)
107+
logger.info(f"Dataset type: {type(dataset).__name__}")
106108

107109
# Handle N5Group separately as it has custom zarr creation logic
108110
codec_dict = build_codec(codec, codec_level)
109111

110112
if isinstance(dataset, N5Group):
111-
# N5 handles zarr creation internally due to tree structure complexity
112-
# RAM check is done per-array inside write_to_zarr (arrays can have different shapes)
113+
logger.info("Detected N5Group — scaling workers and starting write")
113114
client.cluster.scale(workers)
114115
dataset.write_to_zarr(dest, client, zarr_chunks, shard_shape=shard_shape, codec=codec_dict)
115116
client.cluster.scale(0)
116117
return
117118

118119
if isinstance(dataset, Zarr2Group):
119-
# RAM check is done per-array inside write_to_zarr
120+
logger.info("Detected Zarr2Group — scaling workers and starting write")
120121
client.cluster.scale(workers)
121122
dataset.write_to_zarr(str(dest), client, zarr_chunks, shard_shape=shard_shape, codec=codec_dict)
122123
client.cluster.scale(0)
124+
logger.info("Zarr2Group write complete")
123125
return
124126
else:
125127
logger.info(f"Input dataset: {type(dataset)}")

0 commit comments

Comments
 (0)