Skip to content

Commit c5f087d

Browse files
srivarraclaude
andcommitted
fix: handle bool fill_value in TensorStore zarr2 create_array_v2
TensorStore's zarr2 driver requires fill_value to be a boolean for bool dtype arrays, not an integer 0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e7db433 commit c5f087d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/iohub/core/implementations/tensorstore.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,17 @@ def create_array_v2(
345345
) -> ts.TensorStore:
346346
shuffle_map = {"noshuffle": 0, "shuffle": 1, "bitshuffle": 2}
347347
comp = self.config.compressor
348+
# TensorStore zarr2 driver requires bool fill_value for bool dtype
349+
resolved_dtype = np.dtype(dtype)
350+
if resolved_dtype.kind == "b":
351+
fill_value = bool(fill_value)
348352
spec = {
349353
"driver": "zarr2",
350354
"kvstore": {"driver": "file", "path": str(Path(group.path) / name)},
351355
"metadata": {
352356
"shape": list(shape),
353357
"chunks": list(chunks),
354-
"dtype": np.dtype(dtype).str, # zarr2 uses NumPy dtype strings e.g. "<u2"
358+
"dtype": resolved_dtype.str, # zarr2 uses NumPy dtype strings e.g. "<u2"
355359
"compressor": {
356360
"id": "blosc",
357361
"cname": comp.cname,

0 commit comments

Comments
 (0)