Open
Description
I'm not 100% sure if this is a valid zarr v2 metadata, but it's erroring with pydantic-zarr
:
import tempfile
from pathlib import Path
import pydantic_zarr
import pydantic_zarr.v2
import zarr
zarray = """{
"chunks": [
2
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "|O",
"fill_value": 0,
"filters": [
{
"id": "vlen-utf8"
}
],
"order": "C",
"shape": [
2
],
"zarr_format": 2
}"""
test_dir = Path(tempfile.gettempdir())
with open(test_dir / ".zarray", "w") as f:
f.write(zarray)
arr = zarr.open(test_dir, mode="r")
pydantic_zarr.v2.ArraySpec.from_zarr(arr)
% python test.py
Traceback (most recent call last):
File "/Users/dstansby/software/ome-zarr/ome-zarr-models-py/test.py", line 37, in <module>
pydantic_zarr.v2.ArraySpec.from_zarr(arr)
File "/Users/dstansby/software/ome-zarr/ome-zarr-models-py/.venv/lib/python3.12/site-packages/pydantic_zarr/v2.py", line 317, in from_zarr
fill_value=array.dtype.type(array.fill_value).tolist(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'tolist'
Metadata
Metadata
Assignees
Labels
No labels