前言
ENVI+IDL版本:5.3
MCTK版本:V2.1.10
PS:
从2.0.0版本开始,MCTK使用完全相同的多线程、严格的swath投影引擎作为EPOC和VCTK,自动执行bowtie校正和支持所有三种标准插值方法,所以取消了以前版本keywords中的/bowtie。而且插值方法keywords不再是7.8.9而是对应着0.1.2。
(更多有关版本特点和keywords的详细介绍可参见:User’s Guide)
官方下载地址:https://github.com/dawhite/MCTK/releases
IDL代码
pro MCTK_batch
compile_opt idl2
e = envi()
envi, /restore_base_save_files
envi_batch_init, log_file='batch.txt'
;选择需要批处理文件所在的文件夹
inpath = Dialog_pickfile(/directory, title='Select MOD files inputpath')
cd, inpath
filenames = file_search('*.hdf')
n = N_elements(filenames)
print, n
;选择处理后文件另存的文件夹位置
outpath = Dialog_pickfile(/directory, title='Select MOD_Geo files outpath')
PRINT, '开始处理数据 : ', SYSTIME()
;导出
bridges = mctk_create_bridges()
FOR i = 0, n-1 DO BEGIN
MODfilename = inpath+filenames[i]
filename = filenames[i]
print,filename
out_name = STRMID(filename, 0, strlen(filename) - 4)+'_1000mLST'
swath_name = 'MOD_Swath_LST'
sd_names = ['LST']
Params = [6378137.0,6356752.3,0.00000000,105.00000,0.0000000,0.00000000,25.0000000,47.000]
name = 'Albers'
datum = 'WGS84'
units = envi_translate_projection_units('meters')
output_projection = envi_proj_create(name=name,datum=datum,params=params,type=9)
;以上是根据我个人需要设置的输出投影:Albers
;Output method schema is:
;0 = Standard, 1 = Reprojected, 2 = Standard and reprojected
out_method = 1
;INTERP_METHOD 0 — Nearest neighbor 1 — Bilinear 2 — Cubic convolution
;The values of 6, 7, and 8 that were used in the original API are no longer valid.
interpolation_method = 1
;background = NAN
nan_fill = float('NaN')
;这里调用了MTCK
convert_modis_data,in_file=MODfilename,out_path=outpath,$
out_root=out_name,swt_name=swath_name,sd_names=sd_names,$
out_method=out_method,out_proj=output_projection,$
background=nan_fill,/no_msg,bridges=bridges,interp_method=interpolation_method
ENDFOR
mctk_destroy_bridges, bridges
PRINT, '处理完成 : ', SYSTIME()
envi_batch_exit
end
处理结果