[Numpy-discussion] example reading binary Fortran file

David Froger david.froger.info at gmail.com
Fri Jan 30 17:53:06 EST 2009


ok for f2py!

> Otherwise, you will have to figure out how your Fortran program writes the
>file. I.e. what padding, metainformation, etc. that are used. If you
>switch Fortran compiler, or even compiler version from the same vendor,
>you must start over again.

In my experience, I never had this kind of problem. I just have to convert
files between big/little endian with uswap (http://linux.die.net/man/1/uswap),
but I never see, in my experience, a Fortran program writting data
differently given the compilator.

>For my own work, I just makes sure NEVER to do any I/O in Fortran! It is
>asking for trouble. I leave the I/O to Python or C, where it belongs. That
>way I know what data are written and what data are read.

Unfortunately., binary files are mandatory in the contex I work. I use a
scientific code written in Fortran to compute fluid dynamics. Typically the
simulation is run on supercalculator and generate giga and giga of datum, so
we must use the binary format, which recquire less memory for the stockage.
Then, I like to post-trait the datum using Python and Gnuplot.py.

That's why I'm looking for a performantant, easy and 'standard'  way to read
binary Fortran files. (I think many people have the same need).

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090130/7dfaadd9/attachment.html>


More information about the NumPy-Discussion mailing list