Skip to content

How to open a NDArray for read and write? #177

@Karol-G

Description

@Karol-G

Hey,

I am having difficulties understanding the documentation on how to create a peristent NDArray on disk that is populated slice-wise with data over time. The same goes vice-versa with reading from the NDArray on the disk.

With Zarr I would approach it like this:

Writing:

import zarr
import numpy

array_zarr = zarr.open("tmp.zarr", shape=(10, ), dtype=np.float32, chunks=(2, ), mode='w')
array_zarr[:5] = [1, 2, 1, 2, 1]
array_zarr[5:] = [3, 4, 3, 4, 3]

Reading:

import zarr
import numpy

array_zarr = zarr.open("tmp.zarr", mode='r')
array = np.zeros((10, ))
array[:5] = array_zarr[:5]
array[5:] = array_zarr[5:]

How do I do the same with blosc2?

Best regards,
Karol

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions