From 616785e6ed4f8f7921a11cf2b0b624550f84b296 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Fri, 13 Dec 2024 18:08:16 -0800 Subject: [PATCH] zarr roundtripping strings to/from json --- src/numpydantic/interface/zarr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/numpydantic/interface/zarr.py b/src/numpydantic/interface/zarr.py index 2e3d993..2a1e9c3 100644 --- a/src/numpydantic/interface/zarr.py +++ b/src/numpydantic/interface/zarr.py @@ -74,7 +74,8 @@ class ZarrJsonDict(JsonDict): if self.file: array = ZarrArrayPath(file=self.file, path=self.path) else: - array = zarr.array(self.value, dtype=self.dtype) + dtype = np.str_ if self.dtype == "str" else self.dtype + array = zarr.array(self.value, dtype=dtype) return array