!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer,
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer
!version 3 or (at your option) any later version that should be found at:
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software;
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec),
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
!
!
!  X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
!

      subroutine idft1d(pgd,psp,psdft1d,klen1d,kni) 2,1
!
!Author: Luc Fillion - CGD/NCAR - 23 sept 2002
!           
!Revision : L. Fillion - MSC - 06 jul 04
!                      - Update to NCAR fft: fftpack5
!
      IMPLICIT NONE
!implicits
#include "taglam4d.cdk"
#include "comdim.cdk"
#include "comfftla.cdk"
!
      integer kni,klen1d
      real*8 pgd(kni)
      real*8 psp(kni/2+1,2)
      real*8 psdft1d(klen1d)
!
      integer ji,ila,ier,ilenwrk,ind
      real*8 za(2*(kni/2+1))
      real*8 zwork(2*(kni/2+1))
!
!!
      ilenwrk=2*(kni/2+1)
      do ji=1,kni/2+1
        ind=2*(ji-1)+1
        za(ind)=psp(ji,1)
        za(ind+1)=psp(ji,2)
      enddo
      call rfft2b_8(2*(kni/2+1),kni,1,za,psdft1d,klen1d,zwork,
     &                 ilenwrk,ier)
!
      do ji=1,kni
        pgd(ji)=za(ji)
      enddo
!
      return
      end