As another solution, it is my style to pretty much always use
read_ascii() and ascii_template() to read in data files. This has the
advantage of making a structure for each column miking indexing easier
(at least for me). The down side of this is that you have to take the
time to hard code (or save and recall) the output from
ascii_template() but that is not too hard (I will put an example here
as well).
This is a 14 column data file
doy.frac ut lt edge(1) edge(2) n_he Tperhe Tparhe
theta_he theta_hp n_lp effective_kp minkp[100ev] maxkp[50kev]
107.75080 18.01830 18.58810 0.000E+00 0.000E+00 9.623E-02
6.189E+02 7.768E+02 1.714E+02 8.068E+01 3.206E+00 2.300E+00
2.469E+00 1.003E+01
107.75180 18.04220 18.61200 0.000E+00 0.000E+00 1.133E-01
5.728E+02 4.715E+02 8.667E+01 7.945E+01 5.591E+00 2.300E+00
2.445E+00 9.961E+00
107.75280 18.06610 18.63590 0.000E+00 0.000E+00 1.316E-01
5.405E+02 4.477E+02 8.490E+01 8.091E+01 2.121E+00 2.300E+00
2.428E+00 9.920E+00
107.75380 18.09000 18.65970 0.000E+00 0.000E+00 1.560E-01
4.614E+02 3.598E+02 8.758E+01 8.014E+01 1.730E+00 2.300E+00
2.414E+00 9.881E+00
107.75474 18.11390 18.68360 0.000E+00 0.000E+00 1.566E-01
5.184E+02 3.616E+02 8.700E+01 7.947E+01 1.704E+00 2.300E+00
2.403E+00 9.842E+00
107.75573 18.13770 18.70750 2.941E+04 0.000E+00 1.572E-01
4.514E+02 3.012E+02 8.971E+01 8.268E+01 2.751E+00 8.317E+00
2.394E+00 9.803E+00
and the hard coded ascii_template() output is:
template = create_struct('version', 1.0, $
'datastart', 1l, $
'delimiter', 32b, $
'missingvalue', !values.f_nan, $
'commentsymbol', '', $
'fieldcount', 14l, $
'fieldtypes', lonarr(14), $
'fieldnames', strarr(14), $
'fieldlocations', lonarr(14), $
'fieldgroups', lonarr(14) )
template.fieldnames = ['doy', 'ut', 'lt1', 'edge1', 'edge2', $
'n_he', 'tperp_he', 'tpar_he', 'theta_he', $
'theta_hp', 'n_lp', 'eff_kp', 'minkp_100ev', $
'maxkp_50kev']
template.fieldtypes[*] = 4
template.fieldlocations =
[2,14,23,33,44,55,66,77,88,99,110,121,132,143]
template.fieldgroups = lindgen(14)
While annoying, you only have to do it once.
Cheers,
Brian
------------------------------------------------------------ ---------------------
Brian Larsen
Boston University
Center for Space Physics
|