RDFLOAT
Name
RDFLOAT
Purpose
Quickly read a numeric ASCII data file into IDL floating/double vectors.
Explanation
Columns of data may be separated by tabs or spaces. This
program is fast but is restricted to data files where all columns can
be read as floating point (or all double precision).
Use READCOL if greater flexibility is desired. Use READFMT to read a
fixed-format ASCII file. Use FORPRINT to print columns of data.
Calling Sequence
RDFLOAT, name, v1, [ v2, v3, v4, v5, ... v19]
COLUMNS, /DOUBLE, SKIPLINE = , NUMLINE = ]
Inputs
NAME - Name of ASCII data file, scalar string. In VMS, an extension of
.DAT is assumed, if not supplied.
Optional Input Keywords
COLUMNS - Numeric scalar or vector specifying which columns in the file
to read. For example, if COLUMNS = [3,7,11] then the first
output variable (v1) would contain column 3, the second would
contain column 7 and the third would contain column 11. If
the number of elements in the COLUMNS vector is less than the
number of output parameters, then consecutive columns are
implied. For example, if 3 output parameters are supplied
(v1,v2,v3) and COLUMNS = 3, then columns 3,4, and 5 will be
read.
SKIPLINE - Integer scalar specifying number of lines to skip at the top
of file before reading. Default is to start at the first line.
NUMLINE - Integer scalar specifying number of lines in the file to read.
Default is to read the entire file
/DOUBLE - If this keyword is set, then all variables are read in as
double precision.
/SILENT - Set this keyword to suppress any informative messages
Outputs
V1,V2,V3,...V19 - IDL vectors to contain columns of data.
Up to 19 columns may be read. All output vectors are of type
float, unless the /DOUBLE keyword is set,
Examples
Each row in a file 'position.dat' contains a star number and 6 columns
of data giving an RA and Dec in sexagesimal format. Read into IDL
variables.
IDL> rdfloat,'position.dat',ID,hr,min,sec,deg,dmin,dsec
All output vectors will be floating point. To only read the
declination vectors (Deg,dmin,dsec)
IDL> rdfloat,'position.dat',deg,dmin,dsec,col=4
Restrictions
(1) All rows in the file must be formatted identically (except for
those skipped by SKIPLINE). RDFLOAT reads the first line of
the data (after SKIPLINE) to determine the number of columns of
data.
(2) Cannot be used to read strings
Procedures Used
None.
Revision History
Written W. Landsman September 1995
Call NUMLINES() function February 1996
Read up to 19 columns August 1997
Converted to IDL V5.0 W. Landsman September 1997
Allow to skip more than 32767 lines W. Landsman June 2001
Added /SILENT keyword W. Landsman March 2002
Added COLUMNS keyword, use STRSPLIT W. Landsman May 2002
Use SKIP_LUN if V5.6 or later W. Landsman Nov 2002
V5.6 version, use FILE_LINES() W. Landsman Dec 2002