AthenaDataSet#

class pyathena.AthenaDataSet(filename, id0_only=False, units=<pyathena.util.units.Units object>, dfi=None)[source]#

Class to read athena vtk file.

Parameters
  • filename (string) – Name of the file to open, including extension

  • id0_only (bool) – Flag to enforce to read vtk file in id0 directory only. Default value is False.

  • units (Units) – pyathena Units object (used for reading derived fields)

  • dfi (dict) – Dictionary containing derived fields info

get_cc_ijk(x1, x2, x3)[source]#

Compute closest cell-center integer indices in which a particle resides

Parameters
  • x1 (array of floats) – Particle position

  • x2 (array of floats) – Particle position

  • x3 (array of floats) – Particle position

get_cc_pos()[source]#

Compute cell center positions

Returns

xc – Unique cell-centered cooridnates

Return type

numpy array

get_field(field='density', le=None, re=None, as_xarray=True)[source]#

Read 3d fields data.

Parameters
  • field ((list of) string) – The name of the field(s) to be read.

  • le (sequence of floats) – Left edge. Default value is the domain left edge.

  • re (sequence of floats) – Right edge. Default value is the domain right edge.

  • as_xarray (bool) – If True, returns results as an xarray Dataset. If False, returns a dictionary containing numpy arrays. Default value is True.

Returns

dat – An xarray dataset containing fields.

Return type

xarray dataset

get_slice(axis, field='density', pos='c', method='nearest')[source]#

Read slice of fields.

Parameters
  • axis (str) – Axis to slice along. ‘x’ or ‘y’ or ‘z’

  • field ((list of) str) – The name of the field(s) to be read.

  • pos (float or str) – Slice through If ‘c’ or ‘center’, get a slice through the domain center. Default value is ‘c’.

  • method (str) –

Returns

slc – An xarray dataset containing slices.

Return type

xarray dataset

set_region(le=None, re=None)[source]#

Set region and find overlapping grids.