pencil.read.fortran_file ======================== .. py:module:: pencil.read.fortran_file Classes ------- .. autoapisummary:: pencil.read.fortran_file.FortranFileExt Module Contents --------------- .. py:class:: FortranFileExt Bases: :py:obj:`scipy.io.FortranFile` .. py:method:: read_record(*dtypes, **kwargs) Reads a record of a given type from the file. :param \*dtypes: Data type(s) specifying the size and endianness of the data. :type \*dtypes: dtypes, optional :returns: **data** -- A 1-D array object. :rtype: ndarray :raises FortranEOFError: To signal that no further records are available :raises FortranFormattingError: To signal that the end of the file was encountered part-way through a record .. rubric:: Notes If the record contains a multidimensional array, you can specify the size in the dtype. For example:: INTEGER var(5,4) can be read with:: read_record('(4,5)i4').T Note that this function does **not** assume the file data is in Fortran column major order, so you need to (i) swap the order of dimensions when reading and (ii) transpose the resulting array. Alternatively, you can read the data as a 1-D array and handle the ordering yourself. For example:: read_record('i4').reshape(5, 4, order='F') For records that contain several variables or mixed types (as opposed to single scalar or array types), give them as separate arguments:: double precision :: a integer :: b write(1) a, b record = f.read_record('