MCTK批处理MODIS 09A1产品
MCTK批处理MODIS L2 swath产品
MODIS批量处理,知乎
MODIS批量处理,CSDN
;头
pro modis_mctk_try
compile_opt idl2
e = envi()
envi, /restore_base_save_files
envi_batch_init, log_file='batch.txt'
;选择需要批处理文件所在的文件夹
fn= dialog_pickfile(title="open the mod04 data",/directory) ;打开数据目录
outpath = 'D:\data\data1\' ;输出路径
files=file_search(fn,"*.hdf",count=nums)
bridges = mctk_create_bridges()
;方法1
inpath = 'D:\data\data1\'
files = file_search(inpath,"*.hdf",count=nums)
outpath = 'D:\data\data1\' ;输出路径
PRINT, '开始处理数据 : ', SYSTIME()
;方法2
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()
完整
pro modis_mctk
compile_opt idl2
e=envi(/headless)
fn= dialog_pickfile(title="open the mod04 data",/directory) ;打开数据目录
output_location = 'D:\data\data1\' ;输出路径
files=file_search(fn,"*.hdf",count=nums)
bridges = mctk_create_bridges()
for i=0,nums-1 do begin ;每一个影像进行处理
modis_swath_file=files[i]
basename=file_basename(files[i]) ;获取输入影像文件名
output_rootname=strmid(basename,0,32) ;获取指定范围名字
swath_name = 'mod04';这个值自己根据自己数据设置,用hdfviewer打开后,会显示
sd_names = ['AOD_550_Dark_Target_Deep_Blue_Combined'] ;;这是数据集名称,是一个字符串数组
; 以下参数需要自己去看文档,一般保持不变 。官方地址:https://github.com/dawhite/MCTK
out_method = 1
output_projection = envi_proj_create(/geographic)
interpolation_method = 0
print,output_rootname
convert_modis_data, in_file=modis_swath_file, $
out_path=output_location, out_root=output_rootname, $
swt_name=swath_name, sd_names=sd_names, $
out_method=out_method, out_proj=output_projection, $
interp_method=interpolation_method, /no_msg, $
r_fid_array=r_fid_array, r_fname_array=r_fname_array, $
bridges=bridges, msg=msg
endfor
mctk_destroy_bridges, bridges
end