C-----------------------------------------------------------------------
      SUBROUTINE GDSAWT(KGDS,KB,KA,XPTS,YPTS,RLAT,RLON,AWT)
C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM:  GDSAWT     GRID DESCRIPTION SECTION AREA WEIGHTS
C   PRGMMR: IREDELL       ORG: W/NMC23       DATE: 96-04-10
C
C ABSTRACT: THIS SUBPROGRAM DECODES THE GRIB GRID DESCRIPTION SECTION
C           AND RETURNS THE EARTH'S AREA COVERED BY EACH GRID POINT.
C           THE GRID AND EARTH COORDINATES ARE ALSO RETURNED.
C           THE AREA OF EACH GRID POINT IS ESTIMATED BY MULTIPLYING
C           THE GREAT CIRCLE DISTANCE BETWEEN GRIDPOINTS ON EITHER SIDE
C           IN THE X DIRECTION BY THE DISTANCE BETWEEN GRIDPOINTS
C           ON EITHER SIDE IN THE Y DIRECTION AND DIVIDING BY 4.
C           NOTE THAT FOR REGIONAL GRIDS, EDGE POINTS GENERALLY
C           REPRESENT ABOUT HALF THE AREA OF MIDDLE POINTS AND CORNER
C           POINTS REPRESENT ABOUT QUARTER THE AREA OF MIDDLE POINTS.
C
C PROGRAM HISTORY LOG:
C   96-04-10  IREDELL
C
C USAGE:    CALL GDSWIZ(KGDS,KB,KA,XPTS,YPTS,RLAT,RLON,AWT)
C
C   INPUT ARGUMENT LIST:
C     KGDS     - INTEGER (200) GDS PARAMETERS AS DECODED BY W3FI63
C     KB       - INTEGER MAXIMUM NUMBER OF COORDINATES
C
C   OUTPUT ARGUMENT LIST:
C     KA       - INTEGER NUMBER OF VALID POINTS COMPUTED
C     XPTS     - REAL (KB) GRID X POINT COORDINATES
C     YPTS     - REAL (KB) GRID Y POINT COORDINATES
C     RLON     - REAL (KB) EARTH LONGITUDES IN DEGREES
C     RLAT     - REAL (KB) EARTH LATITUDES IN DEGREES N
C     AWT      - REAL (KB) AREA WEIGHTS IN M**2
C
C SUBPROGRAMS CALLED:
C   GDSWIZ       GRID DESCRIPTION SECTION WIZARD
C   (IJKGDS)     RETURN FIELD POSITION FOR A GIVEN GRID POINT
C   (GCDIST)     COMPUTE GREAT CIRCLE DISTANCE
C
C ATTRIBUTES:
C   LANGUAGE: FORTRAN 77
C
C$$$
CFPP$ EXPAND(IJKGDS,GCDIST)
      INTEGER KGDS(200)
      REAL XPTS(KB),YPTS(KB),RLAT(KB),RLON(KB),AWT(KB)
      PARAMETER(FILL=-9999.)
      INTEGER N1(KB)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C  GET GRID AND EARTH COORDINATES
      CALL GDSWIZ(KGDS,0,KB,FILL,XPTS,YPTS,RLON,RLAT,KA,0,CROT,SROT)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C  FIND NEAREST POINT TO THE 'WEST'.
      DO N=1,KA
        I=NINT(XPTS(N))
        J=NINT(YPTS(N))
        N1(N)=IJKGDS(I-1,J,KGDS)
        IF(N1(N).EQ.0) N1(N)=N
      ENDDO
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C  FIND NEAREST POINT TO THE 'EAST' AND COMPUTE DISTANCE.
      DO N=1,KA
        I=NINT(XPTS(N))
        J=NINT(YPTS(N))
        N2=IJKGDS(I+1,J,KGDS)
        IF(N2.EQ.0) N2=N
        TDI=GCDIST(RLAT(N1(N)),RLON(N1(N)),RLAT(N2),RLON(N2))
        AWT(N)=TDI
      ENDDO
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C  FIND NEAREST POINT TO THE 'SOUTH'.
      DO N=1,KA
        I=NINT(XPTS(N))
        J=NINT(YPTS(N))
        N1(N)=IJKGDS(I,J-1,KGDS)
        IF(N1(N).EQ.0) N1(N)=N
      ENDDO
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C  FIND NEAREST POINT TO THE 'NORTH' AND COMPUTE DISTANCE AND AREA.
      DO N=1,KA
        I=NINT(XPTS(N))
        J=NINT(YPTS(N))
        N2=IJKGDS(I,J+1,KGDS)
        IF(N2.EQ.0) N2=N
        TDI=AWT(N)
        TDJ=GCDIST(RLAT(N1(N)),RLON(N1(N)),RLAT(N2),RLON(N2))
        AWT(N)=0.25*TDI*TDJ
      ENDDO
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      END
