我需要处理MODIS海平面2的数据,我得到了ENVI https://github.com/dawhite/EPOC/releases的一个外部插件。现在,我想要批处理数百个图像,我修改了这些图像的代码,如下所示。代码运行得很好,但我每次都必须选择输入文件。有没有人能帮我把这个程序完全自动化?我真的很感谢你的帮助!
Pro OCL2convert
dir = 'C:\MODIS\'
CD, dir
; batch processing of level 2 ocean chlorophyll data
files=file_search('*.L2_LAC_OC.x.hdf', count=numfiles)
; this command will search for all files in the directory which end with
; the specified one
counter=0
; this is a counter that tells IDL which file is being read-starts at 0
While (counter LT numfiles) Do begin
; this command tells IDL to start a loop and to only finish when the counter
; is equal to the number of files with the name specified
name=files(counter)
openr, 1, name
proj = envi_proj_create(/utm, zone=40, datum='WGS-84')
ps = [1000.0d,1000.0d]
no_bowtie = 0 ;same as not setting the keyword
no_msg = 1 ;same as setting the keyword
;OUTPUT CHOICES
;0 -> standard product only
;1 -> georeferenced product only
;2 -> standard and georeferenced products
output_choice = 2
;RETURNED VALUES
;r_fid -> ENVI FID for the standard product, if requested
;georef_fid -> ENVI FID for the georeferenced product, if requested
convert_oc_l2_data, fname=fname, output_path=output_path, $
proj=proj, ps=ps, output_choice=output_choice, r_fid=r_fid, $
georef_fid=georef_fid, no_bowtie=no_bowtie, no_msg=no_msg
print,'done!'
close, 1
counter=counter+1
Endwhile结束
发布于 2015-04-10 23:10:00
由于不知道convert_oc_l2_data做了什么(它似乎是您创建的程序,没有关于它的公共文档),我想说问题可能是out_path变量没有在程序的其余部分中定义。
https://stackoverflow.com/questions/29514188
复制相似问题