grids.core.GenericGrid.from_hdf5#
- classmethod GenericGrid.from_hdf5(filename: str, group_name: str | None = None, **kwargs)[source]#
Load a grid instance from an HDF5 file.
This method reconstructs a fully initialized grid object from a file written by
to_hdf5()
. It restores all structural metadata, coordinate arrays, unit definitions, and the associated coordinate system.- Parameters:
- Returns:
Reconstructed grid instance.
- Return type:
Notes
The structure of the input HDF5 file will look something like the following:
├── [attrs] │ ├── axes → list of str # Axis names (e.g. ["x", "y", "z"]) │ ├── chunking → bool # Whether chunking is enabled │ ├── chunk_size → list[int] # Size of each chunk (if enabled) │ ├── grid_shape → list[int] # Grid shape (excluding ghost zones) │ ├── bbox → (2, ndim) array # Physical bounding box │ ├── ghost_zones → (2, ndim) array # Ghost zones on each axis │ └── coordinate_system → str # Class name of the coordinate system │ │ ├── coordinates/ → group # Note: names vary with coordinate system. │ ├── x → 1D array # Coordinate values along 'x' axis │ ├── y → 1D array # Coordinate values along 'y' axis │ └── z → 1D array # Coordinate values along 'z' axis (if 3D) │ ├── units/ → group │ ├── length → str (e.g. "cm") # Unit string for 'length' │ ├── time → str (e.g. "s") # Unit string for 'time' │ ├── mass → str (e.g. "g") # Unit string for 'mass' │ ├── angle → str (e.g. "rad") # Unit string for 'angle' │ └── ... # Any other base dimensions │ └── coord_systm/ → group └── ... → Defined by coordinate system class (symbolic metric, Jacobians, etc.)
See also
to_hdf5
Method that produces the file structure described above.