Skip to content

Add store.with_read_only() copy method #3105

Closed

Description

@maxrjones

Thank you for the efforts that have gone into hardening Zarr-Python's approach to read/write modes!

Now that it's no longer possible to open an array in read mode with a store with read_only=False, I'm wondering if it would be possible/advisable to add a public setter method to modify a store's mode? This is the code that I had been working with. It'd be convenient to open a read only array without needing to create a new store instance:

def array_roundtrip(store):
    """
    Round trip an array using a Zarr store

    Args:
        store: Store-Like object
    """
    data = np.ones((3,3))
    arr = zarr.create_array(store=store, overwrite=True, data=data)
    assert isinstance(arr, Array)
    # Read set values
    arr2 = zarr.open_array(store=store, mode="r")
    assert isinstance(arr2, Array)
    np.testing.assert_array_equal(arr[:], data)

Activity

  1. d-v-b commented on May 30, 2025

    @d-v-b
    Contributor

    I'm pretty strongly opposed to setting attributes of an object after its been created, but another way to achieve this is to create a brand new store with a different mode. An idea I had a while ago was that each store would have a with_mode method that would return a new store instance with a different mode.

    related: #2448

  2. d-v-b commented on May 30, 2025

    @d-v-b
    Contributor

    @TomAugspurger added with_mode to the store abc here, but I'm not seeing that method any more. Now I'm curious when it was removed...

  3. maxrjones commented on May 30, 2025

    @maxrjones
    MemberAuthor

    FYI I ran into some confusing behavior with xr.open_zarr in virtual_tiff returning an empty dataset when using Zarr-Python's main branch, which didn't happen during the latest release. This led me to run xarray's upstream tests locally which showed many failures related to the new mode handling. I'm not sure yet if this is related to the issues in my virtual_tiff tests, but wanted to share that the change as-is has a high disruptive potential. (cc @jhamman)

    =============================================================================================================================================== short test summary info ================================================================================================================================================
    FAILED xarray/tests/test_backends.py::TestInstrumentedZarrStore::test_append - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestInstrumentedZarrStore::test_region_write - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_test_data[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_load[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_dataset_compute[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_pickle[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_pickle_dataarray[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_None_variable[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_object_dtype[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_encoded_characters[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_numpy_datetime_data[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_cftime_datetime_data[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_timedelta_data[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_float64_data[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_coordinates[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_global_coordinates[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_coordinates_with_space[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_boolean_dtype[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_orthogonal_indexing[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing_negative_step[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_outer_indexing_reversed[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_isel_dataarray[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_array_type_after_indexing[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_dropna[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_ondisk_after_print[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_empty_vlen_string_array[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_mask_and_scale[2-dtype0-create_unsigned_masked_scaled_data-create_encoded_unsigned_masked_scaled_data] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_mask_and_scale[2-dtype0-create_signed_masked_scaled_data-create_encoded_signed_masked_scaled_data] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_mask_and_scale[2-dtype0-create_masked_and_scaled_data-create_encoded_masked_and_scaled_data] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[2-fill_value0-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[2-fill_value1-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[2--1-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[2-255-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_coordinate_variables_after_dataset_roundtrip[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[2] - Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted.
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_coordinates_encoding[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_endian[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg_dates[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_default_fill_value[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_via_encoding_kwarg[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_encoding_same_dtype[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_multiindex_not_implemented[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_string_object_warning[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[2-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[2-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[2-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_read_non_consolidated_warning[2] - Failed: DID NOT WARN. No warnings of type (<class 'RuntimeWarning'>,) were emitted.
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_non_existent_store[2] - AssertionError: Regex pattern did not match.
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_auto_chunk[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_manual_chunk[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_warning_on_bad_chunks[2] - Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted.
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_uneven_dask_chunks[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunk_encoding[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_dask[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[2-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[2-group1] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_compressor_encoding[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_group[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_dataset_caching[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_append_with_mode_rplus_success[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_check_encoding_is_consistent_after_append[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_append_with_new_variable[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_no_overwrite[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_to_zarr_compute_false_roundtrip[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_to_zarr_append_compute_false_roundtrip[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_save_emptydim[2-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_save_emptydim[2-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_no_warning_from_open_emptydim_with_chunks[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-False-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-False-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-False-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-False-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-False-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-False-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-True-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-True-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-True-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-True-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-True-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-False-True-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-False-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-False-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-False-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-False-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-False-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-False-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-True-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-True-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-True-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-True-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-True-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-True-True-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-False-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-False-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-False-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-False-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-False-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-False-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-True-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-True-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-True-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-True-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-True-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[2-None-True-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region_mode[2-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region_mode[2-r+] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region_mode[2-a] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_preexisting_override_metadata[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region_errors[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_encoding_chunksizes[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_partial_dask_chunks[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_larger_dask_chunks[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_open_zarr_use_cftime[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_read_select_write[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_attributes[2-obj0] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_attributes[2-obj1] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[2-datetime64[ns]] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[2-timedelta64[ns]] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunked_cftime_datetime[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_cache_members[2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[2-int] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[2-float] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[2] - AssertionError: Regex pattern did not match.
    FAILED xarray/tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[2] - AssertionError: Regex pattern did not match.
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_zero_dimensional_variable[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_test_data[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_load[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_dataset_compute[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_pickle[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_pickle_dataarray[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_None_variable[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_object_dtype[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_data[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_string_encoded_characters[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_numpy_datetime_data[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_cftime_datetime_data[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_timedelta_data[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_float64_data[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_coordinates[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_global_coordinates[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_coordinates_with_space[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_boolean_dtype[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_orthogonal_indexing[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_vectorized_indexing_negative_step[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_outer_indexing_reversed[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_isel_dataarray[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_array_type_after_indexing[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_dropna[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_ondisk_after_print[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_empty_vlen_string_array[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_mask_and_scale[3-dtype0-create_unsigned_masked_scaled_data-create_encoded_unsigned_masked_scaled_data] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_mask_and_scale[3-dtype0-create_signed_masked_scaled_data-create_encoded_signed_masked_scaled_data] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_mask_and_scale[3-dtype0-create_masked_and_scaled_data-create_encoded_masked_and_scaled_data] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value0-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-fill_value1-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3--1-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_unsigned[3-255-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_not_coordinates_in_file[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_coordinate_variables_after_dataset_roundtrip[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_grid_mapping_and_bounds_are_coordinates_after_dataarray_roundtrip[3] - Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) matching the regex were emitted.
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_coordinates_encoding[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_encoding_kwarg_dates[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_default_fill_value[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_via_encoding_kwarg[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_explicitly_omit_fill_value_in_coord_via_encoding_kwarg[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_encoding_same_dtype[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_multiindex_not_implemented[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_string_object_warning[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_roundtrip_consolidated[3-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_read_non_consolidated_warning[3] - Failed: DID NOT WARN. No warnings of type (<class 'RuntimeWarning'>,) were emitted.
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_non_existent_store[3] - AssertionError: Regex pattern did not match.
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_auto_chunk[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_manual_chunk[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_warning_on_bad_chunks[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_uneven_dask_chunks[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunk_encoding[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_shard_encoding[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_dask[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_persistence_modes[3-group1] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_compressor_encoding[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_group[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_dataset_caching[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_append_with_mode_rplus_success[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-U] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_append_string_length_mismatch_works[3-S] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_check_encoding_is_consistent_after_append[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_append_with_new_variable[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_append_with_append_dim_no_overwrite[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_to_zarr_compute_false_roundtrip[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_to_zarr_append_compute_false_roundtrip[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_save_emptydim[3-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_no_warning_from_open_emptydim_with_chunks[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-False-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-False-True-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-False-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-True-True-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-False-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-False-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-False] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-True] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region[3-None-True-True-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-None] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-r+] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region_mode[3-a] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_preexisting_override_metadata[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_region_errors[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_encoding_chunksizes[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_partial_dask_chunks[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunk_encoding_with_larger_dask_chunks[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_open_zarr_use_cftime[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_write_read_select_write[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_attributes[3-obj0] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_attributes[3-obj1] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-datetime64[ns]] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunked_datetime64_or_timedelta64[3-timedelta64[ns]] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_chunked_cftime_datetime[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_cache_members[3] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[3-int] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDictStore::test_zarr_fill_value_setting[3-float] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestZarrDirectoryStore::test_non_existent_store[3] - AssertionError: Regex pattern did not match.
    FAILED xarray/tests/test_backends.py::TestZarrWriteEmpty::test_non_existent_store[3] - AssertionError: Regex pattern did not match.
    FAILED xarray/tests/test_backends.py::test_zarr_version_deprecated - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends.py::TestPydap::test_cmp_local_file - AssertionError: Left and right Dataset objects are not equal
    FAILED xarray/tests/test_backends.py::TestPydap::test_dask - AssertionError: Left and right Dataset objects are not equal
    FAILED xarray/tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=2] - ValueError: Store is not read-only but mode is 'r'
    FAILED xarray/tests/test_backends_datatree.py::TestZarrDatatreeIO::test_to_zarr_zip_store[zarr_format=3] - ValueError: Store is not read-only but mode is 'r'
    ========================================================================================================= 269 failed, 19815 passed, 1777 skipped, 223 xfailed, 31 xpassed, 2155 warnings in 634.07s (0:10:34) ==========================================================================================================
    
  4. d-v-b commented on May 30, 2025

    @d-v-b
    Contributor

    likely due to changes added in #3068

  5. dstansby commented on May 30, 2025

    @dstansby
    Contributor

    I'm pretty strongly opposed to setting attributes of an object after its been created

    Why so?

    I'd be 👍 to adding this functionality - one case I can think of where one wouldn't want to copy the store would be creating a memory store, filling it with some data, then marking it as read only.

  6. maxrjones commented on May 30, 2025

    @maxrjones
    MemberAuthor

    The following shows why a setter is actually a bad idea unless array and store modes are decoupled, since it's not obvious to users that array mode state is deferred to the store. So someone could change the store mode to change the contents of one array / group and not expect that it changes the write mode of all arrays / groups linked to that store.

    import zarr
    import zarr.storage
    import numpy as np
    
    store = zarr.storage.LocalStore("test-dir", read_only=False)
    read_only_store = zarr.storage.LocalStore("test-dir", read_only=True)
    arr = zarr.array(store=store, data=np.ones((3,3)))
    arr = zarr.open_array(read_only_store, mode="r")
    print(arr[:])
    # Change my read only store to be writable
    read_only_store._read_only = False
    # Write to the array that I opened as read only
    arr[:] = 42
    print(arr[:])
    arr

    A convenience function to create a copy with a different mode could be nice though.

  7. d-v-b commented on May 31, 2025

    @d-v-b
    Contributor

    I'm pretty strongly opposed to setting attributes of an object after its been created

    Why so?

    I'd be 👍 to adding this functionality - one case I can think of where one wouldn't want to copy the store would be creating a memory store, filling it with some data, then marking it as read only.

    In the normal use of a memory store it just holds a reference to a python dict, which itself is mutable no matter what because of python dict semantics. So copying the store doesn't actually copy any data, which makes it very cheap to do.

    As for why I don't like a mutable attribute for this kind of thing, IMO it becomes very hard to reason about the read / write semantics of an object if those semantics can change during the object's lifecycle. It's much easier to reason about read / writeness if that property is immutable and fixed when creating the store instance.

  8. dstansby commented on May 31, 2025

    @dstansby
    Contributor

    👍 - I didn't realise it was easy to copy a memory store without copying the contents.

  9. dstansby commented on May 31, 2025

    @dstansby
    Contributor

    In which case, it seems like a good way forward here is to implement some kind of with_mode() method?

  10. d-v-b commented on May 31, 2025

    @d-v-b
    Contributor

    i think that's a good way forward. for every store except zipstore this will work easily, and for zipstore we can raise NotImplementedError

  11. changed the title [-]Add a store.read_only setter method[/-] [+]Add store.with_mode() opening method[/+] on Jun 17, 2025
  12. changed the title [-]Add store.with_mode() opening method[/-] [+]Add store.with_mode() constructor method[/+] on Jun 17, 2025
  13. changed the title [-]Add store.with_mode() constructor method[/-] [+]Add store.with_read_only() copy method[/+] on Jun 17, 2025
  14. TomNicholas commented on Jun 20, 2025

    @TomNicholas
    Member

    xarray's upstream tests locally which showed many failures related to the new mode handling. I'm not sure yet if this is related to the issues in my virtual_tiff tests, but wanted to share that the change as-is has a high disruptive potential.

    This is definitely disrupting me - I'm trying to develop using a PR branched off xarray main, and this PR to zarr, but I see the same error @maxrjones did:

    ds = xr.open_zarr(
        zarr.storage.MemoryStore(), zarr_format=3, consolidated=False, chunks=None,
    )
    ValueError: Store is not read-only but mode is 'r'
    

    This also causes at least one failure in the xarray upstream test suite in CI.

    We obviously need to fix this before anyone releases, but even before then I there a way I can work around this to continue local development? e.g. is it fixed in zarr main yet?

    Note that weirdly using the custom LatencyStore I defined for my xarray test doesn't produce this problem, for reasons I don't understand.

  15. d-v-b commented on Jun 20, 2025

    @d-v-b
    Contributor

    your latency store has immunity because read-only is hard-coded to True :)

  16. TomNicholas commented on Jun 20, 2025

    @TomNicholas
    Member

    I should have realised that haha. Cool thanks, that helps me work around this in a minimal way until there is a fix.

  17. d-v-b commented on Jun 26, 2025

    @d-v-b
    Contributor

    @maxrjones is this resolved now that #3138 is merged?

  18. added a commit that references this issue on Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features or improvements

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions