      SUBROUTINE LLCAL(DLAT1,DLON1,DLAT2,DLON2,DGRW,I1,J1,I2,J2,SLAT, 
     1                 SLON,ILG1,ILAT,NBAD) 

C     * AUG 13/90 - M.LAZARE. REMOVE HARD-COAT OF SLON BY PASSING IN
C     *                       CALL. 
C     * AUG 10/87 - M.SUTCLIFFE 
C 
C     * GIVEN LAT-LON COORDINATES OF AN AREA, FIND THE INPUT GRID INDICES 
C     * CLOSEST TO THESE COORDINATES. ADJUST THE LAT-LON COORDINATES
C     * TO MATCH EXACTLY THE GRID COORDINATES OF THE INDICES. 
C     * ALSO CALCULATE DGRW, THE CENTRE LONGITUDE OF THE AREA.
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      REAL SLAT(ILAT),SLON(ILG1)
C 
C-------------------------------------------------------------------------- 
C 
      NBAD=0
      IF (DLAT1.GE.DLAT2)                   NBAD=1
      IF (DLAT1.LT.-90.E0 .OR. DLAT1.GT.90.E0)  NBAD=2
      IF (DLAT2.LT.-90.E0 .OR. DLAT2.GT.90.E0)  NBAD=3
      IF (DLON1.LT.-180.E0 .OR. DLON1.GT.180.E0)NBAD=4
      IF (DLON2.LT.-180.E0 .OR. DLON2.GT.180.E0)NBAD=5
      IF (NBAD.NE.0) RETURN 
C 
      IF (DLON1.LT.0.E0) DLON1=360.E0+DLON1
      IF (DLON2.LT.0.E0) DLON2=360.E0+DLON2
      DLAT1=90.E0+DLAT1 
      DLAT2=90.E0+DLAT2 
C 
C     * CALCULATE LONGITUDES AT EACH GRID POINT 
  
      DO 120 J=1,ILG1 
         SLON(J)=FLOAT(J-1)*360.E0/FLOAT(ILG1-1)
 120  CONTINUE
C 
C     * FIND THE CORRESPONDING INPUT GRID X CO-ORDINATES
C 
      I1=1
      I2=ILG1 
      DO 130 J=1,ILG1-1 
         IF (SLON(J).LE.DLON1 .AND. SLON(J+1).GE.DLON1) I1=J
         IF (SLON(J).LE.DLON2 .AND. SLON(J+1).GE.DLON2) I2=J
 130  CONTINUE
C 
      IF (SLON(I1+1)-DLON1 .LT. DLON1-SLON(I1)) I1=I1+1 
      IF (SLON(I2+1)-DLON2 .LT. DLON2-SLON(I2)) I2=I2+1 
C 
      DLON1=SLON(I1)
      DLON2=SLON(I2)
C 
C     * FIND THE CORRESPONDING INPUT GRID Y INDICES 
C 
      J1=1
      J2=ILAT 
      DO 140 J=1,ILAT-1 
        IF (SLAT(J).LE.DLAT1 .AND. SLAT(J+1).GT.DLAT1) J1=J 
        IF (SLAT(J).LE.DLAT2 .AND. SLAT(J+1).GT.DLAT2) J2=J 
 140  CONTINUE
C 
      IF (J1.NE.1) THEN 
        IF (SLAT(J1+1)-DLAT1.LT.DLAT1-SLAT(J1)) J1=J1+1 
      ENDIF 
      IF (J2.NE.ILAT) THEN
        IF (SLAT(J2+1)-DLAT2.LT.DLAT2-SLAT(J2)) J2=J2+1 
      ENDIF 
C 
      DLAT1=SLAT(J1)
      DLAT2=SLAT(J2)
C 
C     * CALCULATE THE CENTRE LONGITUDE OF THE CHOSEN AREA 
C 
      DGRW = 0.5E0*(DLON1+DLON2) 
      IF (I1.GE.I2) THEN
        IF (DGRW.LT.180.E0) THEN
          DGRW=DGRW+180.E0
        ELSE
          DGRW=DGRW-180.E0
        ENDIF 
      ENDIF 
      IF (DGRW.GE.180.E0) DGRW=DGRW-360.E0
C 
      DLAT1=DLAT1-90.E0 
      DLAT2=DLAT2-90.E0 
      IF (DLON1.GT.180.E0) DLON1=DLON1-360.E0 
      IF (DLON2.GT.180.E0) DLON2=DLON2-360.E0 
C 
      RETURN
      END 
