- 积分
- 439
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-6-1
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2013-5-18 10:44:39
|
显示全部楼层
!该程序用以计算160站资料与SAH指数的相关关系并进行显著性检验
program ex1
implicit none
integer,parameter::num=160,yt=62
external sub1
integer i,t,k,nlev,nflag
real tim,lat(num),lon(num)
character stid(num)*8
integer r6(num,yt),r7(num,yt),r8(num,yt),ave(num,yt)
real x(yt)
real Uwndx(yt),corx(num) !中心位置指数:西风零线上H最大处的经度
real Uwndy(yt),cory(num) !中心位置指数:西风零线上H最大处的纬度
real S(yt),cors(num) !面积指数:(10°N-90°N,30°E-140°E)
real ERP(yt),core(num) !东伸指数:H=M位势米环流线的最东端经度值
real I1(yt),cor1(num) !强度指数I1:高压中心的位势高度值
real I2(yt),cor2(num) !强度指数I2:H>=M区域内所有格点H值与M位势米差的总和
real I3(yt),cor3(num) !强度指数I3:I2/S
real rr
!打开160站6,7,8月降水资料
open(7,file='G:\by\100hpa\1_12month\INDEX_MAY\r1606.txt')
open(8,file='G:\by\100hpa\1_12month\INDEX_MAY\r1607.txt')
open(9,file='G:\by\100hpa\1_12month\INDEX_MAY\r1608.txt')
!打开1951-2012年5月各南亚高压指数
open(10,file='G:\by\100hpa\1_12month\INDEX_MAY\I1_5.grd',form='binary')
open(20,file='G:\by\100hpa\1_12month\INDEX_MAY\I2_5.grd',form='binary')
open(30,file='G:\by\100hpa\1_12month\INDEX_MAY\I3_5.grd',form='binary')
open(40,file='G:\by\100hpa\1_12month\INDEX_MAY\s_5.grd',form='binary')
open(50,file='G:\by\100hpa\1_12month\INDEX_MAY\uwndx_5.grd',form='binary')
open(60,file='G:\by\100hpa\1_12month\INDEX_MAY\uwndy_5.grd',form='binary')
open(70,file='G:\by\100hpa\1_12month\INDEX_MAY\erp_5.grd',form='binary')
!新建1951-2012年5月各南亚高压指数t检验
open(11,file='G:\by\100hpa\1_12month\INDEX_MAY\tI1_5.grd',form='binary')
open(21,file='G:\by\100hpa\1_12month\INDEX_MAY\tI2_5.grd',form='binary')
open(31,file='G:\by\100hpa\1_12month\INDEX_MAY\tI3_5.grd',form='binary')
open(41,file='G:\by\100hpa\1_12month\INDEX_MAY\ts_5.grd',form='binary')
open(51,file='G:\by\100hpa\1_12month\INDEX_MAY\tuwndx_5.grd',form='binary')
open(61,file='G:\by\100hpa\1_12month\INDEX_MAY\tuwndy_5.grd',form='binary')
open(71,file='G:\by\100hpa\1_12month\INDEX_MAY\terp_5.grd',form='binary')
do t=1,yt
read(7,*)(r6(i,t),i=1,num)
read(8,*)(r7(i,t),i=1,num)
read(9,*)(r8(i,t),i=1,num)
end do
do t=1,yt
read(10) I1(t)
read(20) I2(t)
read(30) I3(t)
read(40) S(t)
read(50) uwndx(t)
read(60) uwndy(t)
read(70) erp(t)
end do
do i=1,num
do t=1,yt
ave(i,t)=r6(i,t)+r7(i,t)+r8(i,t)
end do
end do
do i=1,num
do t=1,yt
ave(i,t)=ave(i,t)/3
end do
end do
do i=1,num
x(yt)=0.0
do t=1,yt
x(t)=ave(i,t)
end do
call sub1(x,I1,rr)
cor1(i)=rr
call sub1(x,I2,rr)
cor2(i)=rr
call sub1(x,I3,rr)
cor3(i)=rr
call sub1(x,S,rr)
cors(i)=rr
call sub1(x,uwndx,rr)
corx(i)=rr
call sub1(x,uwndy,rr)
cory(i)=rr
call sub1(x,erp,rr)
core(i)=rr
end do
open(unit=1,file='G:\by\100hpa\1_12month\INDEX_MAY\160.txt',STATUS='OLD')
do k=1,num
read(1,*) stid(k),lat(k),lon(k)
end do
tim=0.
nlev=1
nflag=1
do i=1,num
write(11) stid(i),lat(i),lon(i),tim,nlev,nflag,cor1(i)
write(21) stid(i),lat(i),lon(i),tim,nlev,nflag,cor2(i)
write(31) stid(i),lat(i),lon(i),tim,nlev,nflag,cor3(i)
write(41) stid(i),lat(i),lon(i),tim,nlev,nflag,cors(i)
write(51) stid(i),lat(i),lon(i),tim,nlev,nflag,corx(i)
write(61) stid(i),lat(i),lon(i),tim,nlev,nflag,cory(i)
write(71) stid(i),lat(i),lon(i),tim,nlev,nflag,core(i)
end do
nlev = 0
write(11) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
write(21) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
write(31) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
write(41) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
write(51) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
write(61) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
write(71) stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
close(7)
close(8)
close(9)
close(10)
close(20)
close(30)
close(40)
close(50)
close(60)
close(70)
close(11)
close(21)
close(31)
close(41)
close(51)
close(61)
close(71)
close(1)
end
subroutine sub1(x,y,r) !子程序计算相关系数、t检验
implicit none
!integer,parameter::nt=62
!real x(nt),y(nt),rr,avex,aven,c,sx,sn
!integer it
!avex=0.0
!do it=1,nt
! avex=avex+x(it)
!end do
!avex=avex/nt
!aven=0.0
!do it=1,nt
! aven=aven+y(it)
!end do
!aven=aven/nt
!c=0.0
!sx=0.0
!sn=0.0
!do it=1,nt
! c=c+(x(it)-avex)*(y(it)-aven)
! sx=sx+(x(it)-avex)**2
! sn=sn+(y(it)-aven)**2
!end do
!rr=c/sqrt(sx*sn)
!return
!end subroutine sub1
integer yt,i
parameter (yt=62)
real x(yt),y(yt)
real ax,ay
real vx,vy
real c,r
ax=0.0
ay=0.0
vx=0.0
vy=0.0
do i=1,yt
ax=ax+x(i)
enddo
ax=ax/float(yt)
do i=1,yt
ay=ay+y(i)
enddo
ay=ay/float(yt)
do i=1,yt
vx=(x(i)-ax)**2+vx
enddo
vx=sqrt(vx/float(yt))
do i=1,yt
vy=vy+(y(i)-ay)**2
enddo
vy=sqrt(vy/float(yt))
c=0.0
do i=1,yt
c=(x(i)-ax)*(y(i)-ay)+c
enddo
c=c/float(yt)
r=c/abs(vx*vy)
return
end
!**********主程序结束***********************
刚发现我上传的附件要收费,这是我的处理的FORTRAN程序,相关和站点转化都在一起了 |
|