- 积分
- 5118
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-10-31
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
海温异常与位势高度求相关的时候,是要把海温异常的距平值求出一个平均值,还是每年的距平值与位势高度相乘。这个好晕 啊,怎么编写呢?下面的是我自己写的,大家帮忙看看思路对不对
program main
implicit none
integer,parameter:: iix=145,iiy=73,mt=696,m=12,y=58
integer i,j,t,yr,mo,kk,k
real::a=0.0,avf,s,g,h
integer::anum=0
real atemp(y),sst(iix,iiy,mt),num(y),temp(iix,iiy,m,y),sst1(y),d(y),f(y),hgt(iix,iiy,mt),hgt1(iix,iiy,m,y),bnum(y),zhgt1(iix,iiy,y),b(iix,iiy,y),fm(iix,iiy),r(iix,iiy),zhgt(iix,iiy),c(iix,iiy),fz(iix,iiy),atemp1(y)
open(13,file='f:\1\hgt.grd',form='binary')
open(11,file='f:\1\sst2.grd',form='binary')
open(14,file='f:\1\temp1.grd',form='binary')
open(41,file='f:\1\xiangguan.grd',form='binary')
open(51,file='f:\1\xiangguan.txt')
do t=1,mt
read(11) ((sst(i,j,t),i=1,iix),j=1,iiy)
enddo
do yr=1,y
read(14) (atemp(yr))
enddo
do yr=1,y
if(atemp(yr)>1.0)then
anum=anum+1
endif
enddo
do yr=1,y
do mo=1,m
kk=(yr-1)*12+mo
do j=1,iiy
do i=1,iix
temp(i,j,mo,yr)=sst(i,j,kk)
enddo
enddo
enddo
enddo
do yr=1,y
num(yr)=0
do mo=6,8
do j=1,iiy
do i=1,iix
if(temp(i,j,mo,yr)<=-9.99e+08)then
num(yr)=num(yr)+1
endif
enddo
enddo
enddo
enddo
do yr=1,y
f(yr)=0
do mo=6,8
do j=1,iiy
do i=1,iix
if(temp(i,j,mo,yr)>-9.99e+08)then
f(yr)=f(yr)+temp(i,j,mo,yr)
endif
enddo
enddo
enddo
enddo
do yr=1,y
d(yr)=f(yr)/(iix*iiy*3.0-num(yr))
enddo
s=0.0
do yr=1,y
s=s+d(yr)
enddo
avf=s/y
do yr=1,y
sst1(yr)=(d(yr)-avf)
enddo
k=1
do yr=1,y
if(atemp(yr)>1.0)then
f(k)=sst1(yr)
k=k+1
endif
enddo
do k=1,anum
g=f(k)+g
enddo
g=g/anum
do t=1,mt
read(13) ((hgt(i,j,t),i=1,iix),j=1,iiy)
enddo
do yr=1,y
do mo=1,m
kk=(yr-1)*12+mo
do j=1,iiy
do i=1,iix
hgt1(i,j,mo,yr)=hgt(i,j,kk)
enddo
enddo
enddo
enddo
do j=1,iiy
do i=1,iix
do yr=1,y
bnum(yr)=0
do mo=6,8
if(hgt1(i,j,mo,yr)<=-9.9e+08)then
bnum(yr)=bnum(yr)+1
endif
enddo
enddo
enddo
enddo
do j=1,iiy
do i=1,iix
do yr=1,y
zhgt1(i,j,yr)=0
do mo=6,8
if(hgt1(i,j,mo,yr)>-9.9e+08)then
zhgt1(i,j,yr)=zhgt1(i,j,yr)+hgt1(i,j,mo,yr)
endif
enddo
enddo
enddo
enddo
do j=1,iiy
do i=1,iix
do yr=1,y
zhgt1(i,j,yr)=zhgt1(i,j,yr)/(3-bnum(yr))
enddo
enddo
enddo
do j=1,iiy
do i=1,iix
zhgt(i,j)=0.0
do yr=1,y
zhgt(i,j)=zhgt(i,j)+zhgt1(i,j,yr)
enddo
enddo
enddo
do j=1,iiy
do i=1,iix
zhgt(i,j)=zhgt(i,j)/y
enddo
enddo
do j=1,iiy
do i=1,iix
do yr=1,y
b(i,j,yr)=zhgt1(i,j,yr)-zhgt(i,j)
enddo
enddo
enddo
do j=1,iiy
do i=1,iix
fm(i,j)=0.0
do yr=1,y
fm(i,j)=fm(i,j)+(g*b(i,j,yr))
enddo
enddo
enddo
do j=1,iiy
do i=1,iix
fm(i,j)=fm(i,j)/anum
enddo
enddo
a=g**2
do j=1,iiy
do i=1,iix
do yr=1,y
c(i,j)=c(i,j)+b(i,j,yr)**2
enddo
enddo
enddo
do j=1,iiy
do i=1,iix
fz(i,j)=a*c(i,j)
enddo
enddo
do j=1,iiy
do i=1,iix
r(i,j)=fm(i,j)/sqrt(fz(i,j))
enddo
enddo
do j=1,iiy
do i=1,iix
write(41) r(i,j)
write(51,*) r(i,j)
enddo
enddo
end
|
|