cherab.imas.ggd.GGDGrid¶

class cherab.imas.ggd.GGDGrid(name: str = '', dimension: int = 1, coordinate_system: 'cylindrical' | 'cartesian' = 'cartesian')Source¶

Bases: object

Base class for general grids (GGD).

Parameters:
name: str = ''¶

Name of the grid.

dimension: int = 1¶

Grid dimensions, by default 1.

coordinate_system: 'cylindrical' | 'cartesian' = 'cartesian'¶

Coordinate system, by default "cartesian".

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[, fill_vector])

Return a VectorFunction interpolator instance for the vector data defined on this grid.

Attributes

cell_area

Cell areas as (num_cell,) array.

cell_centre

Coordinate of cell centres as (num_cell, dimension) array.

cell_volume

Cell volume as (num_cell,) array.

coordinate_system

Coordinate system.

dimension

Grid dimension.

mesh_extent

Extent of the mesh.

name

Grid name.

num_cell

Number of grid cells.

property name : strSource¶

Grid name.

property dimension : intSource¶

Grid dimension.

property num_cell : intSource¶

Number of grid cells.

property coordinate_system : strSource¶

Coordinate system.

property cell_centre : ndarray[tuple[Any, ...], dtype[float64]] | NoneSource¶

Coordinate of cell centres as (num_cell, dimension) array.

property cell_area : ndarray[tuple[Any, ...], dtype[float64]] | NoneSource¶

Cell areas as (num_cell,) array.

property cell_volume : ndarray[tuple[Any, ...], dtype[float64]] | NoneSource¶

Cell volume as (num_cell,) array.

property mesh_extent : dict[str, float] | NoneSource¶

Extent of the mesh.

A dictionary with xmin, xmax, ymin and ymax, … keys.

subset(indices: ArrayLike, name: str | None = None) GGDGridSource¶

Create a subset grid from this instance.

Parameters:
indices: ArrayLike¶

Indices of the cells of the original grid in the subset.

name: str | None = None¶

Name of the grid subset. Default is instance.name + " subset".

Returns:

Subset grid instance.

Return type:

GGDGrid

interpolator(grid_data: ArrayLike, fill_value: float = 0.0) 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: ArrayLike¶

Array containing data in the grid cells.

fill_value: float = 0.0¶

A value returned outside the grid, by default is 0.0.

Returns:

Interpolator instance.

Return type:

Function2D | Function3D

vector_interpolator(grid_vectors: ArrayLike, fill_vector: Vector3D = Vector3D(0.0, 0.0, 0.0)) 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: ArrayLike¶

(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).

Returns:

Interpolator instance.

Return type:

VectorFunction2D | VectorFunction3D

plot_mesh(data: ArrayLike | None = None, ax: Axes | None = None)Source¶

Plot the grid geometry to a matplotlib figure.

Parameters:
data: ArrayLike | None = None¶

Data array defined on the grid.

ax: Axes | None = None¶

Matplotlib axes to plot on. If None, a new figure and axes are created.