登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
附fortran程序,急求解答!!!!运行时是没有错误的,但是运行窗口(黑对话框)会自动关闭!
parameter(ni=145,nj=112)
character job(1)*5,dec(15)*1,year(10)*1,mon(12)*3,ifile*100
integer phead(45),i,j,deci,yeari,day,yri,dd,ddd,ddvar(19),kk,k,dayi(30),m(142,82,41),d,bs,aa
real varm(ni,nj),var(ni,nj,10800),xlon(ni,nj),xlat(ni,nj),zone(ni,nj),nhead(19),s(ni,nj,360,30),ss(ni,nj),rrr(ni,nj,30),jjj(ni,nj,30),yyy(ni,nj,30),temp,jjjj(ni,nj,30)
real varm2(30,12,30,ni,nj),nnn(ni,nj)
data job /'aabaa'/
data dec /'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t'/
data year /'1','2','3','4','5','6','7','8','9','0'/
data mon /'jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'/
!相关数据--
open(11,file='G:\GENGDI\precise daily data\lon-lat-markgrid\zlon.dat')
open(12,file='G:\GENGDI\precise daily data\lon-lat-markgrid\zlat.dat')
do j=1,112
read(11,'(145f10.2)')(xlon(i,j),i=1,145)
read(12,'(145f10.2)')(xlat(i,j),i=1,145)
enddo
open(14,file='G:\GENGDI\precise daily data\lon-lat-markgrid\markgrid.dat')
do j=1,nj
read(14,*) (zone(i,j),i=1,ni)
enddo
!1计算阈值--
do yri=11,40 !
yeari=mod(yri,10)
deci=(yri-yeari)/10+1
if(yeari==0)then
yeari=10
endif
aa=yri-10
print*,'year=',1950+yri,' deci=',dec(deci),' yeari=',year(yeari)
!3--12个月--!
do moni=1,12
ifile='G:\GENGDI\precise daily data\A1B\05216\'//job(1)//'a.pa'//dec(deci)//''//year(yeari)//''//mon(moni)//'.05216.pp'
open(10,file=ifile,form='unformatted')
!6--每个月30天--!
do day=1,30
read(10)phead,nhead
read(10)varm
!8--
do ii=1,ni
do jj=1,nj
varm2(aa,moni,day,ii,jj)=varm(ii,jj)*60*60*24
kk=(yri-1)*360+(moni-1)*30+day
var(i,j,kk)=varm2(aa,moni,day,i,j)
enddo
enddo
enddo
enddo
enddo
bs=1960
do yri=1,30
if(mod((bs+yri),4)==0)then
dayi(yri)=366
else
dayi(yri)=365
endif
enddo
do j=1,nj
do i=1,ni
k=0
do yri=1,30
dd=k+dayi(yri)
do kk=k+1,dd
if(var(i,j,kk).ne.-999.0.and.var(i,j,kk).ne.0.0)then
m(i,j,yri)=m(i,j,yri)+1
d=m(i,j,yri)
s(i,j,d,yri)=var(i,j,kk)
endif
enddo
k=dd
enddo
enddo
enddo
!
do i=1,ni
do j =1,nj
do yri=1,30
d=m(i,j,yri)
do k=1,d-1
do l=k+1,d
if (s(i,j,k,yri).gt.s(i,j,l,yri)) then
temp = s(i,j,k,yri)
s(i,j,k,yri) = s(i,j,l,yri)
s(i,j,l,yri) = temp
endif
enddo
enddo
enddo
enddo
enddo
do j=1,nj
do i=1,ni
do yri=1,30
d=m(i,j,yri)
jjj(i,j,yri)=nint(0.95*d+(1+0.95)/3.0)
rrr(i,j,yri)=(0.95*d+(1+0.95)/3.0)-jjj(i,j,yri)
jjjj(i,j,yri)=jjj(i,j,yri)+1
yyy(i,j,yri)=(1-rrr(i,j,yri))*s(i,j,jjj(i,j,yri),yri)+rrr(i,j,yri)*s(i,j,jjjj(i,j,yri),yri)
ss(i,j)=ss(i,j)+yyy(i,j,yri)
enddo
ss(i,j)=ss(i,j)/30.0
enddo
enddo
do j=1,nj
do i=1,ni
do yri=1,30
d=m(i,j,yri)
do k=1,d
if(s(i,j,k,yri).gt.ss(i,j))then
nnn(i,j)=nnn(i,j)+1
endif
enddo
enddo
nnn(i,j)=nnn(i,j)/30.0
enddo
enddo
open(100,file='G:\GENGDI\precise daily data\gengdi precise work\gengdi result\A1B\A1B-baseline-fepe.txt')
write(100,*)'fepe',',','x',',','y'
do ii=1,ni
do jj=1,nj
if(zone(ii,jj)/=0)then
write(100,'(f10.3,1a,f10.3,1a,f10.3)')nnn(ii,jj),',',xlon(ii,jj),',',xlat(ii,jj)
endif
enddo
enddo
end
|