[SciPy-user] reading data into a RecordArray
Sun Dec 23 18:42:21 CST 2007
I'm relatively new to python, and new to this list. Hello everyone - I
really like what you're doing with scipy.
My question relates to code I'm writing to convert my ASCII data to netCDF.
I'm trying to:
1. Read in the data file
2. Read in a file containing the column headers
3. Merge the two into a record array
I've read the overview (http://www.scipy.org/RecordArrays), and gone back
over the introductory material on lists and tuples, but I've stumped myself.
from scipy import *
colfile = open("my_column_spec.txt")
cols = colfile.readlines()
for col in cols:
columns = columns + [(col,'f4')]
ifile = open("my_ascii_data.txt")
data = io.array_import.read_array(ifile)
data = array(data,columns)
fails on the last line with the error "expected a readable buffer object".
In case it's relevant, dt.shape is (1984,22) and len(cols) is 22. Any
pointers as to what I'm doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user