Skip to content

Commit d8d1bdc

Browse files
author
will
committed
add support for arbitrary kwargs
1 parent e165896 commit d8d1bdc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

volara/datasets.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class Dataset(StrictBaseModel, ABC):
3434
units: list[str] | None = None
3535
writable: bool = True
3636

37+
zarr_kwargs: dict = Field(default_factory=dict)
38+
3739
@property
3840
def name(self) -> str:
3941
"""
@@ -100,6 +102,7 @@ def prepare(
100102
chunk_shape=chunk_shape,
101103
dtype=dtype,
102104
mode="a",
105+
**self.zarr_kwargs,
103106
)
104107
array._source_data.attrs.update(self.attrs)
105108

@@ -108,7 +111,7 @@ def array(self, mode: str = "r") -> Array:
108111
raise ValueError(
109112
f"Dataset {self.store} is not writable, cannot open in mode other than 'r'."
110113
)
111-
return open_ds(self.store, mode=mode)
114+
return open_ds(self.store, mode=mode, **self.zarr_kwargs)
112115

113116
@property
114117
@abstractmethod
@@ -133,7 +136,7 @@ class Raw(Dataset):
133136
@property
134137
def bounds(self) -> list[tuple[float, float]] | None:
135138
if self.ome_norm is not None:
136-
array = open_ds(self.store, mode="r")
139+
array = open_ds(self.store, mode="r", **self.zarr_kwargs)
137140
metadata_group = zarr.open(self.ome_norm)
138141
channels_meta = metadata_group.attrs["omero"]["channels"]
139142
bounds = [
@@ -190,6 +193,7 @@ def stack(data, other_data):
190193
self.store,
191194
mode=mode,
192195
**{k: v for k, v in metadata.items() if v is not None}, # type: ignore[invalid-argument-type]
196+
**self.zarr_kwargs,
193197
)
194198

195199
if self.ome_norm:

0 commit comments

Comments
 (0)