grids.core.UniformGrid.from_hdf5#
- classmethod UniformGrid.from_hdf5(filename: str, group_name: str | None = None, **kwargs)[source]#
Load a
UniformGrid
from an HDF5 file.This method reconstructs a grid previously saved using
to_hdf5()
. It restores the domain shape, bounding box, ghost zones, chunking structure, coordinate system, and unit metadata.- Parameters:
- Returns:
Fully reconstructed grid instance.
- Return type:
- Raises:
IOError – If the file or group does not exist, or if required metadata is missing.
Notes
The method expects a file structure produced by
to_hdf5()
, including the necessary attributes and subgroups. For example:├── [attrs] │ ├── axes → list of str │ ├── chunking → bool │ ├── chunk_size → list[int] │ ├── grid_shape → list[int] │ ├── bbox → (2, ndim) array │ ├── ghost_zones → (2, ndim) array │ ├── coordinate_system → str │ └── centered → bool │ ├── units/ → group of base unit strings └── coord_systm/ → symbolic data for coordinate system reconstruction
The coordinate arrays are not saved to disk, because they are deterministically defined from the bounding box and resolution.