Reading Fortran binary files

Michael Fuhr mfuhr at fuhr.org
Mon Jan 10 16:21:06 EST 2005


"drife" <daranrife at yahoo.com> writes:

> I need to read a Fortran binary data file in Python.
> The Fortran data file is organized thusly:
>
> nx,ny,nz,ilog_scale   # Record 1 (Header)
> ihour,data3D_array    # Record 2
>
> Where every value above is a 2 byte Int.

Have you looked at the struct module?

http://www.python.org/doc/2.4/lib/module-struct.html

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



More information about the Python-list mailing list