       PROGRAM pci_noan
       PARAMETER (N=14610,NFIL=365,NEOF=6,NREC1=1,NREC2=4)
       PARAMETER (NPCS=1)
       real xpi
       REAL time(n),pcs(n,npcs),pcf(n),pcm(npcs)
       real filter(nfil,neof),pc(n,neof)

       open(10,file='../input/z700_atl1.txt', 
     *         form='formatted')
       open(13,
     *      file='../out_nhe/z700_atl1_3d.noa',
     *         form='formatted')
       open(14,
     *      file='../out_nhe/z700_atl1_3d.dat',
     *         form='formatted')

c  initialisation

       xpi=acos(-1.)

       print *,' xpi=',xpi

       do i=1,nfil
       filter(i,1)=cos(2.*xpi*(i-1)/(float(nfil)+0.25))
       filter(i,2)=sin(2.*xpi*(i-1)/(float(nfil)+0.25))
       filter(i,3)=cos(4.*xpi*(i-1)/(float(nfil)+0.25))
       filter(i,4)=sin(4.*xpi*(i-1)/(float(nfil)+0.25))
       filter(i,5)=cos(6.*xpi*(i-1)/(float(nfil)+0.25))
       filter(i,6)=sin(6.*xpi*(i-1)/(float(nfil)+0.25))
       enddo

       do ne=1,neof
       sum=0
       do i=1,nfil
       sum=sum+filter(i,ne)**2
       enddo
       do i=1,nfil
       filter(i,ne)=filter(i,ne)/sum
       enddo
       enddo

c  read set

       do np=1,npcs
         pcm(np)=0.
       enddo
       do i=1,n
       read(10,*)time(i),(pcs(i,np),np=1,npcs)
       do np=1,npcs
         pcm(np)=pcm(np)+pcs(i,np)/float(n)
       enddo
       enddo
       do np=1,npcs
       do i=1,n
       pcs(i,np)=pcs(i,np)-pcm(np)
       enddo
       enddo


       do np=1,1
       IU=12+np

       do ne=1,neof
       do i=1,n-nfil+1
       pc(i,ne)=0.
       do j=1,nfil
       pc(i,ne)=pc(i,ne)+filter(j,ne)*pcs(i+j-1,np)
       enddo
       enddo
       enddo

       do i=nfil,n-nfil+1
       pcf(i)=0.
       do ne=1,neof
       do j=1,nfil
       pcf(i)=pcf(i)+filter(j,ne)*pc(i-j+1,ne)/2.
       enddo
       enddo
       enddo

       do i=nfil,n-nfil+1
       if(i.gt.365.25*3..and.i.le.365.25*39.and.mod(i,3).eq.1)then
       write(IU,*) time(i),(pcs(i-1,np)-pcf(i-1)
     C                     +pcs(i  ,np)-pcf(i  )
     C                     +pcs(i+1,np)-pcf(i+1))/3.
       write(IU+1,*) time(i),(pcs(i-1,np)
     C                       +pcs(i  ,np)
     C                       +pcs(i+1,np))/3.
       endif
       enddo

       enddo

       stop
       end
       

