cherab.imas.ids.common.ggd.load_gridΒΆ
-
cherab.imas.ids.common.ggd.load_grid(grid_ggd: IDSStructure, with_subsets: bool =
False, num_toroidal: int | None =None) UnstructGrid2D | tuple[UnstructGrid2D, dict[str, ndarray[tuple[Any, ...], dtype[int32]]], dict[str, int]] | UnstructGrid2DExtendedSourceΒΆ Load grid from the
grid_ggdstructure.The
grid_ggdstructure is expected to follow the IMAS GGD grid definition. Please see: https://imas-data-dictionary.readthedocs.io/en/latest/ggd_guide/doc.html#the-grid-ggd-aosWarning
This function currently supports only unstructured 2D grids and unstructured 2D grids extended in 3D (mainly used in JOREK). Loading of structured grids and unstructured 3D grids will be implemented in the future.
- Parameters:
- Returns:
grid (
UnstructGrid2D|UnstructGrid2DExtended) β Grid object that depends on the grid type (2D/2D-extended/3D).subsets (
dict[str, NDArray[int32]]) β Dictionary with grid subsets for each subset name containing the indices of the cells from that subset. Note that βCellsβ subset is included only if cell indices are specified.subset_id (
dict[str, int]) β Dictionary with grid subset indices.
- Raises:
RuntimeError β If the grid type is unsupported or if no spaces are found in the
grid_ggdstructure.NotImplementedError β If the grid type is not yet implemented.
Examples
from imas import DBEntry from cherab.imas.ids.common import get_ids_time_slice from cherab.imas.ids.common.ggd import load_grid with DBEntry("imas:hdf5?path=/work/imas/shared/imasdb/ITER/4/123356/1", "r") as entry: ids = get_ids_time_slice(entry, "edge_profiles", 0) grid, subsets, subset_id = load_grid(ids.grid_ggd[0], with_subsets=True)