pencil_ccyang.read

Attributes

hsize

Classes

Dict

A class that emulates NamedTuple but is picklable.

Functions

allprocs_avg2d([datadir, direction])

Returns the time series of the 2D averages read from allprocs/.

allprocs_grid([datadir, dim])

Returns the grid under allprocs/.

allprocs_pvar([datadir, pdim, pvarfile])

Returns the particles in one snapshot under allprocs/.

allprocs_var([datadir, dim, par, varfile])

Returns one snapshot under allprocs/.

avg1d([datadir, plane, tsize, unformatted, verbose])

Returns the time series of 1D averages.

avg2d([datadir, direction, par])

Returns the time series of the 2D averages.

dimensions([datadir])

Returns the dimensions of the Pencil Code data from datadir.

grid([datadir, interface, par, trim])

Returns the coordinates and their derivatives of the grid.

parameters([datadir, par2, warning])

Returns runtime parameters.

pardim([datadir])

Returns the numbers associated with particles.

proc_avg2d([datadir, direction, proc])

Returns the time series of one chunk of the 2D averages from one

proc_dim([datadir, proc])

Returns the dimensions of the data from one process.

proc_grid([datadir, dim, proc])

Returns the grid controlled by one process.

proc_pvar([datadir, pdim, proc, pvarfile])

Returns the particles in one snapshot held by one process.

proc_var([datadir, dim, par, proc, varfile])

Returns the patch of one snapshot saved by one process.

pvar([allprocs, datadir, ivar, pvarfile, verbose])

Returns particles in one snapshot.

slices(field[, datadir, return_pos])

Reads the video slices.

time_series([datadir, unique])

Returns a NumPy recarray from the time series.

var([allprocs, compact, datadir, ivar, par, trim, ...])

Returns one snapshot.

varlist([datadir, listname])

Reads and returns the names and times of the snapshots.

varname([datadir, filename])

Returns the names of variables.

Module Contents

pencil_ccyang.read.hsize = 4
class pencil_ccyang.read.Dict(**kw)

A class that emulates NamedTuple but is picklable.

Instance Variables

All the keyword arguments when constructed.

Initiate the object with all the keyword arguments.

**kw

Keyword values to be recorded in the object.

keys()

Returns all the keywords recorded in the object.

pencil_ccyang.read.allprocs_avg2d(datadir='./data', direction='z')

Returns the time series of the 2D averages read from allprocs/.

Keyword Arguments:
  • datadir – Name of the data directory.

  • direction – Direction of the average: ‘x’, ‘y’, or ‘z’.

pencil_ccyang.read.allprocs_grid(datadir='./data', dim=None)

Returns the grid under allprocs/.

Keyword Arguments:
  • datadir – Name of the data directory.

  • dim – Dimensions supplied by dimensions(). If None, they will be read in at runtime.

pencil_ccyang.read.allprocs_pvar(datadir='./data', pdim=None, pvarfile='pvar.dat')

Returns the particles in one snapshot under allprocs/.

Keyword Arguments:
  • datadir – Name of the data directory.

  • pdim – Particle dimensions returned by pardim(). If None, they will be read in at runtime.

  • pvarfile – Name of the snapshot file.

pencil_ccyang.read.allprocs_var(datadir='./data', dim=None, par=None, varfile='var.dat')

Returns one snapshot under allprocs/.

Keyword Arguments:
  • datadir – Name of the data directory.

  • dim – Dimensions supplied by dimensions(). If None, the dimensions will be read in at runtime.

  • par – Parameters supplied by parameters(). If None, the parameters will be read in at runtime.

  • varfile – Name of the snapshot file.

pencil_ccyang.read.avg1d(datadir='./data', plane='xy', tsize=None, unformatted=True, verbose=True)

Returns the time series of 1D averages.

Keyword Arguments:
  • datadir – Name of the data directory.

  • plane – Plane of average: ‘xy’, ‘xz’, or ‘yz’.

  • tsize – If not None, the time series is interpolated onto regular time intervals with tsize elements and endpoints included.

  • unformatted – Set True if the data file is written in binary format.

  • verbose – Whether or not to print information.

pencil_ccyang.read.avg2d(datadir='./data', direction='z', par=None)

Returns the time series of the 2D averages.

Keyword Arguments:
  • datadir – Name of the data directory.

  • direction – Direction of average: ‘x’, ‘y’, or ‘z’.

  • par – Parameters supplied by parameters(). If None, the parameters will be read in at runtime.

pencil_ccyang.read.dimensions(datadir='./data')

Returns the dimensions of the Pencil Code data from datadir.

Keyword Arguments:

datadir – Name of the data directory.

pencil_ccyang.read.grid(datadir='./data', interface=False, par=None, trim=True)

Returns the coordinates and their derivatives of the grid.

