dask.array.to_npy_stack(dirname, x, axis=0)[source]

Write dask array to a stack of .npy files

This partitions the dask.array along one axis and stores each block along that axis as a single .npy file in the specified directory

See also



>>> x = da.ones((5, 10, 10), chunks=(2, 4, 4))  
>>> da.to_npy_stack('data/', x, axis=0)  

The .npy files store numpy arrays for x[0:2], x[2:4], and x[4:5] respectively, as is specified by the chunk size along the zeroth axis:

$ tree data/
|-- 0.npy
|-- 1.npy
|-- 2.npy
|-- info

The info file stores the dtype, chunks, and axis information of the array. You can load these stacks with the dask.array.from_npy_stack() function.

>>> y = da.from_npy_stack('data/')