IDL多波段批量Band math计算植被指数


PRO bandmath
  COMPILE_OPT IDL2
  files=envi_pickfile(filter=['*.png'],/multiple_files)
  IF ~file_test(files[0]) THEN return
  num=size(files)
  num=num[1]
  FOR i=0,num-1 DO BEGIN
    file=files[i]
    envi_open_file,file,r_fid=fid
    IF (fid[0] EQ -1) THEN CONTINUE
    ENVI_FILE_QUERY, fid,dims=dims
    t_fid = [fid,fid,fid]
    pos = [0,1,2]
    BGI = '(float(b3)/float(b1+b2+b3))/(float(b2)/float(b1+b2+b3))'

    path='E:\train_henan\BGI1\'
    bname=file_basename(file,'.png')
    out_name = path+bname+'_BGI.tif'
    ENVI_DOIT, 'math_doit', $
      fid=t_fid, pos=pos, dims=dims, $
      exp=BGI, out_name=out_name, $
      r_fid=r_fid
      
  ENDFOR
END

 

你可能感兴趣的:(idl)