@@ -319,10 +319,30 @@ def copy_group(self, source: Any, target: Any, _copy: Any, verbosity: int) -> No
319
319
"""
320
320
import zarr
321
321
322
+ if self .verbosity > 0 :
323
+ LOG .info (f"Copying group { source } to { target } " )
324
+
322
325
for k , v in source .attrs .items ():
326
+ if self .verbosity > 1 :
327
+ import textwrap
328
+
329
+ LOG .info (f"Copying attribute { k } = { textwrap .shorten (str (v ), 40 )} " )
323
330
target .attrs [k ] = v
324
331
325
- for name in sorted (source .keys ()):
332
+ source_keys = list (source .keys ())
333
+
334
+ if not source_keys :
335
+ raise ValueError (f"Source group { source } is empty." )
336
+
337
+ if self .verbosity > 1 :
338
+ LOG .info (f"Keys { source_keys } " )
339
+
340
+ for name in sorted (source_keys ):
341
+ if name .startswith ("." ):
342
+ if self .verbosity > 1 :
343
+ LOG .info (f"Skipping { name } " )
344
+ continue
345
+
326
346
if isinstance (source [name ], zarr .hierarchy .Group ):
327
347
group = target [name ] if name in target else target .create_group (name )
328
348
self .copy_group (
@@ -362,6 +382,11 @@ def copy(self, source: Any, target: Any, verbosity: int) -> None:
362
382
_copy = target ["_copy" ]
363
383
_copy_np = _copy [:]
364
384
385
+ if self .verbosity > 1 :
386
+ import numpy as np
387
+
388
+ LOG .info (f"copy { np .sum (_copy_np )} of { len (_copy_np )} " )
389
+
365
390
self .copy_group (source , target , _copy_np , verbosity )
366
391
del target ["_copy" ]
367
392
@@ -417,11 +442,19 @@ def open_target() -> Any:
417
442
LOG .error ("Target already exists, use either --overwrite or --resume." )
418
443
sys .exit (1 )
419
444
445
+ if self .verbosity > 0 :
446
+ LOG .info (f"Open target: { self .target } " )
447
+
420
448
target = open_target ()
421
449
422
450
assert target is not None , target
423
451
452
+ if self .verbosity > 0 :
453
+ LOG .info (f"Open source: { self .source } " )
454
+
424
455
source = zarr .open (self ._store (self .source ), mode = "r" )
456
+ # zarr.consolidate_metadata(source)
457
+
425
458
self .copy (source , target , self .verbosity )
426
459
427
460
0 commit comments