[Numpy-discussion] read ascii file from complex fortran format() -- genfromtxt

Andrew Jaffe a.h.jaffe@gmail....
Tue Sep 21 07:25:19 CDT 2010


Hi all,

I've got an ascii file with a relatively complicated structure, 
originally written by fortran with the format:

     135    format(a12,1x,2(f10.5,1x),i3,1x,4(f9.3,1x),4(i2,1x),3x,
          1 16(f7.2,1x),i3,3x,f13.5,1x,f10.5,1x,f10.6,1x,i3,1x,
          2 4(f10.6,1x),
          2 i2,1x,f5.2,1x,f10.3,1x,i3,1x,f7.2,1x,f7.2,3x,4(f7.4,1x),
          3 4(f7.2,1x),3x,f7.2,1x,i4,3x,f10.3,1x,14(f6.2,1x),i3,1x,
          1  3x,2f10.5,8f11.2,2f10.5,f12.3,3x,
          4 2(a6,1x),a23,1x,a22,1x,a22)

Note, in particular, that many of the strings contain white space.

Is there a relatively straightforward way to translate this into  dtype 
(and delimiter?) arguments for use with genfromtxt or do I just have to 
do it by hand?

Andrew


More information about the NumPy-Discussion mailing list