IDL--辐射定标(Radiometric Calibration )

IDL–辐射定标(Radiometric Calibration )

  IDL自我感觉对新手不是很友好的工具,查找辐射定标让我花了二天,运行完之后果断分享给广大小白,希望大家能减少在这些上面的投入
PRO LandsatCALIBRATE  
COMPILE_OPT idl2
  t1=Tic('total1');计算开始时间
  doc=file_search('F:\IDL\Result');储存结果目录
  cd,doc
  Files = File_Search('F:\IDL\data\LT05114029', '*_MTL.txt');输入数据路径,A Landsat 8 OLI dataset consists of one TIFF file per band, metadata file to automatically read the gains and offsets. 

  e = ENVI(/HEADLESS);打开ENVI
  foreach File, Files,Index do begin;查找Flies中满足条件的文件
    t2=Tic()
    basename=file_basename(file,'_MTL.txt');获取除后缀的文件名称
    outpath=basename+'_rad.dat';输出辐射定标后文件名
    Catch, errorStatus;找到错误
    if (errorStatus ne 0) then begin
      Catch, /CANCEL; TODO: Write error handler     
      print,'当前图像处理失败,请检查图像是否损坏111'      
    endif
    Out_File = STRMID(File,0,STRPOS(File,'_MTL.txt'))
    Raster = e.OpenRaster(File);打开MRT文件; with an associated metadata file (*_MTL.txt). Open the
    print,'准备处理第'+STRING(Index+1)+'图像辐射定标开始:'+basename       
    Task = ENVITask('RadiometricCalibration');调用ENVI辐射定标; Get the radiometric calibration task from the catalog of ENVI tasks.
    Task.Input_Raster = Raster[0] ; 定义输入类型Define inputs. Since radiance is the default calibration method,Bands 1-7输入波段
    Task.Output_Data_Type = 4 ; 定义输出精度Floating-point (default)
    Task.CALIBRATION_TYPE =1;定义Top-of-atmosphere reflectance
    Task.SCALE_FACTOR=0.1;定义尺度因子
    Task.Output_Raster_URI = outpath ; Define output raster URI
    Task.Execute ; Run the task
    DataColl = e.Data; Get the data collection
    DataColl.Add, Task.Output_Raster; Add the output to the data collection
    t3 = toc(t2,REPORT =re)
    print,'第'+STRING(Index+1)+'图像辐射定标结束,用时'+string(t3)
  endforeach
  ti = toc(t1,REPORT =re)
  PRINT,'结束辐射定标,总用时:'+string(ti)
  e.Close;Close the ENVI session
END

IDL--辐射定标(Radiometric Calibration )_第1张图片

你可能感兴趣的:(IDL)