cherab.imas.ggd.GGDGrid¶
-
class cherab.imas.ggd.GGDGrid(name: str =
'', dimension: int =1, coordinate_system: 'cylindrical' | 'cartesian' ='cartesian')Source¶ Bases:
objectBase class for general grids (GGD).
- Parameters:
Methods
interpolator(grid_data[, fill_value, ...])Return an Function interpolator instance for the data defined on this grid.
plot_mesh([data, ax])Plot the grid geometry to a matplotlib figure.
subset(indices[, name])Create a subset grid from this instance.
vector_interpolator(grid_vectors[, ...])Return a VectorFunction interpolator instance for the vector data defined on this grid.
Attributes
Cell areas as
(num_cell,)array.Coordinate of cell centres as
(num_cell, dimension)array.Cell volume as
(num_cell,)array.Coordinate system.
Grid dimension.
Extent of the mesh.
Grid name.
Number of grid cells.
- property cell_centre : NDArray[float64]Source¶
Coordinate of cell centres as
(num_cell, dimension)array.
- property mesh_extent : dict[str, float]Source¶
Extent of the mesh.
A dictionary with xmin, xmax, ymin and ymax, … keys.
-
abstract subset(indices: Sequence[SupportsIndex] | NDArray[integer[Any]], name: str | None =
None) GGDGridSource¶ Create a subset grid from this instance.
-
abstract interpolator(grid_data: NDArray[float64], fill_value: float =
0.0, *, interpolator_cache: 'none' | 'memory' | 'disk' ='memory', interpolator_cache_dir: str | Path | None =None, interpolator_cache_namespace: str ='ggd') Function2D | Function3DSource¶ Return an Function interpolator instance for the data defined on this grid.
On the second and subsequent calls, the interpolator is created as an instance of the previously created interpolator.
- Parameters:
- grid_data: NDArray[float64]¶
Array containing data in the grid cells.
- fill_value: float =
0.0¶ A value returned outside the grid, by default is 0.0.
- interpolator_cache: 'none' | 'memory' | 'disk' =
'memory'¶ Cache mode for the interpolator, by default
"memory". The cache mode is described in theInterpolatorCacheModetype alias.- interpolator_cache_dir: str | Path | None =
None¶ Directory used when
interpolator_cache="disk", by default None (uses the system cache directory, e.g.,~/.cache/cherab/imas/interpolators).- interpolator_cache_namespace: str =
'ggd'¶ Namespace prefix to avoid cache-key collisions, by default
"ggd".
- Returns:
Function2D|Function3D– Interpolator instance.
-
abstract vector_interpolator(grid_vectors: NDArray[float64], fill_vector: Vector3D =
Vector3D(0.0, 0.0, 0.0), *, interpolator_cache: 'none' | 'memory' | 'disk' ='memory', interpolator_cache_dir: str | Path | None =None, interpolator_cache_namespace: str ='ggd') Function2D | Function3DSource¶ Return a VectorFunction interpolator instance for the vector data defined on this grid.
On the second and subsequent calls, the interpolator is created as an instance of the previously created interpolator.
- Parameters:
- grid_vectors: NDArray[float64]¶
(3, num_cell)Array containing 3D vectors in the grid cells.- fill_vector: Vector3D =
Vector3D(0.0, 0.0, 0.0)¶ 3D vector returned outside the grid, by default
Vector3D(0, 0, 0).- interpolator_cache: 'none' | 'memory' | 'disk' =
'memory'¶ Cache mode for the interpolator, by default
"memory". The cache mode is described in theInterpolatorCacheModetype alias.- interpolator_cache_dir: str | Path | None =
None¶ Directory used when
interpolator_cache="disk", by default None (uses the system cache directory, e.g.,~/.cache/cherab/imas/interpolators).- interpolator_cache_namespace: str =
'ggd'¶ Namespace prefix to avoid cache-key collisions, by default
"ggd".
- Returns:
VectorFunction2D|VectorFunction3D– Interpolator instance.