I am using MATH_DOIT for processing some indices (see code below). This has worked fine with an equations with only two bands but I cannot get equations with three bands to work. I keep receiving an error:
Error: "Attempt to subscript FID with I is out of range"
Additionally is there anyway I could process more than one equation at a time and assign them different names?
pro bandmath_CSIT
compile_opt idl2
input_path = 'E:\FinalProcessing\GrassValley_Slide\georef_atcoroutput\'
cd, 'E:\FinalProcessing\GrassValley_Slide\burn_indices\'
files=FILE_SEARCH(input_path+'*_rotate', count=count)
IF(count EQ 0)THEN BEGIN
PrintF, 'No files were found to process'
ENDIF
;open file
for i=0, count-1 do begin
ENVI_OPEN_FILE, files[i], r_fid=fid
if(fid eq -1) then begin
envi_batch_exit
return
endif
envi_file_query, fid, dims=dims, ns=ns, nl=nl, fname=filename
;set pos array for calculation
t_fid=[fid,fid]
pos = [9, 24, 51]-1
exp = '(b9/(b24*b51))'
;set the output filenames by stripping out the base name and appending 'nbr.img'
out_name = file_basename(filename, '_rotate')+'_CSIT'
;call the doit
envi_doit,'math_doit',$
fid=t_fid, pos=pos, dims=dims,$
exp=exp, out_name=out_name, $
r_fid=r_fid
endfor
end
|