[SciPy-user] problem with using scipy.io.mio on Windows
Herb Schilling
Herbert.W.Schilling at grc.nasa.gov
Wed Jan 16 10:59:04 EST 2002
Hello,
I am using scipy.io.mio to read in binary PLOT3D files. Everything
works fine when I run my code on an SGI but when I run it under
Windows 98 I have problems. ( I am using Windows native, not-cygwin
Python 2.1 ).
Here is the basic code I am using
import scipy.io.mio
# open the file
fileHandle = scipy.io.mio.fopen( filePath, 'r' , format = 'b' )
# read in the total number of blocks in this file
numberOfBlocks = fileHandle.fread( 1 , 'l' )
# Read in the size of each block
imaxes = []
jmaxes = []
for iBlock in range( numberOfBlocks ) :
imax = fileHandle.fread( 1 , 'l' )
jmax = fileHandle.fread( 1 , 'l' )
imaxes.append( imax )
jmaxes.append( jmax )
# Read in the X,Y coordinates of the points in the grids
for iBlock in range( numberOfBlocks ) :
imax = imaxes[ iBlock ]
jmax = jmaxes[ iBlock ]
# Note that we do want the transposed form
xGrid = fileHandle.fread( ( jmax, imax ) , 'f' , 'f' )
yGrid = fileHandle.fread( ( jmax, imax ) , 'f' , 'f' )
The number of blocks, and the size of each block is read in just
fine. When I start to read the X,Y coordinates things go bad. In the
case where the file has 5 blocks, I get the following errors and the
values for the xGrid and yGrid are, as you would expect, zeros after
reading in the first xGrid.
numpyio: Warning: 30060 bytes requested, 12 bytes read.
numpyio: Warning: 30060 bytes requested, 0 bytes read.
numpyio: Warning: 11084 bytes requested, 0 bytes read.
numpyio: Warning: 11084 bytes requested, 0 bytes read.
numpyio: Warning: 36816 bytes requested, 0 bytes read.
numpyio: Warning: 36816 bytes requested, 0 bytes read.
numpyio: Warning: 34160 bytes requested, 0 bytes read.
numpyio: Warning: 34160 bytes requested, 0 bytes read.
numpyio: Warning: 34160 bytes requested, 0 bytes read.
numpyio: Warning: 34160 bytes requested, 0 bytes read.
I am using the same code and the same file on both the PC and the SGI
and I can use "od" to see that there is more data to be read. Even
fileHandle.size() returns 292604.
Why can't the rest of the bytes be read ? What's different under Windows?
Thanks in advance!
--
---------------------------------
Herb Schilling
NASA Glenn Research Center
Cleveland, OH 44135
Herbert.W.Schilling at grc.nasa.gov
It is not enough to run, one must start in time. - teabag
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20020116/e8ec2548/attachment.html>
More information about the SciPy-User
mailing list