zarr-developers / zarr-python

An implementation of chunked, compressed, N-dimensional arrays for Python.
http://zarr.readthedocs.io/
MIT License
1.41k stars 267 forks source link

[v3] Mode 'r+' is not working #1978

Open tomwhite opened 4 weeks ago

tomwhite commented 4 weeks ago

Zarr version

3.0.0a1

Numcodecs version

0.12.1

Python Version

3.11.9

Operating System

Mac

Installation

pip

Description

It looks like 'r+', which should read or write to an existing store, doesn't work in v3. (Some of the other modes don't work either, like 'a', which should create the store for read/write if it doesn't exist.)

Steps to reproduce

>>> import zarr
>>> zarr.create(store='example-v3.zarr', shape=(3, 3))
<Array file://example-v3.zarr shape=(3, 3) dtype=float64>
>>> z = zarr.open(store='example-v3.zarr', mode='r+')
>>> z[:] = 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tom/workspace/zarr-python/src/zarr/array.py", line 720, in __setitem__
    self.set_basic_selection(cast(BasicSelection, pure_selection), value, fields=fields)
  File "/Users/tom/workspace/zarr-python/src/zarr/array.py", line 751, in set_basic_selection
    sync(self._async_array._set_selection(indexer, value, fields=fields, prototype=prototype))
  File "/Users/tom/workspace/zarr-python/src/zarr/sync.py", line 92, in sync
    raise return_result
  File "/Users/tom/workspace/zarr-python/src/zarr/sync.py", line 51, in _runner
    return await coro
           ^^^^^^^^^^
  File "/Users/tom/workspace/zarr-python/src/zarr/array.py", line 507, in _set_selection
    await self.metadata.codec_pipeline.write(
  File "/Users/tom/workspace/zarr-python/src/zarr/codecs/pipeline.py", line 504, in write
    await concurrent_map(
  File "/Users/tom/workspace/zarr-python/src/zarr/common.py", line 53, in concurrent_map
    return await asyncio.gather(*[func(*item) for item in items])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tom/workspace/zarr-python/src/zarr/codecs/pipeline.py", line 454, in write_batch
    await concurrent_map(
  File "/Users/tom/workspace/zarr-python/src/zarr/common.py", line 53, in concurrent_map
    return await asyncio.gather(*[func(*item) for item in items])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tom/workspace/zarr-python/src/zarr/codecs/pipeline.py", line 452, in _write_key
    await byte_setter.set(chunk_bytes)
  File "/Users/tom/workspace/zarr-python/src/zarr/store/core.py", line 40, in set
    await self.store.set(self.path, value)
  File "/Users/tom/workspace/zarr-python/src/zarr/store/local.py", line 128, in set
    self._check_writable()
  File "/Users/tom/workspace/zarr-python/src/zarr/abc/store.py", line 29, in _check_writable
    raise ValueError("store mode does not support writing")
ValueError: store mode does not support writing

Additional output

No response

jhamman commented 3 weeks ago

Thanks for the report here @tomwhite. We'll get this addressed before the next release.

tomwhite commented 3 weeks ago

Thanks @jhamman