File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,29 @@ module documentation.
3030
3131.. _user-guide-array :
3232
33+ Initializing with Data
34+ ---------------------
35+ Pass existing data during array creation for better performance:
36+
37+ .. code-block :: python
38+
39+ import zarr
40+ import numpy as np
41+
42+ data = np.random.rand(1000 , 1000 )
43+ arr = zarr.create_array(" data.zarr" , shape = data.shape, data = data)
44+
45+ This avoids a separate write step and is more efficient than:
46+
47+ .. code-block :: python
48+
49+ # Less efficient approach
50+ arr = zarr.create_array(" data.zarr" , shape = (1000 , 1000 ))
51+ arr[:] = data
52+
53+ .. note ::
54+ For cloud stores like S3, use ``data= `` with async writes for best performance.
55+
3356Reading and writing data
3457------------------------
3558
You can’t perform that action at this time.
0 commit comments