Hi, I wrote some codes to transfer an image file to grid. I used the no_realize option in the envi_open_file. The code compiled ok but when it runs, envi gave me the error:
% ENVI_OPEN_FILE: Incorrect number of arguments.
My code is like follows:
; Open the input file in ENVI
envi_open_file, infiles, no_realize, r_fid=fid
; Gracefully exit if the user picked a bogus file
if (fid eq -1) then return
;Query the number of samples, lines, and bands in the file
envi_file_query, fid, ns=ns, nl=nl, nb=nb
; Select all bands in the file for output
pos = lindgen(nb)
; Export the entire spatial extent of the dataset
dims = [-1,0,ns-1,0,nl-1]
; Export the GRID file, referenced by file id
envi_output_to_external_format, ESRI_GRID,$
fid=fid, pos=pos, dims=dims, out_name=outfilename
|