Skip to content

Commit

Permalink
mode property
Browse files Browse the repository at this point in the history
  • Loading branch information
mzouink committed Apr 16, 2024
1 parent 20b967d commit e3afa41
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dacapo/experiments/datasplits/datasets/arrays/zarr_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(self, array_config):
self.name = array_config.name
self.file_name = array_config.file_name
self.dataset = array_config.dataset
self.mode = array_config.mode
self._mode = array_config.mode
self._attributes = self.data.attrs
self._axes = array_config._axes
self.snap_to_grid = array_config.snap_to_grid
Expand Down Expand Up @@ -144,6 +144,14 @@ def __repr__(self):
"""
return f"ZarrArray({self.file_name}, {self.dataset})"

@property
def mode(self):
if not hasattr(self, "_mode"):
self._mode = "a"
if self._mode not in ["r", "w", "a"]:
raise ValueError(f"Mode {self._mode} not in ['r', 'w', 'a']")
return self._mode

@property
def attrs(self):
Expand Down Expand Up @@ -413,6 +421,7 @@ def create_from_array_identifier(
num_channels,
voxel_size,
dtype,
mode = "a",
write_size=None,
name=None,
overwrite=False,
Expand Down

0 comments on commit e3afa41

Please sign in to comment.