-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "pydantic-zarr @ git+https://github.com/zarr-developers/pydantic-zarr.git",
# ]
# ///
from pydantic_zarr.v3 import ArraySpec
import zarr
import numpy as np
z = zarr.create_array(store={}, shape=(10,), dtype='U10')
ArraySpec.from_zarr(z)
pydantic_core._pydantic_core.ValidationError: 6 validation errors for ArraySpec
fill_value.bool
Input should be a valid boolean, unable to interpret input [type=bool_parsing, input_value=np.str_(''), input_type=str_]
For further information visit https://errors.pydantic.dev/2.11/v/bool_parsing
fill_value.int
Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value=np.str_(''), input_type=str_]
For further information visit https://errors.pydantic.dev/2.11/v/int_parsing
fill_value.literal['Infinity','-Infinity','NaN']
Input should be 'Infinity', '-Infinity' or 'NaN' [type=literal_error, input_value=np.str_(''), input_type=str_]
For further information visit https://errors.pydantic.dev/2.11/v/literal_error
fill_value.float
Input should be a valid number, unable to parse string as a number [type=float_parsing, input_value=np.str_(''), input_type=str_]
For further information visit https://errors.pydantic.dev/2.11/v/float_parsing
fill_value.tuple[union[literal['Infinity','-Infinity','NaN'],float], union[literal['Infinity','-Infinity','NaN'],float]]
Input should be a valid tuple [type=tuple_type, input_value=np.str_(''), input_type=str_]
For further information visit https://errors.pydantic.dev/2.11/v/tuple_type
fill_value.`tuple[int, ...]`
Input should be a valid tuple [type=tuple_type, input_value=np.str_(''), input_type=str_]
For further information visit https://errors.pydantic.dev/2.11/v/tuple_type
The problem is this line:
pydantic-zarr/src/pydantic_zarr/v3.py
Line 369 in 5536922
fill_value=array.fill_value, |
Instead of taking array.fill_value
, we need to take the JSON-serializable form, which we can get from meta_json["fill_value"]
.
Metadata
Metadata
Assignees
Labels
No labels