|
13 | 13 | from zarr.storage import (DirectoryStore, ZipStore, contains_array,
|
14 | 14 | contains_group, default_compressor, init_array,
|
15 | 15 | normalize_storage_path, FSStore)
|
| 16 | +from zarr.util import normalize_dimension_separator |
16 | 17 |
|
17 | 18 |
|
18 | 19 | def create(shape, chunks=True, dtype=None, compressor='default',
|
19 | 20 | fill_value=0, order='C', store=None, synchronizer=None,
|
20 | 21 | overwrite=False, path=None, chunk_store=None, filters=None,
|
21 | 22 | cache_metadata=True, cache_attrs=True, read_only=False,
|
22 |
| - object_codec=None, **kwargs): |
| 23 | + object_codec=None, dimension_separator=None, **kwargs): |
23 | 24 | """Create an array.
|
24 | 25 |
|
25 | 26 | Parameters
|
@@ -66,6 +67,9 @@ def create(shape, chunks=True, dtype=None, compressor='default',
|
66 | 67 | True if array should be protected against modification.
|
67 | 68 | object_codec : Codec, optional
|
68 | 69 | A codec to encode object arrays, only needed if dtype=object.
|
| 70 | + dimension_separator : {'.', '/'}, optional |
| 71 | + Separator placed between the dimensions of a chunk. |
| 72 | + .. versionadded:: 2.8 |
69 | 73 |
|
70 | 74 | Returns
|
71 | 75 | -------
|
@@ -117,10 +121,16 @@ def create(shape, chunks=True, dtype=None, compressor='default',
|
117 | 121 | # API compatibility with h5py
|
118 | 122 | compressor, fill_value = _kwargs_compat(compressor, fill_value, kwargs)
|
119 | 123 |
|
| 124 | + # optional array metadata |
| 125 | + if dimension_separator is None: |
| 126 | + dimension_separator = getattr(store, "_dimension_separator", None) |
| 127 | + dimension_separator = normalize_dimension_separator(dimension_separator) |
| 128 | + |
120 | 129 | # initialize array metadata
|
121 | 130 | init_array(store, shape=shape, chunks=chunks, dtype=dtype, compressor=compressor,
|
122 | 131 | fill_value=fill_value, order=order, overwrite=overwrite, path=path,
|
123 |
| - chunk_store=chunk_store, filters=filters, object_codec=object_codec) |
| 132 | + chunk_store=chunk_store, filters=filters, object_codec=object_codec, |
| 133 | + dimension_separator=dimension_separator) |
124 | 134 |
|
125 | 135 | # instantiate array
|
126 | 136 | z = Array(store, path=path, chunk_store=chunk_store, synchronizer=synchronizer,
|
|
0 commit comments