-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfsc_mean.pro
36 lines (34 loc) · 1.12 KB
/
fsc_mean.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;FSC Average
;author:shaodonghang
;date:2016-10-27
pro FSC_Mean
;打开数据
COMPILE_OPT IDL2
ENVI, /RESTORE_BASE_SAVE_FILES
ENVI_BATCH_INIT, LOG_FILE='BATCH.LOG'
print,'Start time: ',systime()
begintime = systime(1)
ROOT_DIR = 'H:\heihefsc\2000FSC\'
FNS = FILE_SEARCH(ROOT_DIR,'*.tif',COUNT = COUNT)
PRINT, 'There ara totally', COUNT,' images.'
for i=0,COUNT-1 do begin
fn = FNS[i]
envi_open_file, fn, r_fid=fid
envi_file_query, fid, ns=ns, nl=nl, nb=nb, dims=dims, $
data_type=data_type, interleave=interleave, offset=offset
map_info=envi_get_map_info(fid=fid)
;读取波段
band=envi_get_data(fid=fid, dims=dims, pos=0)
a=total(double(band)) ;计算波段的总和
;R=mean(band)
; b=a-1942656D ;减去空白部分的无效值
c=11538 ;像元总数
R=double(a/c) ;积雪覆盖率
print, R,format='(i3)' ;最终结果,精确到小数点后4位
endfor
print,'End time: ',systime()
endtime = systime(1)
timespan = endtime-begintime
print,'Run Time: '+string(timespan)+' s'
envi_batch_exit
end