pencil.read.pvarfile ==================== .. py:module:: pencil.read.pvarfile Classes ------- .. autoapisummary:: pencil.read.pvarfile.ParticleData Functions --------- .. autoapisummary:: pencil.read.pvarfile.pvar Module Contents --------------- .. py:function:: pvar(*args, **kwargs) pvar(pvarfile='', datadir='data', proc=-1, ipvar=-1, quiet=True, ID=False, pflist=None, sim=None, precision='f', dtype=np.float64) Read PVAR files from Pencil Code. If proc < 0, then load all data and assemble, otherwise load VAR file from specified processor. The file format written by output() (and used, e.g. in pvar.dat) consists of the followinig Fortran records: 1. [npar] 2. indices(npar) 3. pdata(npvar, npar) Here npvar denotes the number of slots, i.e. 1 for one scalar field, 3 for one vector field, 6 for pvar.dat in the case of npar particles with 3 coordinates and 3 velocity components. :param pvarfile: Name of the VAR file. If not specified, use var.dat (which is the latest snapshot of the fields) :type pvarfile: string :param datadir: Directory where the data is stored. :type datadir: string :param proc: Processor to be read. If -1 read all and assemble to one array. :type proc: int :param ipvar: Index of the VAR file, if var_file is not specified. :type ipvar: int :param quiet: Flag for switching off output. :type quiet: bool :param ID: Flag for including the particle IDs in the object. :type ID: bool :param pflist: If present list of exclusive basic pfarrays to include :type pflist: bool :param sim: Contains information about the local simulation. :type sim: pencil code simulation object :param precision: Float 'f', double 'd' or half 'half'. :type precision: string :param lpersist: Read the persistent variables if they exist :type lpersist: bool :returns: Instance of the pencil.read.var.DataCube class. All of the computed fields are imported as class members. :rtype: DataCube .. rubric:: Examples Read the latest var.dat file and print the shape of the uu array: >>> pvar = pc.read.pvar() >>> print(pvar.px.shape) Read the PVAR2 file, and include only the x coordinates and velocity e.g., for instance to reduce memory load for large arrays. >>> pvar = pc.read.pvar(pvar_file='PVAR2', pflist=['px','pvx']) >>> print(pvar.pvx.shape) .. py:class:: ParticleData Bases: :py:obj:`object` ParticleData -- holds Pencil Code PVAR file data. Fill members with default values. .. py:method:: keys() .. py:method:: read(pvarfile='', datadir='data', proc=-1, proclist=None, ipvar=-1, quiet=True, pflist=None, ID=False, sim=None, precision='f', dtype=np.float64) pvar(pvar_file='', datadir='data', proc=-1, ipvar=-1, quiet=True, pflist=None, sim=None, precision='f', dtype=np.float64) Read PVAR files from Pencil Code. If proc < 0, then load all data and assemble, otherwise load VAR file from specified processor. The file format written by output() (and used, e.g. in pvar.dat) consists of the followinig Fortran records: 1. [npar] 2. indices(npar) 3. pdata(npvar, npar) Here npvar denotes the number of slots, i.e. 1 for one scalar field, 3 for one vector field, 6 for pvar.dat in the case of npar particles with 3 coordinates and 3 velocity components. :param pvarfile: Name of the VAR file. If not specified, use var.dat (which is the latest snapshot of the fields) :type pvarfile: string :param datadir: Directory where the data is stored. :type datadir: string :param proc: Processor to be read. If -1 read all and assemble to one array. :type proc: int :param ipvar: Index of the VAR file, if var_file is not specified. :type ipvar: int :param quiet: Flag for switching off output. :type quiet: bool :param ID: Flag for including the particle IDs in the object. :type ID: bool :param pflist: If present list of exclusive basic pfarrays to include :type pflist: bool :param sim: Contains information about the local simulation. :type sim: pencil code simulation object :param precision: Float 'f', double 'd' or half 'half'. :type precision: string :param lpersist: Read the persistent variables if they exist :type lpersist: bool :returns: Instance of the pencil.read.var.DataCube class. All of the computed fields are imported as class members. :rtype: DataCube .. rubric:: Examples Read the latest var.dat file and print the shape of the uu array: >>> pvar = pc.read.pvar() >>> print(pvar.px.shape) Read the PVAR2 file, and include only the x coordinates and velocity e.g., for instance to reduce memory load for large arrays. >>> pvar = pc.read.pvar(pvar_file='PVAR2', pflist=['px','pvx']) >>> print(pvar.pvx.shape)