SciPy

scipy.io.FortranFile.read_record

FortranFile.read_record(dtype=None)[source]

Reads a record of a given type from the file.

Parameters :

dtype : data-type

Data type specifying the size and endiness of the data.

Returns :

data : ndarray

A one-dimensional array object.

See also

read_reals, read_ints

Notes

If the record contains a multi-dimensional array, calling reshape or resize will restructure the array to the correct size. Since Fortran multidimensional arrays are stored in column-major format, this may have some non-intuitive consequences. If the variable was declared as ‘INTEGER var(5,4)’, for example, var could be read with ‘read_record(dtype=np.integer).reshape( (4,5) )’ since Python uses row-major ordering of indices.

One can transpose to obtain the indices in the same order as in Fortran.