C-------------------------------------------------------------------------------
      SUBROUTINE SPGGET(IDRT,IMAX,JMAX,CLAT,SLAT,WLAT,TRIG,IFAX)
C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM:  SPGGET     GET GRID-SPACE CONSTANTS
C   PRGMMR: IREDELL       ORG: W/NMC23       DATE: 96-02-29
C
C ABSTRACT: THIS SUBPROGRAM GETS GRID-SPACE CONSTANTS.
C
C PROGRAM HISTORY LOG:
C   96-02-29  IREDELL
C   98-06-30  EBISUZAKI    LINUX PORT
C
C USAGE:    CALL SPGGET(IDRT,IMAX,JMAX,CLAT,SLAT,WLAT,TRIG,IFAX)
C   INPUT ARGUMENTS:
C     IDRT     - INTEGER GRID IDENTIFIER
C                (IDRT=4 FOR GAUSSIAN GRID,
C                 IDRT=0 FOR EQUALLY-SPACED GRID INCLUDING POLES,
C                 IDRT=256 FOR EQUALLY-SPACED GRID EXCLUDING POLES)
C     IMAX     - INTEGER NUMBER OF LONGITUDES.
C     JMAX     - INTEGER NUMBER OF LATITUDES.
C   OUTPUT ARGUMENTS:
C     CLAT     - REAL (JMAX) COSINES LATITUDE
C     SLAT     - REAL (JMAX) SINES LATITUDE
C     WLAT     - REAL (JMAX) GAUSSIAN WEIGHTS
C     TRIG     - REAL (2*IMAX) FFT TRIG VALUES
C     IFAX     - INTEGER (20) FFT FACTORS
C
C SUBPROGRAMS CALLED:
C   SPLAT        COMPUTE LATITUDE FUNCTIONS
C   FFTFAX       COMPUTE FFT CONSTANTS
C
C ATTRIBUTES:
C   LANGUAGE: FORTRAN 77
C
C$$$
      REAL CLAT(JMAX),SLAT(JMAX),WLAT(JMAX),TRIG(2*IMAX)
      INTEGER IFAX(20)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      CALL SPLAT(IDRT,JMAX,SLAT,WLAT)
      JHE=(JMAX+1)/2
      IF(JHE.GT.JMAX/2) WLAT(JHE)=WLAT(JHE)/2
      do ii = 1, jmax
        CLAT(ii)=SQRT(1.-SLAT(ii)**2)
      end do
      CALL FFTFAX(IMAX,IFAX,TRIG)
      END
