[Numpy-discussion] using FortranFile to read data from a binary Fortran file

Brennan Williams brennan.williams at visualreservoir.com
Tue Nov 3 20:50:20 EST 2009


I'm using FortranFile on 32 bit XP.

The first record in the file has both 32 bit integer values and double 
precision float values.

I've used readInts('i') to read the data into what I presume is a 32-bit 
integer numpy array.

Items 0 and 1 of the array are the first double precision value.

What's the best way to convert/cast these to get the double precision 
float value?

I assume I need to do some sort of dpval=ival.astype('float64')

so far....

f= FortranFile(fname,endian='<')


More information about the NumPy-Discussion mailing list