On Sat, Feb 14, 2009 at 2:06 PM, tripp <trippl...@gmail.com> wrote: > OK. It sounds like it would be easiest for me, then, to dump the > arrays to a binary file (much faster than dumping it to a text) from > the fortran program. Then use f2py to load a fortran module to read > it.?.
I've done something similar and have written some wrapper functions (in pure python) that read in fortran binary arrays and puts them into a numpy array. You have to deal with fortran records, which (for the fortran compiler I'm using) puts a 4-byte record length indicator at the beginning and end of each record, with the raw binary data between. The issue is mildly complicated if you have to deal with endianness incompatibilites between computers. IIRC, the format of the records is compiler dependent, although I've found that gfortran, g77 and xlfortran are consistent with each other. If you like I'd be happy to send you the code. Kurt
-- http://mail.python.org/mailman/listinfo/python-list