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

David Huard david.huard at gmail.com
Tue Sep 21 13:29:09 EDT 2010


Have you tried

http://code.google.com/p/python-fortranformat/

It's not officially released yet but it's probably worth a try.

David H.

On Tue, Sep 21, 2010 at 8:25 AM, Andrew Jaffe <a.h.jaffe at gmail.com> wrote:

> 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
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100921/c4b8b759/attachment.html>


More information about the NumPy-Discussion mailing list