BINARY DATA, SCIPY, MIO (...again)
Travis Oliphant
oliphant at ee.byu.edu
Mon Oct 15 23:36:01 EDT 2001
A version of scipy had a typo in mio.py so that
Tupletype should have been TupleType
>>> from scipy import *
>>> help(io.fopen.fort_read)
fort_read(fmt, dtype=None)
Read a Fortran binary record.
Inputs:
fmt -- If dtype is not given this represents a struct.pack
format string to interpret the next record. Otherwise this
argument is ignored.
dtype -- If dtype is not None, then read in the next record as
an array of type dtype.
Outputs: (data,)
data -- If dtype is None, then data is a tuple containing the output
of struct.unpack on the next Fortan record.
If dtype is a datatype string, then the next record is
read in as a 1-D array of type datatype.
There are two ways to call this method of the object returned by fopen:
1) output_tuple = fid.fort_read(<some_struct_format_string>)
2) 1darray = fid.fort_read(whatever, dtype='double')
You probably whan the second method to read in a fortran record (created
by each write statement in your Fortran code) as an array of real*8 values
-Travis
More information about the Python-list
mailing list