2024年3月26日发(作者:税运珹)
idl程序实现大气校正
手动用6s大气校正模型来进行大气校正真的是很麻烦的事,还容易出错,还是上程序
吧,一劳永逸..
PRO fushejiaozheng
Compile_opt idl2
ENVI, /RESTORE_BASE_SAVE_FILES
ENVI_BATCH_INIT
tm_file ='E:IDLch06-16s大气
data1_Jiaozuo2JZ_'
ENVI_OPEN_FILE, tm_file, r_fid=fid
ENVI_FILE_QUERY, fid, dims=dims, ns=ns, nl=nl, nb=nb
filename = intarr(ns,nl,nb)
; dims=[-1,0,201,0,201]
校正
filename[*,*,0] = envi_get_data(fid=fid, dims=dims, pos=0)
filename[*,*,1] = envi_get_data(fid=fid, dims=dims, pos=1)
filename[*,*,2] = envi_get_data(fid=fid, dims=dims, pos=2)
filename[*,*,3] = envi_get_data(fid=fid, dims=dims, pos=3)
filename[*,*,4] = envi_get_data(fid=fid, dims=dims, pos=4)
filename[*,*,5] = envi_get_data(fid=fid, dims=dims, pos=5)
map_info = envi_get_map_info(fid=fid)
; ENVI_OPEN_FILE, filename[0], r_fid=fid
; ENVI_FILE_QUERY, fid, ns=ns, nl=nl
dims = [-1, 0, ns-1, 0, nl-1]
band_data=MAKE_ARRAY(nl,ns,6,/float) ; dn值
band_data2=MAKE_ARRAY(nl,ns,6,/float) ;存放定标处理后辐射值的数据
band_data21=MAKE_ARRAY(nl,ns,6,/float) ;存放表观反射率数据
band_data3=MAKE_ARRAY(nl,ns,6,/float) ;存放大气校正后的数据
sole=51.69179508 ;用于计算辐射值到表观反射率的参数
;d=1.0057
;esun=[1957,1829,1557,1047,219.3,74,52] ;波段1到7的太阳福照度
for i=0,5 do begin
band_data21[*,*,i]=(2.0000E-05*filename[*,*,i]-0.100000)/(sin(sole/180*!pi))
endfor
;辐射定标完成!!!
A=7 ;tm
mouth=3
day=27
hour=2.72
longitude=116.381 ;6S需要输入的参数
latitude=39.977
B=8
water=0.820202
ozone=0.403
C=1
D=0
value=0.358 ;气溶胶光学厚度
E=-0.080 ;target level
sensorl=-1000 ;sensor level
F=[137,138,139,140,141,142] ;sensor band
G=0
H=0
Ii=0
Ji=0.1
K=-1
cd,'E:IDL大气校正'
Tg=MAKE_ARRAY(6,/float) ;存放6s的计算结果如tg,s,t
p_ra=MAKE_ARRAY(6,/float)
T=MAKE_ARRAY(6,/float)
s=MAKE_ARRAY(6,/float)
for i=0,5 do begin
inname=''
openw,lun,inname,/get_lun ;生成不同波段的文档
printf,lun,A
printf,lun,mouth,day,hour,longitude,latitude
printf,lun,B
printf,lun,water,ozone
printf,lun,C
printf,lun,D
printf,lun,value
printf,lun,E
printf,lun,sensorl
printf,lun,F[i]
printf,lun,G
printf,lun,H
printf,lun,Ii
printf,lun,Ji
printf,lun,K
FREE_LUN,lun
SPAWN,'',/hide;调用6s <>符号为dos系统下的重定向符号 <
从文件读取命令输入>将输出结果写入文件
txtname=''
openr,lun,txtname,/GET_LUN
temp=STRARR(145)
readf,lun,temp
Tg[i]=STRMID(temp[112],62,8)
p_ra[i]=STRMID(temp[133],62,8) ;
T[i]=STRMID(temp[124],62,8) ;获取6s计算结果中的参数
S[i]=STRMID(temp[130],62,8) ;
FREE_LUN,lun
band_data3[*,*,i]=(p_ra[i]-band_data21[*,*,i]/Tg[i])/((p_ra[i]-band_data21[*,*,i]/
Tg[i])*s[i]-T[i]);6s计
;6s计算公式
endfor
print,band_data3[35,100,*]
class_data=band_data3
pos_class=indgen(6)
out_name ='E:IDLch06-16s大气校正data1_Jiaozuo2tm_class_'
envi_enter_data, class_data, map_info = map_info, r_fid=out_fid
envi_output_to_external_format,
dims=dims, pos=pos_class, /envi
fid=out_fid, out_name = out_name,
print,"end"
end
2024年3月26日发(作者:税运珹)
idl程序实现大气校正
手动用6s大气校正模型来进行大气校正真的是很麻烦的事,还容易出错,还是上程序
吧,一劳永逸..
PRO fushejiaozheng
Compile_opt idl2
ENVI, /RESTORE_BASE_SAVE_FILES
ENVI_BATCH_INIT
tm_file ='E:IDLch06-16s大气
data1_Jiaozuo2JZ_'
ENVI_OPEN_FILE, tm_file, r_fid=fid
ENVI_FILE_QUERY, fid, dims=dims, ns=ns, nl=nl, nb=nb
filename = intarr(ns,nl,nb)
; dims=[-1,0,201,0,201]
校正
filename[*,*,0] = envi_get_data(fid=fid, dims=dims, pos=0)
filename[*,*,1] = envi_get_data(fid=fid, dims=dims, pos=1)
filename[*,*,2] = envi_get_data(fid=fid, dims=dims, pos=2)
filename[*,*,3] = envi_get_data(fid=fid, dims=dims, pos=3)
filename[*,*,4] = envi_get_data(fid=fid, dims=dims, pos=4)
filename[*,*,5] = envi_get_data(fid=fid, dims=dims, pos=5)
map_info = envi_get_map_info(fid=fid)
; ENVI_OPEN_FILE, filename[0], r_fid=fid
; ENVI_FILE_QUERY, fid, ns=ns, nl=nl
dims = [-1, 0, ns-1, 0, nl-1]
band_data=MAKE_ARRAY(nl,ns,6,/float) ; dn值
band_data2=MAKE_ARRAY(nl,ns,6,/float) ;存放定标处理后辐射值的数据
band_data21=MAKE_ARRAY(nl,ns,6,/float) ;存放表观反射率数据
band_data3=MAKE_ARRAY(nl,ns,6,/float) ;存放大气校正后的数据
sole=51.69179508 ;用于计算辐射值到表观反射率的参数
;d=1.0057
;esun=[1957,1829,1557,1047,219.3,74,52] ;波段1到7的太阳福照度
for i=0,5 do begin
band_data21[*,*,i]=(2.0000E-05*filename[*,*,i]-0.100000)/(sin(sole/180*!pi))
endfor
;辐射定标完成!!!
A=7 ;tm
mouth=3
day=27
hour=2.72
longitude=116.381 ;6S需要输入的参数
latitude=39.977
B=8
water=0.820202
ozone=0.403
C=1
D=0
value=0.358 ;气溶胶光学厚度
E=-0.080 ;target level
sensorl=-1000 ;sensor level
F=[137,138,139,140,141,142] ;sensor band
G=0
H=0
Ii=0
Ji=0.1
K=-1
cd,'E:IDL大气校正'
Tg=MAKE_ARRAY(6,/float) ;存放6s的计算结果如tg,s,t
p_ra=MAKE_ARRAY(6,/float)
T=MAKE_ARRAY(6,/float)
s=MAKE_ARRAY(6,/float)
for i=0,5 do begin
inname=''
openw,lun,inname,/get_lun ;生成不同波段的文档
printf,lun,A
printf,lun,mouth,day,hour,longitude,latitude
printf,lun,B
printf,lun,water,ozone
printf,lun,C
printf,lun,D
printf,lun,value
printf,lun,E
printf,lun,sensorl
printf,lun,F[i]
printf,lun,G
printf,lun,H
printf,lun,Ii
printf,lun,Ji
printf,lun,K
FREE_LUN,lun
SPAWN,'',/hide;调用6s <>符号为dos系统下的重定向符号 <
从文件读取命令输入>将输出结果写入文件
txtname=''
openr,lun,txtname,/GET_LUN
temp=STRARR(145)
readf,lun,temp
Tg[i]=STRMID(temp[112],62,8)
p_ra[i]=STRMID(temp[133],62,8) ;
T[i]=STRMID(temp[124],62,8) ;获取6s计算结果中的参数
S[i]=STRMID(temp[130],62,8) ;
FREE_LUN,lun
band_data3[*,*,i]=(p_ra[i]-band_data21[*,*,i]/Tg[i])/((p_ra[i]-band_data21[*,*,i]/
Tg[i])*s[i]-T[i]);6s计
;6s计算公式
endfor
print,band_data3[35,100,*]
class_data=band_data3
pos_class=indgen(6)
out_name ='E:IDLch06-16s大气校正data1_Jiaozuo2tm_class_'
envi_enter_data, class_data, map_info = map_info, r_fid=out_fid
envi_output_to_external_format,
dims=dims, pos=pos_class, /envi
fid=out_fid, out_name = out_name,
print,"end"
end