| readcol (version 5.0) | index /devel/goods16/ferguson/pygoodsdist/doc/doctmp/readcol.py |
Routines for reading general whitespace-delimited, column-oriented files.
Returned values are either numpy one-dimensional arrays.
The read routines parse the input looking for
decimal points or non-numeric characters to decide on the format of
the output. Reading is therefore a bit slow, but the program interface
is extremely simple. For example, if the file 'foo' has three columns,
read them in as follows:
a,b,c = fgetcols('foo')
A few other options:
a,b,c,d = fgetcols('foo',1,3,5,7) # Read some selected columns
a = fgetcols('foo') # Read all the columns (a is then a tuple of arrays)
a,b,c = fgetcols('foo',fs=',') # Change the field separator to a comma
a,b,c = fgetcols('foo',cmt='!') # Change the comment character to '!'
The module also provides an object-oriented interface to save re-reading
the file if multiple getcol calls are desired:
f = readcol('foo')
a,b = f.getcols(1,2)
c,d = f.getcols(3,4)
f.close()
Ignores comment lines.
Ignores blank lines.
Optionally changes INDEF to a desired value (e.g. -99.99).
As of version 5.0, only numpy is offered (Numeric and numarray used to be
options).
| Modules | ||||||
| ||||||
| Classes | ||||||||||
|
| ||||||||||
| Functions | ||
| ||
| Data | ||
| __version__ = '5.0' | ||