Skip to content

Read only array default upon opening #809

Open
@camFoltz

Description

@camFoltz

For bug reports, please follow the template below. For enhancement proposals, feel free
to use whatever template makes sense (major new features should be discussed in the
Zarr specifications repository https://github.com/zarr-developers/zarr-specs).

Minimal, reproducible code sample, a copy-pastable example if possible

src = 'path/to/dir'
z = zarr.open(src)
z.create('array',shape=(1, 1, 1, 1, 2048, 2048),
        chunks=(1, 1, 1, 1, 2048, 2048),
        compressor=Blosc('zstd', clevel=3, shuffle=Blosc.BITSHUFFLE),
        read_only=True)
z['array'][0,4] = 1

## Reload the array after restarting kernel
z_array = zarr.open(src)['array'] ## no longer read_only

Problem description

I am trying to create a zarr store containing an array that is by default read_only. We are moving our raw microscopy data to zarr format and we do not want the user to be able to easily edit the zarr arrays. The default zarr.open(mode='a') overrides any sort of read_only setting put onto the array during creation. This is troublesome because some of our users will not remember to specify mode='r' when browsing the raw data.

Is there a way to have the zarr store/array be read_only by default upon opening?

Version and installation information

Please provide the following:

  • Value of zarr.__version__ = 2.8.3
  • Value of numcodecs.__version__ = 0.7.3
  • python 3.7
  • Mac
  • pip install zarr

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