您现在的位置是:首页 >其他 >IDL实现6s模拟网站首页其他
IDL实现6s模拟
function read_6s,input
if input le 14 and input ge 7 then begin ;判断自变量是否符合要求
a=0 ;User defined
b=30 ;太阳天顶角
c=0 ;太阳方位角
d=100 ;观测方位角
month=5 ;月
day=17 ;日
q=8
e=3.0 & f=0.35 ;water vapor and ozone
g=1 ;continental model
h=0
ii=-0.2 ;观测目标高度
jj=-1000 ;sensor level
kk=42 ;chosen band
l=0 ;homogeneous surface
m=0 ;no directional effects
n=0 ;constant value for ro
o=-1
p=' No atm. corrections selected'
aods=dindgen(15) ;设置0~14的连续双精度数组,以作自变量
az=dblarr(input) ;建立元素均为0的数组
ax=dblarr(input)
aw=dblarr(input)
vza=string(dindgen(input)*5) ;观测天顶角 0~70 取35,下标选6
aod=string(dindgen(input)*0.25) ;AOD 0~3 取1.5 下标5
sr=string(dindgen(input)*0.05) ;SR 0~1 取0.5 下标4
varx1='type C:UsersASUSDesktopch02_6s_testinput.txt | 6SV-10B >> C:UsersASUSDesktopch02_6s_testoutput'
varx2=strtrim(indgen(input),1) ;删除前面的空格,为写出多个output文件命名
varx3='.txt '
fn='C:UsersASUSDesktopch02_6s_testinput.txt'
fn1='C:UsersASUSDesktopch02_6s_test6SV-run.bat'
for i=0,input-1 do begin
openw,lun1,fn1,/get_lun
writeu,lun1,' '
free_lun,lun1
varx123=strtrim(varx1+string(varx2[i])+varx3,1)
openw,lun,fn,/get_lun
openw,lun1,fn1,/get_lun
printf,lun,strtrim(a,1)
printf,lun,strtrim(b,1),c,vza[i],d,month,day
printf,lun,strtrim(q,1)
printf,lun,strtrim(e,1),strtrim(f)
printf,lun,strtrim(g,1)
printf,lun,strtrim(h,1)
printf,lun,strtrim(aod[6],1)
printf,lun,strtrim(ii,1)
printf,lun,strtrim(jj,1)
printf,lun,strtrim(kk,1)
printf,lun,strtrim(l,1)
printf,lun,strtrim(m,1)
printf,lun,strtrim(n,1)
printf,lun,strtrim(sr[5],1)
printf,lun,strtrim(o,1),p
writeu,lun1,strcompress(varx123)
free_lun,lun,lun1
cd,'C:UsersASUSDesktopch02_6s_test' ;指定路径
spawn,'C:UsersASUSDesktopch02_6s_test6SV-run.bat',/hide ;调用6s
openw,lun,fn,/get_lun
writeu,lun,' '
free_lun,lun
file='C:UsersASUSDesktopch02_6s_testoutput'+ strtrim(i,1) +'.txt'
result='result.txt'
openr,lun,file,/get_lun ;读数据
data=strarr(1,120)
readf,lun,data
az[i]=strmid(data[0,60],30,9)
free_lun,lun
endfor
varx1='type C:UsersASUSDesktopch02_6s_testinput.txt | 6SV-10B >> C:UsersASUSDesktopch02_6s_testoutput0'
varx2=strtrim(indgen(input),1)
varx3='.txt '
for j=0,input-1 do begin
openw,lun1,fn1,/get_lun
writeu,lun1,' '
free_lun,lun1
varx123=strtrim(varx1+string(varx2[j])+varx3,1)
openw,lun,fn,/get_lun
openw,lun1,fn1,/get_lun
printf,lun,strtrim(a,1)
printf,lun,strtrim(b,1),c,vza[6],d,month,day
printf,lun,strtrim(q,1)
printf,lun,strtrim(e,1),strtrim(f)
printf,lun,strtrim(g,1)
printf,lun,strtrim(h,1)
printf,lun,strtrim(aod[j],1)
printf,lun,strtrim(ii,1)
printf,lun,strtrim(jj,1)
printf,lun,strtrim(kk,1)
printf,lun,strtrim(l,1)
printf,lun,strtrim(m,1)
printf,lun,strtrim(n,1)
printf,lun,strtrim(sr[5],1)
printf,lun,strtrim(o,1),p
writeu,lun1,strcompress(varx123)
free_lun,lun,lun1
cd,'C:UsersASUSDesktopch02_6s_test'
spawn,'C:UsersASUSDesktopch02_6s_test6SV-run.bat',/hide
openw,lun,fn,/get_lun
writeu,lun,' '
free_lun,lun
file='C:UsersASUSDesktopch02_6s_testoutput0'+ strtrim(j,1) +'.txt'
result='result.txt'
openr,lun,file,/get_lun
data=strarr(1,120)
readf,lun,data
ax[j]=strmid(data[0,60],30,9)
free_lun,lun
endfor
for k=0,input-1 do begin
varx1='type C:UsersASUSDesktopch02_6s_testinput.txt | 6SV-10B >> C:UsersASUSDesktopch02_6s_testoutput00'
openw,lun1,fn1,/get_lun
writeu,lun1,' '
free_lun,lun1
varx123=strtrim(varx1+string(varx2[k])+varx3,1)
openw,lun,fn,/get_lun
openw,lun1,fn1,/get_lun
printf,lun,strtrim(a,1)
printf,lun,strtrim(b,1),c,vza[6],d,month,day
printf,lun,strtrim(q,1)
printf,lun,strtrim(e,1),strtrim(f)
printf,lun,strtrim(g,1)
printf,lun,strtrim(h,1)
printf,lun,strtrim(aod[5],1)
printf,lun,strtrim(ii,1)
printf,lun,strtrim(jj,1)
printf,lun,strtrim(kk,1)
printf,lun,strtrim(l,1)
printf,lun,strtrim(m,1)
printf,lun,strtrim(n,1)
printf,lun,strtrim(sr[k],1)
printf,lun,strtrim(o,1),p
writeu,lun1,strcompress(varx123)
free_lun,lun,lun1
cd,'C:UsersASUSDesktopch02_6s_test'
spawn,'C:UsersASUSDesktopch02_6s_test6SV-run.bat',/hide
openw,lun,fn,/get_lun
writeu,lun,' '
free_lun,lun
file='C:UsersASUSDesktopch02_6s_testoutput00'+ strtrim(k,1) +'.txt'
openr,lun,file,/get_lun
data=strarr(1,120)
readf,lun,data
aw[k]=strmid(data[0,60],30,9)
free_lun,lun
endfor
endif
result=[[vza,az],[aod,ax],[sr,aw]] ;使用plot函数输出成图
AOD=double(aod)
ARC=double(vza)
REF=double(sr)
TOA1=double(ax)
TOA2=double(az)
TOA3=double(aw)
p1=plot(AOD,TOA1,xtitle='AOD',ytitle='TOA',color='r',title='TOA to AOD')
p2=plot(ARC,TOA2,xtitle='ARC',ytitle='TOA',color='b',title='TOA to ARC')
p3=plot(REF,TOA3,xtitle='REF',ytitle='TOA',color='g',title='TOA to REF')
;先进行编译,再利用IDL>a=read_6s(input)运行,注意input值的范围
print,'End Program!!!'
return,result
end