IDL 6.1 ENVI 4.1 Interation Problem [message #43178] |
Fri, 18 March 2005 10:43 |
vinit
Messages: 7 Registered: March 2005
|
Junior Member |
|
|
March 17, 2005
Hello,
I am trying to write a program to calibrate AVHRR data using IDL 6.1.
IDL, I believe, uses some built in ENVI 4.1 functions to actually
process the data. I am new both to IDL and ENVI and am not sure if what
I'm saying is fully correct.
The following program opens a file that has a list of all the files
that need to be processed (called "inputFile") and processes them using
the ENVI commands. The skeleton of this program was taken from an
example (ENVI_AVHRR_CALIBRATE_DO_IT) in the online ENVI 4.1 (PDF)
manual. The program compiles fine. Also, it runs without errors if one
file is being processed. However, when I try to run the program, with
more than one file (on my test run, I tried to run the program with 5
files that needed to be processed), the program gave the following
output:
% Compiled module: TEST.
IDL> test
Processing file: 1_25_99_10_40_AM
Processing file: 1_25_99_12_09_PM
% Program caused arithmetic error: Floating illegal operand
Processing file: 1_26_99_10_29_AM
% Program caused arithmetic error: Floating illegal operand
Processing file: 1_26_99_12_01_PM
% Program caused arithmetic error: Floating illegal operand
Processing file: 1_27_99_10_19_AM
% Program caused arithmetic error: Floating illegal operand
Notice that for the first file the program does not output the
following error: "Program caused arithmetic error: Floating illegal
operand". However, after that this error is present. I have tried to
get around this nagging bug (by trying to use the IDL function
FILE_SEARCH, as suggested by the RSI tech support team. That didn't
work so I've omitted the part involving FILE_SEARCH in this section of
code entirely) but without success. I'd be grateful if someone could
help me out.
Thanks very much,
Vinit
pro test
working_dir = 'E:\MyDir\'
out_dir = 'E:\MyDir\Output\'
envi, /restore_base_save_files
; ENVI Reference Guide ENVI_AVHRR_CALIBRATE_DOIT
; initialize ENVI and send all errors and warnings to the file
batch.txt
envi_batch_init, log_file='batch.txt'
; number of batch files
toprocess = ''
numfilestoprocess = 5
; get name of file to process from input batch file named "toprocess"
batchfile = working_dir + 'inputFile'
; assign a file unit
get_lun, batchunit
; open the file for reading
openr, batchunit, batchfile
; process in Batch numfiletoprocess number of image files
for firstfile=0, (numfilestoprocess-1) do begin
readf,batchunit,toprocess
print, "Processing file: " + toprocess
filetoprocess = working_dir + toprocess
envi_open_data_file, toprocess, $
r_fid=fid, /avhrr
if (fid eq -1) then begin
;print error message
print, openfid
return
end
; set the keywords
envi_file_query, fid, ns = ns, nl = nl, nb = nb
dims = [-1l, 0, ns - 1, 0, nl - 1]
; write the name of the output file
out_name = out_dir + toprocess + 'cal'
pos = lindgen(nb)
; call the doit
envi_doit, 'envi_avhrr_calibrate_doit', $
fid=fid, dims=dims, pos=pos, $
out_name = out_dir + toprocess + 'cal', /correct_solarz, $
r_fid=r_fid
envi_file_mng, id=fid, /remove
envi_file_mng, id=r_fid, /remove
close, fid
close, r_fid
free_lun, fid
free_lun, r_fid
endfor
close, batchunit
free_lun, batchunit
envi_batch_exit
exit
end
|
|
|