FieldQuantity#

class FieldQuantity#

Bases: object

A functor representing a physical field quantity.

__init__(impl)#
property name: str#

Return instance’s name.

property unit: str#

Return the unit of the quantity.

Returns:

unit – The unit of the quantity, the default value is an empty string.

Return type:

str

property ncomp: int#

Return the number of components of the quantity.

In most cases this would be either 1 (scalar field) or 3 (vector fields).

Returns:

ncomp – The number of components of the quantity.

Return type:

int

property grid: Grid#

Return grid on which the quantity will be evaluated.

Returns:

grid – The grid on which the quantity will be evaluated.

Return type:

Grid

property shape#

Return the shape of the output numpy array of this quantity.

Returns:

shape – The shape of the output numpy array of this quantity.

Return type:

tuple of ints

eval()#

Evaluate the quantity.

average()#

Evaluate the quantity and return the average of each component.

Return type:

float

get_rgb()#

Evaluate the vector field quantity and return its rgb representation as a numpy ndarray of the same shape (ncomp, nz, ny, nx).

property meshgrid#

Return a numpy meshgrid with the x, y, and z coordinate of each cell.