      SUBROUTINE IJ2LL (XI,YJ,YLAT,WLON)
C$$$  SUBPROGRAM DOCUMENTATION BLOCK
C                .      .    .                                       .
C SUBPROGRAM:    IJ2LL       CONVERT GRID XI,YJ TO LAT-LONG
C   PRGMMR: DIMEGO           ORG: W/NMC22    DATE: 88-03-31
C
C ABSTRACT: CONVERT GRID INDEX XI,YJ TO LATITUDE-LONGITUDE
C   USING GRID-DEFINITION INFO. FROM COMMON BLOCK /GRID/
C
C PROGRAM HISTORY LOG:
C   83-03-31  DIMEGO
C   88-06-30  DIMEGO      DOCBLOCK HALF / PL1 / FTN200
C
C USAGE:    CALL IJ2LL(XI,YJ,YLAT,WLON)
C   INPUT ARGUMENT LIST:
C     XI       - FIRST INDEX VALUE OF GRID POINT
C     YJ       - SECOND INDEX VALUE OF GRID POINT
C
C   OUTPUT ARGUMENT LIST:
C     YLAT     - LATITUDE OF GRID POINT (XI,YJ) N POS
C     WLON     - LONGITUDE OF GRID POINT (XI,YJ)W POS
C
C   INPUT FILES:
C     /GRID/   - COMMON BLOCK CONTAINING GRID DEFINITION
C
C ATTRIBUTES:
C   LANGUAGE: standard FORTRAN
C   MACHINE:  
C
C$$$
      IMPLICIT REAL (A-H,O-Z)
C  CONVERT POINT (XI,YJ) IN GRID SPACE TO LATITUDE/LONGITUDE
      LOGICAL POLA,NORTH,SIGERR
      COMMON /GRIDC/ POLA,NORTH,ALONVT,POLEI,POLEJ,XMESHL,SIGERR
      EQUIVALENCE (YLATS,ALONVT) , (DLAT,POLEI)
      EQUIVALENCE (XLONW,POLEJ) , (DDLON,XMESHL)
      DATA EARTHR / 6371.2 /, CONV2D / 57.2957795 /
      IF( POLA )  GO TO 10
C  GRID IS LAT/LONG
      YLAT = YLATS + (YJ-1.) * DLAT
      WLON = XLONW - (XI-1.) * DDLON
      IF( WLON .GT. 360. )WLON = WLON - 360.
      IF( WLON .LT. 0.0) WLON = WLON + 360.
      RETURN
   10 CONTINUE
C  GRID IS POLAR STEREOGRAPHIC
      RE = (EARTHR * 1.86603) / XMESHL
      GI2 = RE * RE
      DELX = XI - POLEI
      DELY = YJ - POLEJ
      R2 = DELX*DELX + DELY*DELY
      IF( R2 .EQ. 0.0 )  GO TO 40
      TLON = CONV2D * ATAN2(DELY,DELX)
      IF(  NORTH  )  WLON = ALONVT - 90. - TLON
      IF(.NOT.NORTH) WLON = ALONVT + 90. + TLON
      IF( WLON .GT. 360. )WLON = WLON - 360.
      IF( WLON .LT. 0.0) WLON = WLON + 360.
      YLAT = ASIN ((GI2 - R2) / (GI2 + R2)) * CONV2D
      IF(.NOT.NORTH) YLAT = -YLAT
      RETURN
   40 YLAT = 90.
      IF(.NOT.NORTH) YLAT = -YLAT
      WLON = ALONVT
      RETURN
      END
