Re: [Numpy-discussion] Another question on reading from binary FORTRAN file

2009-03-10 Thread Sturla Molden
Mark Bakker wrote: > Thanks, Mike. > This seems to be a really easy way. > One more question. > It turns out my file also contains a character string of 16 characters. > I tried > np.fromfile(fd,np.str,16) > np.fromfile(fd,np.uint8,16).tostring() __

Re: [Numpy-discussion] Another question on reading from binary FORTRAN file

2009-03-10 Thread Michael S. Gilbert
On Tue, 10 Mar 2009 16:05:06 +0100, Mark Bakker wrote: > Thanks, Mike. > This seems to be a really easy way. > One more question. > It turns out my file also contains a character string of 16 characters. > I tried > np.fromfile(fd,np.str,16) > But that gives an error. > Can I read a characterstrin

Re: [Numpy-discussion] Another question on reading from binary FORTRAN file

2009-03-10 Thread Mark Bakker
Thanks, Mike. This seems to be a really easy way. One more question. It turns out my file also contains a character string of 16 characters. I tried np.fromfile(fd,np.str,16) But that gives an error. Can I read a characterstring with fromfile? I know, I can read with fd.read, but I am wondering if

Re: [Numpy-discussion] Another question on reading from binary FORTRAN file

2009-03-10 Thread Sturla Molden
On 3/9/2009 9:45 PM, Mark Bakker wrote: > How do I read these into Python? One option is to read the file in Fortran (using the same compiler), and call Fortran from python using f2py. If you can write the file in Fortran, you can read the file in Fortran. Another option to find out how the bi

Re: [Numpy-discussion] Another question on reading from binary FORTRAN file

2009-03-09 Thread Michael Gilbert
On Mon, 9 Mar 2009 18:21:45 -0400 "Michael S. Gilbert" wrote: > On Mon, 9 Mar 2009 21:45:42 +0100, Mark Bakker wrote: > > > Hello - > > > > I tried to figure this out from the list, but haven't succeeded yet. > > > > I have a simple FORTRAN binary file. > > It contains: > > 1 integer > > 1 floa

Re: [Numpy-discussion] Another question on reading from binary FORTRAN file

2009-03-09 Thread Christopher Barker
> On Mon, 9 Mar 2009 21:45:42 +0100, Mark Bakker wrote: >> I tried to figure this out from the list, but haven't succeeded yet. >> >> I have a simple FORTRAN binary file. >> It contains: >> 1 integer >> 1 float >> 1 array with 16 numbers (float) >> >> How do I read these into Python? there was a l

Re: [Numpy-discussion] Another question on reading from binary FORTRAN file

2009-03-09 Thread Michael S. Gilbert
On Mon, 9 Mar 2009 21:45:42 +0100, Mark Bakker wrote: > Hello - > > I tried to figure this out from the list, but haven't succeeded yet. > > I have a simple FORTRAN binary file. > It contains: > 1 integer > 1 float > 1 array with 16 numbers (float) > > How do I read these into Python? I figure

[Numpy-discussion] Another question on reading from binary FORTRAN file

2009-03-09 Thread Mark Bakker
Hello - I tried to figure this out from the list, but haven't succeeded yet. I have a simple FORTRAN binary file. It contains: 1 integer 1 float 1 array with 16 numbers (float) How do I read these into Python? Thanks, Mark ___ Numpy-discussion mailing