program PWREFIND C Calculating averages integer RD,rns,runs,ILAT,ILON,kgit,nvar PARAMETER (runs=12) PARAMETER (ILAT=36) PARAMETER (ILON=64) parameter (kgit=56) parameter (nvar=3) real, dimension(ILAT,ILON,kgit,nvar)::aus,rea real, dimension(runs,ILAT,ILON,kgit,nvar)::aus1 character fileout*80 integer prog CHARACTER*5 jfilein(12) c=========================input file & computing area==================================== fileout = 'test.dat' open(20,file=fileout) DATA jfilein/'120l_','121l_','122l_','123l_','124l_','125l_' &,'126l_','127l_','128l_','129l_','130l_','131l_'/ c================== DATA OUTPUT ================================= open (71,status='unknown',form='unformatted',file= + 'uvt400_Jan_ogw_volf.dx', access='direct', + recl=nvar*ILON*ILAT*kgit*4) do rns = 1,runs RD = rns+20 OPEN (RD, FILE= "../" //jfilein(rns)// "/uvt400_Jan_ogw_volf.dx", $ form='unformatted', * access='direct', status='old',recl=nvar*ILON*ILAT*kgit*4) print*,"open: ../" //jfilein(rns)// "/uvt400_Jan_ogw_volf.dx" end do DO prog = 1,1201 print*,"step: ", prog c================== INPUT ================================= do rns = 1,runs RD = rns+20 read(RD,rec=prog) rea do p=1,nvar do j=1,ILAT do h=1,kgit do i=1,ILON aus1(rns,j,i,h,p)=rea(j,i,h,p) end do end do end do end do enddo c================================================================ do p=1,nvar do j=1,ILAT do h=1,kgit do i=1,ILON do rns = 1,runs aus(j,i,h,p)=aus(j,i,h,p)+aus1(rns,j,i,h,p)/runs end do end do end do end do end do write(71,rec=prog) aus do p=1,nvar do j=1,ILAT do h=1,kgit do i=1,ILON aus(j,i,h,p)=0. do rns = 1,runs aus1(rns,j,i,h,p)=0. end do end do end do end do end do END DO c============reset all, close all etc ============================== do rns = 1,runs RD = rns+20 close(RD) end do close(71) print*,'Processing completed! ' print*,'Open your output files! ' STOP END *************************************************************************