Skip to main content

Module fortran

Module fortran 

Source
Expand description

Fortran sequential unformatted files (SciPy’s io.FortranFile).

Each record written by a Fortran WRITE statement to an unformatted sequential file is framed by its length in bytes, as a 4-byte (gfortran’s default, SciPy’s header_dtype uint32) or 8-byte integer, before and after the data. The data are raw machine values, here little-endian.

See the book entry Scientific data files.

Functions§

fortran_records_decode
Splits a Fortran unformatted sequential file into its records (SciPy’s FortranFile.read_record), with marker_bytes (4 or 8) per length marker. Each record’s leading and trailing markers must agree.
fortran_records_encode
Frames records for a Fortran unformatted sequential file (SciPy’s FortranFile.write_record).
read_fortran_file
Reads the records of a Fortran unformatted sequential file.
record_from_f32
f32 values as a record’s bytes.
record_from_f64
f64 values as a record’s bytes.
record_from_i32
i32 values as a record’s bytes.
record_to_f32
A record’s bytes as little-endian f32 values.
record_to_f64
A record’s bytes as little-endian f64 values (read_reals(dtype=float)).
record_to_i32
A record’s bytes as little-endian i32 values (read_ints()).
write_fortran_file
Writes records as a Fortran unformatted sequential file.