[SciPy-User] fread/fwrite and fromfile

Wernher Brevis w.brevis at sheffield.ac.uk
Mon Jun 13 12:04:40 EDT 2011


Hello,

I recently updated scipy and numpy. I tried to run a script that
contains the following line:

	from scipy.io.numpyio import fwrite, fread
	import numpy as np


	fid = open(filename, 'r')
	nx = fread(fid,1,'d')
	ny = fread(fid,1,'d')
	x = fread(fid, nx*ny, 'd')
	y = fread(fid, nx*ny, 'd')
	u = fread(fid, nx*ny, 'd')
	v = fread(fid, nx*ny, 'd')


What is the best way to rewrite these using the io tools available in
numpy, e.g. fromfile?

Thank you in advance,

Wernher




More information about the SciPy-User mailing list