Keyword Arguments:
  • datadir – Name of the data directory.

  • interface – If True, the coordinates of the interfaces between cells are returned; otherwise, those of the cell centers are returned.

  • par – Parameters supplied by parameters() needed when the keyword interface is True. If None, parameters() will be called.

  • trim – Whether or not to trim the ghost cells. If the keyword interface is True, ghost cells are automatically trimmed and this keyword has no effect.

pencil_ccyang.read.parameters(datadir='./data', par2=False, warning=True)

Returns runtime parameters.

Keyword Arguments:
  • datadir – Name of the data directory.

  • par2 – Read param2.nml if True; read param.nml otherwise.

  • warning – Give warning messages or not.

pencil_ccyang.read.pardim(datadir='./data')

Returns the numbers associated with particles.

Keyword Arguments:

datadir – Name of the data directory

pencil_ccyang.read.proc_avg2d(datadir='./data', direction='z', proc=0)

Returns the time series of one chunk of the 2D averages from one process.

Keyword Arguments:
  • datadir – Name of the data directory.

  • direction – Direction of the average: ‘x’, ‘y’, or ‘z’.

  • proc – Process ID.

pencil_ccyang.read.proc_dim(datadir='./data', proc=0)

Returns the dimensions of the data from one process.

Keyword Arguments:
  • datadir – Name of the data directory

  • proc – Process ID

pencil_ccyang.read.proc_grid(datadir='./data', dim=None, proc=0)

Returns the grid controlled by one process.

Keyword Arguments:
  • datadir – Name of the data directory.

  • dim – Dimensions supplied by proc_dim(). If None, proc_dim() will be called.

  • proc – Process ID.

pencil_ccyang.read.proc_pvar(datadir='./data', pdim=None, proc=0, pvarfile='pvar.dat')

Returns the particles in one snapshot held by one process.

Keyword Arguments:
  • datadir – Name of the data directory.

  • pdim – Particle dimensions returned by pardim(). If None, they will be read in at runtime.

  • proc – Process ID.

  • pvarfile – Name of the snapshot file.

pencil_ccyang.read.proc_var(datadir='./data', dim=None, par=None, proc=0, varfile='var.dat')

Returns the patch of one snapshot saved by one process.

Keyword Arguments:
  • datadir – Name of the data directory.

  • dim – Dimensions supplied by proc_dim(). If None, proc_dim() will be called.

  • par – Parameters supplied by parameters(). If None, parameters() will be called.

  • proc – Process ID.

  • varfile – Name of the snapshot file.

pencil_ccyang.read.pvar(allprocs=True, datadir='./data', ivar=None, pvarfile='pvar.dat', verbose=True)

Returns particles in one snapshot.

Keyword Arguments:
  • allprocs – If True, the snapshot is read under allprocs/.

  • datadir – Name of the data directory.

  • ivar – If not None, an integer specifying the snapshot number and the argument pvarfile takes no effect.

  • pvarfile – Name of the snapshot file.

  • verbose – Verbose output or not.

pencil_ccyang.read.slices(field, datadir='./data', return_pos=False)

Reads the video slices.

Returned Values:
  1. Array of time points.

  2. Slice planes of field at each time.

  3. (optional) Slice positions of each plane at each time.

Positional Argument:
field

Field name.

Keyword Argument:
datadir

Name of the data directory.

return_pos

Also return slice positions if True.

pencil_ccyang.read.time_series(datadir='./data', unique=False)

Returns a NumPy recarray from the time series.

Keyword Arguments:
  • datadir – Name of the data directory

  • unique – If True, discard duplicate entries.

pencil_ccyang.read.var(allprocs=True, compact=True, datadir='./data', ivar=None, par=None, trim=True, unshear=False, varfile='var.dat', verbose=True)

Returns one snapshot.

Keyword Arguments:
  • allprocs – If True, the snapshot is read under allprocs/.

  • compact – If True, dimensions of one are removed.

  • datadir – Name of the data directory.

  • ivar – If not None, an integer specifying the snapshot number and the argument varfile takes no effect.

  • par – Parameters supplied by parameters(). If None, parameters() will be called.

  • trim – Whether or not to trim the ghost cells.

  • unshear – Whether or not to make x periodic

  • varfile – Name of the snapshot file.

  • verbose – Verbose output or not.

pencil_ccyang.read.varlist(datadir='./data', listname='varN.list')

Reads and returns the names and times of the snapshots.

Keyword Arguments:
  • datadir – Name of the data directory.

  • listname – Name of the file containing the list of snapshots.

Returned Values
varfile

A list of file names.

time

A list of the corresponding times.

pencil_ccyang.read.varname(datadir='./data', filename='varname.dat')

Returns the names of variables.

Keyword Arguments:
  • datadir – Name of the data directory

  • filename – Name of the file containing variable names