Help with envi_output_to_external_file [message #71056] |
Mon, 24 May 2010 09:37 |
lorenzo
Messages: 3 Registered: May 2010
|
Junior Member |
|
|
Hi all,
I am new to ENVI, and I am trying to write the output of a routine to
an ASCII file, using the above mentioned ENVI routine, but I
consistently get an "error: incorrect number of arguments" message.
The variable to be output to a file (outlib) is a 20x22 array and it
shows good data.
Help is much appreciated!
Lorenzo.
Here is the code:
pro sample_average
compile_opt idl2
envi, /restore_base_save_files
envi_batch_init, log_file='batch.log'
envi_select, fid=fid, dims=dims, pos=pos
if (fid[0] eq -1) then return
;ENVI_OPEN_FILE, /NO_REALIZE , R_FID=fid, dims=dims, pos=pos
;if (fid[0] eq -1) then return
envi_file_query, fid, ns=ns, nl=nl, nb=nb
out_lib=fltarr(nb,
ns)
temp_data=fltarr(nl,
nb)
for i=0, ns-1 do
begin
for j=0, nb-1 do
begin
sub_dims = [-1, i, i, dims[3],
dims[4]]
x=envi_get_data(fid=fid, pos=[j],
dims=sub_dims)
temp_data[*,
j]=x
endfor
for j=0, nb-1 do begin
out_lib[j, i]=mean(temp_data[*, j])
endfor
endfor
array=[5,1]
envi_output_to_external_format, /ascii, out_lib, field=array,
dims=sub_dims, pos=pos, fid=fid, out_name ="spectra.txt"
end
|
|
|