load_index_func#

cherab.lhd.emc3.load_index_func(zones: list[str], index_type: Literal['cell', 'physics', 'coarse'] = 'cell', load_tetra_mesh: bool = True, dataset: str = 'emc3/grid-360.nc', quiet: bool = False, **kwargs) tuple[Discrete3DMesh | dict[str, ndarray], dict[str, int]]Source#

Load index function of EMC3-EIRENE mesh.

Parameters:
zoneslist[str]

List of zone names. The order of the zones is important. All zone names must be unique.

index_type{“cell”, “physics”, “coarse”}, optional

Index type, by default "cell".

load_tetra_meshbool, optional

Whether to load a pre-created tetrahedral mesh, by default is True.

datasetstr, optional

Dataset name, by default "emc3/grid-360.nc".

quietbool, optional

Mute status messages, by default False.

**kwargs

Keyword arguments to pass to fetch_file.

Returns:
tuple[Discrete3DMesh | dict[str, ndarray], dict[str, int]]

If load_tetra_mesh==True, returns a index function and dictionary of voxel numbers for each zone. If load_tetra_mesh==False, returns a dictionary of index arrays and dictionary of voxel numbers for each zone.

Examples

>>> index_func, bins = load_index_func(["zone0", "zone11"], index_type="coarse")
>>> index_func
IntegerFunction3D()
>>> bins
{'zone0': 29700, 'zone11': 29700}

In case of load_tetra_mesh=False:

>>> index_arrays, bins = load_index_func(["zone0"], index_type="coarse", load_tetra_mesh=False)
>>> index_arrays
{'zone0': array([[[    0,     0,     0, ..., 26400, 26400, 26400],
                  [    0,     0,     0, ..., 26400, 26400, 26400],
                  [    0,     0,     0, ..., 26400, 26400, 26400],
                  [ 3299,  3299,  3299, ..., 29699, 29699, 29699]]], dtype=uint32)}