      SUBROUTINE W2GPXY
     I(MEND1,NEND1,JEND1,MNWAV,IMAX,JMAX,IMX ,JMAXHF,
     I IFAX ,TRIGS,PNM  ,DPNM ,IPXY,IPSL,QPAI,
     O GDAT ,
     W GWRK)
C
      DIMENSION QPAI(2,MNWAV)

c990408
c      DIMENSION IFAX(10),TRIGS(500)
      DIMENSION IFAX(10),TRIGS(IMAX)
C...WARNING: THE DIMENSION OF GDAT,GWRK SHOULD BE .GE. IMX*JMAX*3
C            IMX=IMAX+2
      DIMENSION GDAT(IMAX,JMAX,3) ,GWRK(IMAX,JMAX,3)
      DIMENSION PNM (MNWAV,JMAXHF),DPNM(MNWAV,JMAXHF)
C...IPXY=1; OUTPUT OF THIS SUBR. IS  PS,D(PS)/DX,D(PS)/DY
C...     0;                          PS
C
      CALL LGNW2G
     I(MEND1,NEND1,JEND1,MNWAV,IMAX,JMAX,JMAXHF,   1,   1, PNM,QPAI,
     O GDAT ,
     W GWRK)
      LOT=JMAX
      IF(IPXY.EQ.1) THEN
      CALL LGNW2G
     I(MEND1,NEND1,JEND1,MNWAV,IMAX,JMAX,JMAXHF,   1,   0,DPNM,QPAI,
     O GDAT(1,1,3),
     W GWRK)
      DO 100 J=1,JMAX
      DO 100 M=1,MEND1
      GDAT(2*M-1,J,2)=-FLOAT(M-1)*GDAT(2*M  ,J,1)
      GDAT(2*M  ,J,2)=+FLOAT(M-1)*GDAT(2*M-1,J,1)
  100 CONTINUE
      DO 120 J=1,JMAX
      DO 120 I=2*MEND1+1,IMAX
      GDAT(I,J,2)=0.0
      GDAT(I,J,3)=0.0
  120 CONTINUE
      LOT=JMAX*3
      END IF
C
      CALL FFT991(GDAT,TRIGS,IFAX,1,IMX,IMAX,LOT,1)
C     CALL FFT991(GDAT,GWRK,TRIGS,IFAX,1,IMX,IMAX,LOT,1)
C
      IF(IPSL.EQ.1) THEN
      DO 200 J=1,JMAX
      DO 200 I=1,IMAX
      X          =        EXP(GDAT(I,J,1))
      GDAT(I,J,1)=X
      GDAT(I,J,2)=GDAT(I,J,2)*X
      GDAT(I,J,3)=GDAT(I,J,3)*X
  200 CONTINUE
      END IF
C
      RETURN
      END SUBROUTINE W2GPXY

