Reading Fortran binary files

drife daranrife at yahoo.com
Mon Jan 10 14:35:33 EST 2005


Hello,

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. Further, the
first record is a header containing the dimensions of
the data that follows, as well as the scaling factor
of the data (log base 10). The second record contains
the hour, followed by the 3D array of data, which is
dimensioned by nx,ny,nz.

I also need to convert all the 2 byte Int values to
'regular' Int.

I realize that similar questions have previously been
posted to the group, but the most recent inquiries date
back to 2000 and 2001. I thought there may be newer and
easier ways to do this.


Thanks in advance for your help.


Daran Rife

daranrifeNOS at PAMyahoo.com




More information about the Python-list mailing list