Sometimes we want to split those out to separate fields like this:
class MyModel(BaseModel):
data: NDArray[Any, np.int64]
extra: NDArray[Any, np.float64]
So that's what this PR allows, using an additional field in the H5ArrayPath:
from numpydantic.interfaces.hdf5 import H5ArrayPath
my_model = MyModel(
data = H5ArrayPath(file='mydata.h5', path="/dataset", field="data"),
extra = H5ArrayPath(file='mydata.h5', path="/dataset", field="extra"),
)
# or just with tuples
my_model = MyModel(
data = ('mydata.h5', "/dataset", "data"),
extra = ('mydata.h5', "/dataset", "extra"),
)
HDF5 can have compound dtypes like:
Sometimes we want to split those out to separate fields like this:
So that's what this PR allows, using an additional field in the H5ArrayPath: