You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great work on your library. I have a library (vtk for medical image visualization) that outputs a 3D numpy array.
I want to store it on disk however it doesn't seem like there is a "convert", "save" or export function.
I tried using the following as well:
data is a 3d numpy array
outFile is path/to/my/image.zarr
z = zarr.array(data,
**path=outFile**, dtype='int16',
chunks=(100, 100, 100), compression='blosc', compression_opts=dict(cname='zstd'))
I get no error, z is created in memory, but nothing on disk.
For reference bcolz has a rootdir parameter that seems to be able to do what I want.
The easiest way to create a Zarr array using the filesystem for storage is to use the open_array function. There is an example in the tutorial section on persistent arrays.
If you have several arrays you want to store on disk, you might find it convenient to use groups. The easiest way to create a persistent group via the open_group function.
Both open_array and open_group are actually convenience function. An alternative way of creating on-disk arrays is to pass a DirectoryStore as the value of the store keyword argument to any of the array creation functions. E.g.::
Your DirectoryStore example worked.
Using open_array or open_group wouldn't work as easily as I would have to compute the proper shape to pass it as a parameter and then copy the NumPy array into the Zarr array.
Looking at the documentation, there is actually this example that I missed:
Activity
alimanfoo commentedon Jan 20, 2017
Hi Mamy,
The easiest way to create a Zarr array using the filesystem for storage is to use the open_array function. There is an example in the tutorial section on persistent arrays.
If you have several arrays you want to store on disk, you might find it convenient to use groups. The easiest way to create a persistent group via the open_group function.
Both open_array and open_group are actually convenience function. An alternative way of creating on-disk arrays is to pass a DirectoryStore as the value of the
storekeyword argument to any of the array creation functions. E.g.::Hth.
mratsim commentedon Jan 21, 2017
Thank you very much,
Your DirectoryStore example worked.
Using open_array or open_group wouldn't work as easily as I would have to compute the proper shape to pass it as a parameter and then copy the NumPy array into the Zarr array.
Looking at the documentation, there is actually this example that I missed:
but there is no example with exporting/writing an existing array to a DirectoryStore.
I'm creating a PR for that.