      SUBROUTINE GWAQD (DQ,LSR,LA,LM,UGG,VGG,ILG1,ILH,ILAT,SL,WOSSL,
     1               ALP,DALP,EPSI,WRKL,TRANCHE,ILEV,IFAX,TRIGS)
C 
C     * JUL 14/92 - E. CHAN (ADD REAL*8 DECLARATIONS)
C     * JAN 26/84 - B.DUGAS.
C     * CALCULATES DIVERGENCE AND VORTICITY IN DQ (IN THAT ORDER) FROM
C     * MULTI-LEVEL U AND V WINDS IN UGG,VGG(ILG1,ILAT,ILEV). 
C     * NOTE THAT U,V ARE ACTUALLY U,V*COS(LAT)/(EARTH RADIUS) AND
C     * DQ IS COMPLEX DIMENSIONNED (LA,ILEV*2)
C 
C     * LSR CONTAINS SPECTRAL ROW LENGTH INFO.
C     * SL(ILAT) CONTAINS SIN(LAT) (S TO N).
C     * WOSSL(ILAT) CONTAINS (GAUSSIAN WEIGHTS)/(SIN(LAT)**2).
C     * ALP IS A WORK FIELD FOR LEGENDRE POLYNOMIALS. 
C     * DALP IS FOR N-S DERIVATIVES OF ALP. 
C     * EPSI CONTAINS PRECOMPUTED CONSTANTS.
C     * WRKS,TRANCHE ARE WORK FIELDS OF ILH*ILEV*2 COMPLEX WORDS. 
C     * FFT REQUIRES THAT TRIGS AND IFAX BE DETERMINED BY FTSETUP.
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      COMPLEX DQ(LA,1)
      DIMENSION WRKL(2,ILH,1),TRANCHE(2,ILH,1)
      REAL UGG(ILG1,ILAT,1),VGG(ILG1,ILAT,1)
      REAL*8 ALP(1),DALP(1),EPSI(1) 
      REAL*8 SL(1),WOSSL(1),WEIGHT
      REAL TRIGS(1)
      INTEGER LSR(2,1),IFAX(1)
C---------------------------------------------------------------------
      ILG=ILG1-1
      ILH2=ILH*2
      ILEV2=ILEV*2
      ILGH=ILG/2
C 
C     * INITIALIZE Q,D TO ZERO. 
C 
      NP=(LSR(1,LM+1)-1)*ILEV2
      CALL SCOF2(DQ,NP,1,0) 
C 
C     * CALCULATE THE CONTRIBUTION TO DQ ONE LATITUDE AT A TIME.
C 
      DO 50 J=1,ILAT
      WEIGHT=WOSSL(J) 
C 
      DO 10 L=1,ILEV
C 
         DO 10 M=1,ILGH 
            TRANCHE(1,M,L)     =VGG(2*M-1,J,L)
            TRANCHE(2,M,L)     =VGG(2*M  ,J,L)
            TRANCHE(1,M,L+ILEV)=UGG(2*M-1,J,L)
            TRANCHE(2,M,L+ILEV)=UGG(2*M  ,J,L)
   10 CONTINUE
C 
C     * COMPUTE ALP AND DALP. 
C 
      CALL ALPST2(ALP, LSR,LM,SL(J),EPSI) 
      CALL ALPDY2(DALP,ALP, LSR,LM,EPSI)
C 
C     * FAST REQUIRES ALP*WEIGHT. 
C 
      DO 20 L=1,LA+LM 
         ALP(L) = ALP(L)*WEIGHT 
         DALP(L)=DALP(L)*WEIGHT 
   20 CONTINUE
C 
C     * CALCULATE V(M) AND U(M) AT ALL LEVELS.
C 
      CALL FFWFG (TRANCHE,ILH,TRANCHE,ILH2,LM-1,ILG,WRKL, 
     1            ILEV2,IFAX,TRIGS) 
C 
C     * PUT DU(M)/DX AND DV(M)/DX IN WRKL. MULTIPLY V(M)
C     * BY -1 IN TRANCHE. 
C 
      DO 40 M=1,LM
         AM=FLOAT(M-1)
C 
C
C 
         DO 30 L=1,ILEV 
            WRKL(1,M,L)     =-AM*TRANCHE(2,M,L+ILEV)
            WRKL(2,M,L)     = AM*TRANCHE(1,M,L+ILEV)
            WRKL(1,M,L+ILEV)=-AM*TRANCHE(2,M,L) 
            WRKL(2,M,L+ILEV)= AM*TRANCHE(1,M,L) 
   30    CONTINUE 
         DO 40 L=1,ILEV 
            TRANCHE(1,M,L)=-TRANCHE(1,M,L)
            TRANCHE(2,M,L)=-TRANCHE(2,M,L)
   40 CONTINUE
C 
C     * FIRST PUT INTO QD THE CONTRIBUTION OF D/DX AND THEN 
C     * THE CONTRIBUTION OF D/DY. 
C 
      CALL FAST (DQ,WRKL   ,LSR,LM,LA,ILH,ILEV2, ALP) 
      CALL FAST (DQ,TRANCHE,LSR,LM,LA,ILH,ILEV2,DALP) 
C 
   50 CONTINUE
C 
C-------------------------------------------------------------------
      RETURN
      END 
