[Fortran] 纯文本查看 复制代码
Program main
Integer:: nx=240, ny=121,nt=31,i,j,m,k
real surp(240,121,31,30),dp(240,121,31)
character:: filename, year
do k=1981,2010
write(year,'(i4)') k
filename=year//'.bin'
open(11,file='F:\cut\surp-\'//filename,form='binary')
do m=1,nt
do j=1,ny
do i= 1,nx
read(12)surp(i,j,m,k-1980)
enddo
enddo
enddo
Close(11)
enddo
do i= 1,nx
do j= 1,ny
do m= 1 ,nt
ss=0.0
do k = 1,30
ss= ss+surp(i,j,m,k)
enddo
dp(i,j,m)=ss/30.0
enddo
enddo
enddo
open(12,file='F:\surp.interim.daily.climato.bin',form='binary')
write(12)(((dp(i,j,m),i=1,240),j=1,121),m=1,31)
End Program main