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_ggd structure.

The grid_ggd structure 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-aos

Warning

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:
grid_ggd: IDSStructureΒΆ

The grid_ggd structure.

with_subsets: bool = FalseΒΆ

Read grid subset data, by default is False.

num_toroidal: int | None = NoneΒΆ

Number of toroidal points, by default None.

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_ggd structure.

  • 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)