pyrokinetics.equilibrium.transp.EquilibriumReaderTRANSP#

class pyrokinetics.equilibrium.transp.EquilibriumReaderTRANSP[source]#

Bases: FileReader

Class that can read TRANSP equilibrium files. Rather than creating instances of this class directly, users are recommended to use the function read_equilibrium.

See also

Equilibrium

Class representing a global tokamak equilibrium.

read_equilibrium

Read an equilibrium file, return an Equilibrium.

__init__()#

Methods

__init__()

read_from_file(filename[, time, time_index, ...])

Read in TRANSP netCDF and creates Equilibrium object.

verify_file_type(filename)

Quickly verify that we're looking at a TRANSP file without processing

Attributes

file_type: ClassVar[str] = 'TRANSP'#
read_from_file(filename, time=None, time_index=None, nR=None, nZ=None, clockwise_phi=False, cocos=None, neighbors=16)[source]#

Read in TRANSP netCDF and creates Equilibrium object.

TRANSP makes use of radial grids, and these are interpolated onto a Cartesian RZ grid. Additional keyword-only arguments may be provided to control the resolution of the Cartesian grid, and to choose the time at which the equilibrium is taken.

Parameters:
  • filename (PathLike) – Path to the TRANSP netCDF file.

  • time (Optional[float]) – The time, in seconds, at which equilibrium data should be taken. Data will be drawn from the time closest to the provided value. Users should only provide one of time or time_index. If neither is provided, data is drawn at the last time stamp.

  • time_index (Optional[int]) – As an alternative to providing the time directly, users may provide the index of the desired time stamp.

  • nR (Optional[int]) – The number of grid points in the major radius direction. By default, this is set to the number of radial grid points in the TRANSP file.

  • nZ (Optional[int]) – The number of grid points in the vertical direction. By default, this is set to the number of radial grid points in the TRANSP file.

  • clockwise_phi (bool, default False) – Determines whether the \(\phi\) grid increases clockwise or anti-clockwise when viewed from above. Used to determine COCOS convention of the inputs.

  • cocos (Optional[int]) – If set, asserts that the GEQDSK file follows that COCOS convention, and neither clockwise_phi nor the file contents will be used to identify the actual convention in use. The resulting Equilibrium is always converted to COCOS 11.

  • neighbors (Optional[int]) – Sets number of nearest neighbours to use when performing the interpolation to flux surfaces to R,Z. By default, this is 16

Raises:
Return type:

Equilibrium

verify_file_type(filename)[source]#

Quickly verify that we’re looking at a TRANSP file without processing

Return type:

None

Parameters:

filename (PathLike | str)