[Fortran] 纯文本查看 复制代码
program test
implicit none
integer,parameter::nx=144,ny=73,nz=17,nt=12
real,dimension(nx,ny,nz,nt)::uwnd,vwnd
integer::ii,jj,kk,tt,irec
open(21,file='D:\workspace\work2\uwnd.mon.ltm.dat',form='unformatted',access='direct',recl=nx*ny)
open(22,file='D:\workspace\work2\vwnd.mon.ltm.dat',form='unformatted',access='direct',recl=nx*ny)
open(23,file='D:\workspace\work2\uvwnd.dat',status='replace',form='unformatted',access='direct',recl=nx*ny)
irec=1
do tt=1,nt
do kk=1,nz
read(21,rec=irec) ((uwnd(ii,jj,kk,tt),ii=1,nx),jj=1,ny)
irec=irec+1
end do
end do
irec=1
do tt=1,nt
do kk=1,nz
read(22,rec=irec) ((vwnd(ii,jj,kk,tt),ii=1,nx),jj=1,ny)
irec=irec+1
print*,irec
end do
end do
irec=1
do tt=1,nt
do kk=1,nz
write(23,rec=irec) ((uwnd(ii,jj,kk,tt),ii=1,nx),jj=1,ny)
irec=irec+1
end do
do kk=1,nz
write(23,rec=irec) ((vwnd(ii,jj,kk,tt),ii=1,nx),jj=1,ny)
irec=irec+1
end do
end do
close(21)
close(22)
close(23)
end program test