      SUBROUTINE STAPS2(G,NI,NJ,IP,JP,D60,DGRW,NHEM, P,LSR,LM,
     1                       ALP,EPSI,WRKL) 
C 
C     * FEB 24/93 - E. CHAN (CHANGE EXPONENT OF GFILL TO E38)
C     * JUL 14/92 - E. CHAN (ADD REAL*8 DECLARATIONS)
C     * DEC  8/80 - J.D.HENDERSON 
C     * CALCULATES POLAR STEREOGRAPHIC GRID G(NI,NJ) WITH POLE (IP,JP)
C     *  FROM COMPLEX SPECTRAL COEFF IN P(LR,LM). 
C     * GRID SIZE IS D60 (M) AT LATITUDE 60 DEG.
C     * GRID ORIENTATION HAS GREENWICH MERIDIAN AT DGRW (DEGREES).
C 
C     * ALP IS A WORK FIELD FOR LEGENDRE POLYNOMIALS. 
C     * EPSI IS A FIELD OF CONSTANTS THE SAME SIZE AS ALP.
C     * WRKL IS AN LCM WORK FIELD OF LM COMPLEX WORDS.
C 
C     * LEVEL 2, G,P,ALP,EPSI,WRKL
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      COMPLEX P(1)
      REAL G(NI,NJ),WRKL(1)
      REAL*8 ALP(1),EPSI(1),SINLAT
      INTEGER LSR(2,1)
C-----------------------------------------------------------------------
      DRCON=3.14159E0/180.E0
      MAXF=LM-1 
C 
C     * SET GRID TO LARGE INITIAL VALUE.
C 
      GFILL=1.11E+38
      DO 10 J=1,NJ
      DO 10 I=1,NI
   10 G(I,J)=GFILL
C 
C     * LOOP OVER THE ENTIRE GRID.
C 
      DO 20 J=1,NJ
      JY=J-JP 
      YP=JY 
      DO 20 I=1,NI
      IX=I-IP 
      XP=IX 
      IF(G(I,J).NE.GFILL) GO TO 20
C 
C     * OBTAIN THE LATITUDE OF POINT (I,J) AND GET THE FOURIER COEFF
C     *  FOR THAT LAT FROM THE SPECTRAL COEFF IN P. 
C 
      CALL LLFXY(DLAT,DLON,XP,YP,D60,DGRW,NHEM) 
      SINLAT=SIN(DLAT*DRCON)
      CALL ALPST2(ALP,LSR,LM,SINLAT,EPSI) 
      CALL STAF2(WRKL,P,LSR,LM,ALP) 
C 
C     * GET THE COORDINATES OF EACH OF THE POSSIBLE EIGHT POINTS
C     *  IN THE GRID THAT LIE ON THE GIVEN LAT CIRCLE.
C 
      II=IP+IX
      JJ=JP+JY
      X=XP
      Y=YP
      ASSIGN 12 TO NPT
      GO TO 19
   12 II=IP-IX
      X=-XP 
      ASSIGN 13 TO NPT
      GO TO 19
   13 JJ=JP-JY
      Y=-YP 
      ASSIGN 14 TO NPT
      GO TO 19
   14 II=IP+IX
      X=XP
      ASSIGN 15 TO NPT
      GO TO 19
C 
   15 II=IP+JY
      JJ=JP+IX
      X=YP
      Y=XP
      ASSIGN 16 TO NPT
      GO TO 19
   16 II=IP-JY
      X=-YP 
      ASSIGN 17 TO NPT
      GO TO 19
   17 JJ=JP-IX
      Y=-XP 
      ASSIGN 18 TO NPT
      GO TO 19
   18 II=IP+JY
      X=YP
      ASSIGN 20 TO NPT
C 
C     * MAKE SURE POINT IS BOTH INSIDE GRID AND NOT ALREADY DONE. 
C     * GET LONGITUDE AND EVALUATE FOURIER SERIES AT THAT POINT.
C 
   19 IF(II.LT.1.OR.II.GT.NI) GO TO 195 
      IF(JJ.LT.1.OR.JJ.GT.NJ) GO TO 195 
      IF(G(II,JJ).NE.GFILL) GO TO 195 
      CALL LLFXY(DLAT,DLON,X,Y,D60,DGRW,NHEM) 
      RLON=DLON*DRCON 
      CALL CFVAL2( GIJ  ,WRKL,MAXF,RLON)
      G(II,JJ)=GIJ
  195 GO TO NPT,(12,13,14,15,16,17,18,20) 
   20 CONTINUE
C 
      RETURN
      END 
