;+
; Author: Baikal
;-
; Time: Dec 15,2017
;
; To achieve the goal of batching Mask Land.
; Completed in Dec 19,2017 at 22:46.
;
Pro Batch_Mask_Land_02
directory = 'G:\2016.06.MOD\MOD02\5Clip\201606\'
files = file_search(directory,count = num,'*.tif')
Print,'共有',strtrim(num,2),'景影像待掩膜'
mask_file = 'G:\2016.06.MOD\MOD02\6Mask\Mask_01.tif'
mask_data = READ_TIFF(mask_file)
mask_data = reform(mask_data,[1, 1698, 1187])
for i = 0,num-1 DO BEGIN
MOD02 = READ_TIFF(files[i],GEOTIFF = geoinfo)
;将裁剪后的MOD02中存在的异常值转变为NaN值。
MOD02 = (MOD02 GT 0 AND MOD02 LE 1)*MOD02 + (MOD02 GT 1 OR MOD02 LE 0)*250
;修改DN=250为NaN b1*float(b1 ne 250)/(b1 ne 250)
MOD02 = MOD02*float(MOD02 ne 250)/(MOD02 ne 250)
Outpath = 'G:\2016.06.MOD\MOD02\7Sea\201606\'
pos = strpos(files[i],'\',/reverse_search)
Outname = strmid(files[i],pos+1,7) + '_Sea.tif'
;Multibands Layer Stacking
;通过[]实现多波段合成
Mask = [Mask_data,Mask_data,Mask_data,Mask_data,Mask_data,Mask_data,Mask_data]
Output_Data = MOD02 * Mask
WRITE_TIFF,Outpath + Outname,Output_Data,/FLOAT,GEOTIFF = geoinfo
Print,'第',strtrim(i+1,2),'景影像掩膜完毕'
endfor
Print,'掩膜完毕'
END
; Author: Baikal
;-
; Time: Dec 15,2017
;
; To achieve the goal of batching Mask Land.
; Completed in Dec 19,2017 at 22:46.
;
Pro Batch_Mask_Land_02
directory = 'G:\2016.06.MOD\MOD02\5Clip\201606\'
files = file_search(directory,count = num,'*.tif')
Print,'共有',strtrim(num,2),'景影像待掩膜'
mask_file = 'G:\2016.06.MOD\MOD02\6Mask\Mask_01.tif'
mask_data = READ_TIFF(mask_file)
mask_data = reform(mask_data,[1, 1698, 1187])
for i = 0,num-1 DO BEGIN
MOD02 = READ_TIFF(files[i],GEOTIFF = geoinfo)
;将裁剪后的MOD02中存在的异常值转变为NaN值。
MOD02 = (MOD02 GT 0 AND MOD02 LE 1)*MOD02 + (MOD02 GT 1 OR MOD02 LE 0)*250
;修改DN=250为NaN b1*float(b1 ne 250)/(b1 ne 250)
MOD02 = MOD02*float(MOD02 ne 250)/(MOD02 ne 250)
Outpath = 'G:\2016.06.MOD\MOD02\7Sea\201606\'
pos = strpos(files[i],'\',/reverse_search)
Outname = strmid(files[i],pos+1,7) + '_Sea.tif'
;Multibands Layer Stacking
;通过[]实现多波段合成
Mask = [Mask_data,Mask_data,Mask_data,Mask_data,Mask_data,Mask_data,Mask_data]
Output_Data = MOD02 * Mask
WRITE_TIFF,Outpath + Outname,Output_Data,/FLOAT,GEOTIFF = geoinfo
Print,'第',strtrim(i+1,2),'景影像掩膜完毕'
endfor
Print,'掩膜完毕'
END
没有评论:
发表评论