!-------------------------------------- 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 idft2d(pgd,psp,psdft2d,knindxy,kjk, 3,1
& klen2d,knla,kni,knj,knksdim)
!
!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,knj,knksdim,knla,kjk,klen2d
integer knindxy(kni/2+1,knj)
real*8 pgd(kni,knksdim,knj)
real*8 psp(knla,2,knksdim)
real*8 psdft2d(klen2d)
!
integer ji,jj,ila,ier,ilenwrk,ind
real*8 zcon
real*8 za(2*(kni/2+1),knj)
real*8 zwork(2*(kni/2+1)*knj)
!
!!
ilenwrk=2*(kni/2+1)*knj
do ji=1,kni/2+1
ind=2*(ji-1)+1
do jj=1,knj
ila=knindxy(ji,jj)
za(ind,jj)=psp(ila,1,kjk)
za(ind+1,jj)=psp(ila,2,kjk)
enddo
enddo
call rfft2b_8
(2*(kni/2+1),kni,knj,za,psdft2d,klen2d,zwork,
& ilenwrk,ier)
c
do ji=1,kni
do jj=1,knj
pgd(ji,kjk,jj)=za(ji,jj)
enddo
enddo
!
return
end