pencil.read.varfile =================== .. py:module:: pencil.read.varfile .. autoapi-nested-parse:: Contains the read class for the VAR file reading, some simulation attributes and the data cube. Classes ------- .. autoapisummary:: pencil.read.varfile.DataCube Functions --------- .. autoapisummary:: pencil.read.varfile.var Module Contents --------------- .. py:class:: DataCube Bases: :py:obj:`object` DataCube -- holds Pencil Code VAR file data. Fill members with default values. .. py:attribute:: t :value: 0.0 .. py:attribute:: dx :value: 1.0 .. py:attribute:: dy :value: 1.0 .. py:attribute:: dz :value: 1.0 .. py:attribute:: x :value: None .. py:attribute:: y :value: None .. py:attribute:: z :value: None .. py:attribute:: f :value: None .. py:attribute:: l1 :value: None .. py:attribute:: l2 :value: None .. py:attribute:: m1 :value: None .. py:attribute:: m2 :value: None .. py:attribute:: n1 :value: None .. py:attribute:: n2 :value: None .. py:attribute:: magic :value: None .. py:method:: keys() .. py:method:: read(var_file='', datadir='data', proc=-1, ivar=-1, quiet=True, trimall=False, magic=None, sim=None, precision='d', lpersist=False, dtype=np.float64, flist=None, timing=True, fbloc=True, lvec=True, lonlyvec=False, range_x=None, range_y=None, range_z=None, irange_x=None, irange_y=None, irange_z=None, var_list=None, unshear=False) read(var_file='', datadir='data', proc=-1, ivar=-1, quiet=True, trimall=False, magic=None, sim=None, precision='d', lpersist=False, dtype=np.float64, flist=None, timing=True, fbloc=True, lvec=True, lonlyvec=False, range_x=None, range_y=None, range_z=None, irange_x=None, irange_y=None, irange_z=None, unshear=False) Read VAR 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 var.dat) consists of the followinig Fortran records: 1. data(mx, my, mz, nvar) 2. t(1), x(mx), y(my), z(mz), dx(1), dy(1), dz(1), deltay(1) Here nvar denotes the number of slots, i.e. 1 for one scalar field, 3 for one vector field, 8 for var.dat in the case of MHD with entropy. but, deltay(1) is only there if lshear is on! need to know parameters. :param var_file: Name of the VAR file. If not specified, use var.dat (which is the latest snapshot of the fields) :type var_file: 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 ivar: Index of the VAR file, if var_file is not specified. :type ivar: int :param quiet: Flag for switching off output. :type quiet: bool :param trimall: Trim the data cube to exclude ghost zones. :type trimall: bool :param magic: If present list of derived values to be computed from the data, e.g. B = curl(A). :type magic: list of strings :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 flist: If present list of exclusive basic farrays to include :type flist: list :param timing: Report the time taken to create the obbject :type timing: bool :param fbloc: If memory is restricted omit duplicate farray copy :type fbloc: bool :param lvec: Combine components to form a vector :type lvec: bool :param lonlyvec: If memory is restricted omit components and provide only the vector :type lonlyvec: bool :param lpersist: Read the persistent variables if they exist :type lpersist: bool :param range_[xyz]: coordinate range selection for subdomain (closed interval). If trimall=F, ghost zones will be included on either side of the interval. :type range_[xyz]: 2-tuple of real :param irange_[xyz]: index range selection for subdomain (closed interval). Note that this index is in the full array (including ghost zones). If trimall=F, ghost zones will be included on either side of the interval. :type irange_[xyz]: either 2-tuple of integer or slice :param var_list: List of variables to read (must be a subset of the names in data/index.pro). If not provided, all available variables will be read. Note that if only a subset of variables is read, the indices in the f-array of the DataCube object will not match the indices in data/index.pro. :type var_list: list of string :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: >>> var = pc.read.var() >>> print(var.uu.shape) Read the VAR2 file, compute the magnetic field B = curl(A), the vorticity omega = curl(u) and remove the ghost zones: >>> var = pc.read.var(var_file='VAR2', magic=['bb', 'vort'], trimall=True) >>> print(var.bb.shape) .. py:method:: magic_attributes(param, dtype=np.float64) Compute some additional 'magic' quantities. .. py:function:: var(*args, **kwargs) Wrapper for :py:meth:`DataCube.read`