pyrokinetics.gk_code.gk_output.GKOutputArgs#

class pyrokinetics.gk_code.gk_output.GKOutputArgs[source]#

Bases: object

Utility base dataclass used to pass quantities to GKOutput. Derived classes include Coords, Fields, Fluxes, etc. This class contains features such as automatic unit conversion and a dict-like interface to quantities.

Derived classes should define an InitVar[Tuple[str, ...]] called dims, which sets the dimensionality of each quantity, e.g. ("kx", "ky", "time"). This should be set in __post_init__, along with a call to _set_and_check_dims. This is to work around the pre-Python 3.10 dataclass issues regarding keyword arguments in base classes

__init__()#
Return type:

None

Methods

__init__()

items()

Dict-like items iteration

units(name, c)

Return the units for each quantity

values()

Dict-like values iteration

with_units(c)

Apply units to each quantity in turn and return a new Coords.

Attributes

coords

Tuple containing the names of each supplied field (those that aren't None).

names

Names of all quantities held by this dataclass

shape

Shape of quantities.

property coords: Tuple[str, ...]#

Tuple containing the names of each supplied field (those that aren’t None).

items()[source]#

Dict-like items iteration

Return type:

Generator[Tuple[str, Any], None, None]

property names: Tuple[str, ...]#

Names of all quantities held by this dataclass

property shape: Tuple[int, ...]#

Shape of quantities. Raises error if all are None. Should be overridden in Coords, where this function makes no sense.

abstract units(name, c)[source]#

Return the units for each quantity

Return type:

Unit

Parameters:
values()[source]#

Dict-like values iteration

Return type:

Generator[Any, None, None]

with_units(c)[source]#

Apply units to each quantity in turn and return a new Coords. If units are already applied, renormalises according to the convention supplied.

Parameters:

c (ConventionNormalisation)