13
13
14
14
def create (shape , chunks , dtype = None , compression = 'default' ,
15
15
compression_opts = None , fill_value = None , order = 'C' , store = None ,
16
- synchronizer = None , overwrite = False , path = None ):
16
+ synchronizer = None , overwrite = False , path = None , chunk_store = None ):
17
17
"""Create an array.
18
18
19
19
Parameters
@@ -44,6 +44,9 @@ def create(shape, chunks, dtype=None, compression='default',
44
44
array.
45
45
path : string, optional
46
46
Path under which array is stored.
47
+ chunk_store : MutableMapping, optional
48
+ Separate storage for chunks. If not provided, `store` will be used
49
+ for storage of both chunks and metadata.
47
50
48
51
Returns
49
52
-------
@@ -70,20 +73,21 @@ def create(shape, chunks, dtype=None, compression='default',
70
73
init_array (store , shape = shape , chunks = chunks , dtype = dtype ,
71
74
compression = compression , compression_opts = compression_opts ,
72
75
fill_value = fill_value , order = order , overwrite = overwrite ,
73
- path = path )
76
+ path = path , chunk_store = chunk_store )
74
77
75
78
# instantiate array
76
79
if synchronizer is not None :
77
- z = SynchronizedArray (store , synchronizer , path = path )
80
+ z = SynchronizedArray (store , synchronizer , path = path ,
81
+ chunk_store = chunk_store )
78
82
else :
79
- z = Array (store , path = path )
83
+ z = Array (store , path = path , chunk_store = chunk_store )
80
84
81
85
return z
82
86
83
87
84
88
def empty (shape , chunks , dtype = None , compression = 'default' ,
85
89
compression_opts = None , order = 'C' , store = None , synchronizer = None ,
86
- path = None , overwrite = False ):
90
+ path = None , overwrite = False , chunk_store = None ):
87
91
"""Create an empty array.
88
92
89
93
For parameter definitions see :func:`zarr.creation.create`.
@@ -98,12 +102,13 @@ def empty(shape, chunks, dtype=None, compression='default',
98
102
return create (shape = shape , chunks = chunks , dtype = dtype ,
99
103
compression = compression , compression_opts = compression_opts ,
100
104
fill_value = None , order = order , store = store ,
101
- synchronizer = synchronizer , path = path , overwrite = overwrite )
105
+ synchronizer = synchronizer , path = path , overwrite = overwrite ,
106
+ chunk_store = chunk_store )
102
107
103
108
104
109
def zeros (shape , chunks , dtype = None , compression = 'default' ,
105
110
compression_opts = None , order = 'C' , store = None , synchronizer = None ,
106
- path = None , overwrite = False ):
111
+ path = None , overwrite = False , chunk_store = None ):
107
112
"""Create an array, with zero being used as the default value for
108
113
uninitialized portions of the array.
109
114
@@ -128,12 +133,12 @@ def zeros(shape, chunks, dtype=None, compression='default',
128
133
compression = compression ,
129
134
compression_opts = compression_opts , fill_value = 0 , order = order ,
130
135
store = store , synchronizer = synchronizer , path = path ,
131
- overwrite = overwrite )
136
+ overwrite = overwrite , chunk_store = chunk_store )
132
137
133
138
134
139
def ones (shape , chunks , dtype = None , compression = 'default' ,
135
140
compression_opts = None , order = 'C' , store = None , synchronizer = None ,
136
- path = None , overwrite = False ):
141
+ path = None , overwrite = False , chunk_store = None ):
137
142
"""Create an array, with one being used as the default value for
138
143
uninitialized portions of the array.
139
144
@@ -157,12 +162,13 @@ def ones(shape, chunks, dtype=None, compression='default',
157
162
return create (shape = shape , chunks = chunks , dtype = dtype ,
158
163
compression = compression , compression_opts = compression_opts ,
159
164
fill_value = 1 , order = order , store = store ,
160
- synchronizer = synchronizer , path = path , overwrite = overwrite )
165
+ synchronizer = synchronizer , path = path , overwrite = overwrite ,
166
+ chunk_store = chunk_store )
161
167
162
168
163
169
def full (shape , chunks , fill_value , dtype = None , compression = 'default' ,
164
170
compression_opts = None , order = 'C' , store = None , synchronizer = None ,
165
- path = None , overwrite = False ):
171
+ path = None , overwrite = False , chunk_store = None ):
166
172
"""Create an array, with `fill_value` being used as the default value for
167
173
uninitialized portions of the array.
168
174
@@ -186,12 +192,13 @@ def full(shape, chunks, fill_value, dtype=None, compression='default',
186
192
return create (shape = shape , chunks = chunks , dtype = dtype ,
187
193
compression = compression , compression_opts = compression_opts ,
188
194
fill_value = fill_value , order = order , store = store ,
189
- synchronizer = synchronizer , path = path , overwrite = overwrite )
195
+ synchronizer = synchronizer , path = path , overwrite = overwrite ,
196
+ chunk_store = chunk_store )
190
197
191
198
192
199
def array (data , chunks = None , dtype = None , compression = 'default' ,
193
200
compression_opts = None , fill_value = None , order = 'C' , store = None ,
194
- synchronizer = None , path = None , overwrite = False ):
201
+ synchronizer = None , path = None , overwrite = False , chunk_store = None ):
195
202
"""Create an array filled with `data`.
196
203
197
204
The `data` argument should be a NumPy array or array-like object. For
@@ -238,7 +245,8 @@ def array(data, chunks=None, dtype=None, compression='default',
238
245
z = create (shape = shape , chunks = chunks , dtype = dtype ,
239
246
compression = compression , compression_opts = compression_opts ,
240
247
fill_value = fill_value , order = order , store = store ,
241
- synchronizer = synchronizer , path = path , overwrite = overwrite )
248
+ synchronizer = synchronizer , path = path , overwrite = overwrite ,
249
+ chunk_store = chunk_store )
242
250
243
251
# fill with data
244
252
z [:] = data
@@ -402,46 +410,49 @@ def _like_args(a, shape, chunks, dtype, compression, compression_opts, order):
402
410
403
411
def empty_like (a , shape = None , chunks = None , dtype = None , compression = None ,
404
412
compression_opts = None , order = None , store = None ,
405
- synchronizer = None , path = None , overwrite = False ):
413
+ synchronizer = None , path = None , overwrite = False ,
414
+ chunk_store = None ):
406
415
"""Create an empty array like `a`."""
407
416
shape , chunks , dtype , compression , compression_opts , order = \
408
417
_like_args (a , shape , chunks , dtype , compression , compression_opts ,
409
418
order )
410
419
return empty (shape , chunks , dtype = dtype , compression = compression ,
411
420
compression_opts = compression_opts , order = order ,
412
421
store = store , synchronizer = synchronizer , path = path ,
413
- overwrite = overwrite )
422
+ overwrite = overwrite , chunk_store = chunk_store )
414
423
415
424
416
425
def zeros_like (a , shape = None , chunks = None , dtype = None , compression = None ,
417
426
compression_opts = None , order = None , store = None ,
418
- synchronizer = None , path = None , overwrite = False ):
427
+ synchronizer = None , path = None , overwrite = False ,
428
+ chunk_store = None ):
419
429
"""Create an array of zeros like `a`."""
420
430
shape , chunks , dtype , compression , compression_opts , order = \
421
431
_like_args (a , shape , chunks , dtype , compression , compression_opts ,
422
432
order )
423
433
return zeros (shape , chunks , dtype = dtype , compression = compression ,
424
434
compression_opts = compression_opts , order = order ,
425
435
store = store , synchronizer = synchronizer , path = path ,
426
- overwrite = overwrite )
436
+ overwrite = overwrite , chunk_store = chunk_store )
427
437
428
438
429
439
def ones_like (a , shape = None , chunks = None , dtype = None , compression = None ,
430
440
compression_opts = None , order = None , store = None ,
431
- synchronizer = None , path = None , overwrite = False ):
441
+ synchronizer = None , path = None , overwrite = False , chunk_store = None ):
432
442
"""Create an array of ones like `a`."""
433
443
shape , chunks , dtype , compression , compression_opts , order = \
434
444
_like_args (a , shape , chunks , dtype , compression , compression_opts ,
435
445
order )
436
446
return ones (shape , chunks , dtype = dtype , compression = compression ,
437
447
compression_opts = compression_opts , order = order ,
438
448
store = store , synchronizer = synchronizer , path = path ,
439
- overwrite = overwrite )
449
+ overwrite = overwrite , chunk_store = chunk_store )
440
450
441
451
442
452
def full_like (a , shape = None , chunks = None , fill_value = None , dtype = None ,
443
453
compression = None , compression_opts = None , order = None ,
444
- store = None , synchronizer = None , path = None , overwrite = False ):
454
+ store = None , synchronizer = None , path = None , overwrite = False ,
455
+ chunk_store = None ):
445
456
"""Create a filled array like `a`."""
446
457
shape , chunks , dtype , compression , compression_opts , order = \
447
458
_like_args (a , shape , chunks , dtype , compression , compression_opts ,
@@ -454,7 +465,7 @@ def full_like(a, shape=None, chunks=None, fill_value=None, dtype=None,
454
465
return full (shape , chunks , fill_value , dtype = dtype ,
455
466
compression = compression , compression_opts = compression_opts ,
456
467
order = order , store = store , synchronizer = synchronizer ,
457
- path = path , overwrite = overwrite )
468
+ path = path , overwrite = overwrite , chunk_store = chunk_store )
458
469
459
470
460
471
def open_like (a , path , mode = 'a' , shape = None , chunks = None , dtype = None ,
0 commit comments