ENVI_READ_COLS
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
; First restore all the base save files.
;
envi, /restore_base_save_files
;
; Initialize ENVI and send all errors
; and warnings to the file batch.txt
;
envi_batch_init, log_file='batch.txt'
;
; Open the input file
;
input_file = 'bldr_tm.img'
envi_open_file, input_file, r_fid=fid
if (fid eq -1) then begin
envi_batch_exit
return
endif
;
; Set the DIMS and POS to keywords
; to processes all spatial and all
; spectral data. Output the result
; to disk.
;
envi_file_query, fid, dims=dims, nb=nb
pos = lindgen(nb)
out_name = 'testimg'
;
; Read the points file with the map
; coordinates for known pixel locations and
; create projection for the map coordinates.
; Set the output pixel size to 30 meters.
;
pts_file='bldrtm_m.pts'
envi_read_cols, pts_file, pts
;
; Create the projection of the map coordinates
;
units = envi_translate_projection_units('Meters')
proj = envi_proj_create(/utm, zone=13, $
datum='North America 1927', units=units)
pixel_size = [30., 30.]
;
; Perform the image-to-map registration.
;
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
;
; Exit ENVI
;
envi_batch_exit
END
API Version
4.2