@@ -396,8 +396,9 @@ def copy_store(source, dest, source_path='', dest_path='', excludes=None,
396
396
"""Copy data directly from the `source` store to the `dest` store. Use this
397
397
function when you want to copy a group or array in the most efficient way,
398
398
preserving all configuration and attributes. This function is more efficient
399
- because it avoids de-compressing and re-compressing data, rather the compressed
400
- chunk data for each array are copied directly between stores.
399
+ than the copy() or copy_all() functions because it avoids de-compressing and
400
+ re-compressing data, rather the compressed chunk data for each array are copied
401
+ directly between stores.
401
402
402
403
Parameters
403
404
----------
@@ -423,7 +424,8 @@ def copy_store(source, dest, source_path='', dest_path='', excludes=None,
423
424
Examples
424
425
--------
425
426
>>> import zarr
426
- >>> root = zarr.group()
427
+ >>> store1 = zarr.DirectoryStore('data/example.zarr')
428
+ >>> root = zarr.group(store1, overwrite=True)
427
429
>>> foo = root.create_group('foo')
428
430
>>> bar = foo.create_group('bar')
429
431
>>> baz = bar.create_dataset('baz', shape=100, chunks=50, dtype='i8')
@@ -434,24 +436,24 @@ def copy_store(source, dest, source_path='', dest_path='', excludes=None,
434
436
└── foo
435
437
└── bar
436
438
└── baz (100,) int64
437
- >>> source = root.store
438
- >>> dest = dict() # or could be any other type of store
439
439
>>> import sys
440
- >>> zarr.copy_store(source, dest, log=sys.stdout)
440
+ >>> store2 = zarr.ZipStore('data/example.zip', mode='w') # or any type of store
441
+ >>> zarr.copy_store(store1, store2, log=sys.stdout)
441
442
.zgroup -> .zgroup
442
443
foo/.zgroup -> foo/.zgroup
443
444
foo/bar/.zgroup -> foo/bar/.zgroup
444
445
foo/bar/baz/.zarray -> foo/bar/baz/.zarray
445
446
foo/bar/baz/0 -> foo/bar/baz/0
446
447
foo/bar/baz/1 -> foo/bar/baz/1
447
- >>> new_root = zarr.group(dest )
448
+ >>> new_root = zarr.group(store2 )
448
449
>>> new_root.tree()
449
450
/
450
451
└── foo
451
452
└── bar
452
453
└── baz (100,) int64
453
454
>>> new_root['foo/bar/baz'][:]
454
455
array([ 0, 1, 2, ..., 97, 98, 99])
456
+ >>> store2.close() # zip stores need to be closed
455
457
456
458
"""
457
459
0 commit comments