Skip to content

Commit fc50dae

Browse files
committed
Update Create an array chapter of documentation
1 parent 20335f4 commit fc50dae

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

docs/source/basic_usage.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,22 @@ Create an array
5454
auto h = xt::get_zarr_hierarchy(store);
5555
// create an array in the hierarchy
5656
nlohmann::json attrs = {{"question", "life"}, {"answer", 42}};
57-
using S = std::vector<std::size_t>;
58-
S shape = {4, 4};
59-
S chunk_shape = {2, 2};
57+
std::vector<size_t> shape = {4, 4};
58+
std::vector<size_t> chunk_shape = {2, 2};
59+
// specify options
60+
xzarr_create_array_options<xio_gzip_config> o;
61+
o.chunk_memory_layout = 'C';
62+
o.chunk_separator = '/';
63+
o.attrs = attrs;
64+
o.chunk_pool_size = pool_size;
65+
o.fill_value = fill_value;
66+
6067
xt::zarray a = h.create_array(
6168
"/arthur/dent", // path to the array in the store
6269
shape, // array shape
6370
chunk_shape, // chunk shape
6471
"<f8", // data type, here little-endian 64-bit floating point
65-
'C', // memory layout
66-
'/', // chunk identifier separator
67-
xt::xio_binary_config(), // compressor (here, raw binary)
68-
attrs, // attributes
69-
10, // chunk pool size
70-
0. // fill value
72+
o // options
7173
);
7274
// write array data
7375
a(2, 1) = 3.;

0 commit comments

Comments
 (0)