[Numpy-discussion] Another question on reading from binary FORTRAN file

Sturla Molden sturla@molden...
Tue Mar 10 06:27:44 CDT 2009


On 3/9/2009 9:45 PM, Mark Bakker wrote:

> How do I read these into Python?

One option is to read the file in Fortran (using the same compiler), and 
call Fortran from python using f2py. If you can write the file in 
Fortran, you can read the file in Fortran.

Another option to find out how the binary data is stored by Fortran 
(experimenting, hex editor, etc) and read them using numpy.fromfile. You 
can also use or numpy.memmap with a recarray.

Sturla Molden





More information about the Numpy-discussion mailing list