[SciPy-User] Padded data structure

Christopher Barker Chris.Barker@noaa....
Sun Feb 21 00:55:59 CST 2010



Miguel de Val Borro wrote:
> I would like to read padded output files from C structures that look
> like this file: http://spec.jpl.nasa.gov/ftp/pub/catalog/catdir.cat 
> The second row is a 13 character string that contains whitespaces.  I
> have looked at the align option in dtype passed as a parameter to
> loadtxt but could not make it work. 

Since there is whitespace between all those columns, I don't think you 
need align.  I suspect that a dtype something like:

('i4', 'S13', 'i4', 'f8', 'f8','f8','f8','f8','f8','f8', 'i2')

will do the trick.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the SciPy-User mailing list