pro resize ;文件名必须与程序名相同,否则无法编译 envi, /restore_base_save_files ;恢复ENVI sav文件 envi_batch_init, log_file='batch.txt' ;开始批处理模式 ;=====定义输入文件路径===== inpath='d:\modis\' ;=====定义输出文件路径===== outpath='d:\modis\outfiles\' ;定义批处理文件名列表 filename = ['ref250.img','ref250_new.img'] n = N_ELEMENTS(filename) ;n_elements函数返回数组中所有元素的数目 ;==========批处理===================== FOR i=0,n-1 DO BEGIN in_name=inpath+filename[i] envi_open_file, in_name, r_fid=fid if (fid eq -1) then begin envi_batch_exit return endif envi_file_query, fid, ns=ns, nl=nl, nb=nb dims = [-1, 0, ns-1, 0, nl-1] pos = lindgen(nb) out_name = outpath+filename[i]+'.tif' envi_doit, 'resize_doit', $ fid=fid, pos=pos, dims=[-1, 5,200,5,100], $ interp=0, rfact=[1,1],out_name=out_name, r_fid=r_fid ENDFOR ;=============================退出批处理模式======================= envi_batch_exit end
|
|
来自: 昵称14236700 > 《待分类1》