Use this procedure to read ASCII column data.
Syntax
ENVI_READ_COLS, Name, Values [, ERROR=variable] [, HEAD=string array] [, /READ_HEAD] [, /READ_SKIP] [, SKIP=string array]
Arguments
Name
This is the filename to read from.
Values
This is a named variable containing the values to read from Name.
Keywords
ERROR (optional)
Use this keyword to specify a named variable that holds the value of the error flag. If this variable is set to a value of 1, there was a read error. A value of 0 indicates no error.
HEAD (optional)
Use this keyword to specify a string array that contains the first five rows of data from the file being read.
READ_HEAD (optional)
Set this keyword to read the column header and store the result in the string array specified by the keyword HEAD.
READ_SKIP (optional)
Set this keyword to save all skipped lines in the array specified by the SKIP keyword. Lines are only skipped when they cannot be decoded into the proper values.
SKIP (optional)
Use this keyword to specify a string array that contains skipped lines. You must use this keyword if you set READ_SKIP.
Example
The following example is similar to that of ENVI_REGISTER_DOIT, but it uses ENVI_READ_COLS to read an ASCII file of ground control points (GCPs) instead of explicitly defining the GCPs in the code. The example performs image-to-map registration using GCPs on a Boulder, Colorado, Landsat scene.
PRO EXAMPLE_ENVI_READ_COLS
compile_opt IDL2
envi, /restore_base_save_files
envi_batch_init, log_file='batch.txt'
input_file = 'bldr_tm.img'
envi_open_file, input_file, r_fid=fid
if (fid eq -1) then begin
envi_batch_exit
return
endif
envi_file_query, fid, dims=dims, nb=nb
pos = lindgen(nb)
out_name = 'testimg'
pts_file='bldrtm_m.pts'
envi_read_cols, pts_file, pts
units = envi_translate_projection_units('Meters')
proj = envi_proj_create(/utm, zone=13, $
datum='North America 1927', units=units)
pixel_size = [30., 30.]
envi_doit, 'envi_register_doit', $
w_fid=fid, w_pos=pos, w_dims=dims, $
method=2, out_name=out_name, $
pts=pts, pixel_size=pixel_size, $
proj=proj, r_fid=r_fid
envi_batch_exit
END
API Version
4.3