Blosc / python-blosc2

https://www.blosc.org/python-blosc2
Other
83 stars 19 forks source link

Allow to create a SChunk in reading mode #206

Closed JanSellner closed 4 months ago

JanSellner commented 4 months ago

Related issue: #204

With this PR, it is possible to open a schunk in reading mode (mode="r" or mmap_mode="r") via SChunk.__init__. I also adapted the tests so that this use case is covered. The reading mode is now similar to blosc2.open but explicitly only works for schunks and not ndarrays (opening an existing ndarray via the SChunk interface probably does not make any sense).

This is now also in accordance with the documentation of SChunk.__init__ which explicitly mention the reading modes.

FrancescAlted commented 4 months ago

Thanks @JanSellner !

FrancescAlted commented 4 months ago

FWIW in commit 466d98a I added that SChunk.__init__() can also be used for opening existing super-chunks (on-disk). Also, I have made 100 cols max for docstrings (although PEP 8 recommends 72).