      subroutine dgfiltr(dt,tauss,taucc)

      include 'slgcm.slgprm'
      include 'slgcm.slgprg'
      include 'slgcm.slgcon'

      dimension uor(imp3,jm), vor(imp3,jm), gtpor(imp3,jm)
      dimension hf(0:1000)

      integer dt
      logical first

      taus = tauss*3600.0
      tauc = taucc*3600.0

      rdt = dt
      nin = taus/(2.0*rdt)
      thetac = pi*taus/(nin*tauc)


      hf(0) = thetac/pi
      temh = hf(0)

      do i=1,nin
         tem1 = float(i)*pi/float(nin+1)
         hf(i) = (sin(tem1)/tem1)
     #          *(sin(float(i)*thetac)/(float(i)*pi))
         temh = temh + 2.0*hf(i)
      enddo

      do i = 0, nin
         hf(i) = hf(i)/temh
      enddo

      print*, ' nin =', nin, ' temh =',temh, '  thetac=', thetac

      do i=0, nin
         print*, 'i=', i, '   hf(i)=', hf(i)
      enddo

c      do j1x = 1, ijm0m0
c         uor(j1x,1) = hf(0)*un0(j1x,1)
c         vor(j1x,1) = hf(0)*vn0(j1x,1)
c         gtpor(j1x,1) = hf(0)*gtp(j1x,1)
c      end do
       do j=1,jm
       do i=1,imp3
         uor(i,j) = hf(0)*un0(i,j)
         vor(i,j) = hf(0)*vn0(i,j)
         gtpor(i,j) = hf(0)*gtp(i,j)
       enddo
       enddo

      call condt(dt)
      first = .true.
      do n = 1, nin
         call step(rdt,first)
c      do j1x = 1, ijm0m0
c         uor(j1x,1) = hf(n)*un0(j1x,1) + uor(j1x,1)
c         vor(j1x,1) = hf(n)*vn0(j1x,1) + vor(j1x,1)
c         gtpor(j1x,1) = hf(n)*gtp(j1x,1) + gtpor(j1x,1)
c      end do
       do j=1,jm
       do i=1,imp3
         uor(i,j) = hf(n)*un0(i,j) + uor(i,j)
         vor(i,j) = hf(n)*vn0(i,j) + vor(i,j)
         gtpor(i,j) = hf(n)*gtp(i,j) + gtpor(i,j)
       enddo
       enddo

      enddo

      mdt = dt
      dt = -mdt
      rdt = dt

      call condt(dt)
      first = .true.
      do n = 1, nin
         call step(rdt,first)
c      do j1x = 1, ijm0m0
c         uor(j1x,1) = hf(n)*un0(j1x,1) + uor(j1x,1)
c         vor(j1x,1) = hf(n)*vn0(j1x,1) + vor(j1x,1)
c         gtpor(j1x,1) = hf(n)*gtp(j1x,1) + gtpor(j1x,1)
c      end do
       do j=1,jm
       do i=1,imp3
         uor(i,j) = hf(n)*un0(i,j) + uor(i,j)
         vor(i,j) = hf(n)*vn0(i,j) + vor(i,j)
         gtpor(i,j) = hf(n)*gtp(i,j) + gtpor(i,j)
       enddo
       enddo

      enddo
      
      first = .true.
      dt = mdt

c      do j1x = 1, 13377
c         un0(j1x,1) = uor(j1x,1)
c         vn0(j1x,1) = vor(j1x,1)
c         gtp(j1x,1) = gtpor(j1x,1)
c      end do
       do j=1,jm
       do i=1,imp3
         un0(i,j) = uor(i,j)
         vn0(i,j) = vor(i,j)
         gtp(i,j) = gtpor(i,j)
       enddo
       enddo


      return
      end


