      SUBROUTINE ARSST(NAREA,FLAT,FLON,ASST,ISTAT)
C $ SUBROUTINE ARSST(NAREA,FLAT,FLON,ASST,ISTAT)  (CMH)
C $ ARSST - Read SST area and return value in C, Lat/lon given as
C $         formal parameters, missing returned as -999.
C $ Input:
C $   NAREA = (I) SST area number
C $   LAT = (I) latitude as floating point
C $   LON = (I) longitude as floating point, pos. W; neg E
C $ Output:
C $   ASST = SST (Celsius) (missing=-999.)
C $   ISTAT = status flag; non-zero indicates failure
C $$ ARSST = VAS, AREA, SOUNDER, COMPUTAT
C
      INTEGER NELE, NPIXEL,
     1   NLRES, NERES, NLINES
      INTEGER NBOX, ISST
      INTEGER ECOR, ERES, ESIZ
      INTEGER IPARAM(128), IENTRY(64)
      INTEGER IOUT(2000)
      INTEGER MASK
      LOGICAL   LWORD
      LOGICAL*1 LOUT(8000),LVAL
      CHARACTER*132 LBUF
      CHARACTER*12 CFI,CFF
      EQUIVALENCE (IOUT,LOUT),(IWORD,LWORD)
      COMMON /DBUG/KBUG 
C
      DATA MAXELE/2500/,MAXLIN/2500/,NLINES/0/,NBOX/0/
      DATA IAREA/0/,NELE/620/,NPIXEL/0/,NLRES/1/,NERES/1/
      DATA MASK /Z'000000FF'/
C      DATA ISST/'4HSST'/
C
      IF (IAREA.NE.0)GO TO 10
C
C---READ AREA NUMBER
      IAREA=NAREA
C
C---READ AREA DIRECTORY
C   READD READS AREA DIRECTORY, READDL READS AND LOCKS THE DIRECTORY.
      CALL READD (IAREA,IENTRY)
C
C---SOURCE AREA MUST EXIST, OTHERWISE GIVE UP.
      IF(IENTRY(1).LT.0.OR.IENTRY(2).NE.4) GOTO 903
C
C---STARTING LINE AND ELEMENT
      LCOR=IENTRY(6)
      ECOR=IENTRY(7)
C
C---NUMBER OF LINES AND ELEMENTS
      LSIZ=IENTRY(9)
      ESIZ=IENTRY(10)
C
C---LINE AND ELEMENT BLOWDOWN FACTORS
      LRES=IENTRY(12)
      ERES=IENTRY(13)
C
C---NUMBER OF LINES AND ELEMENTS IN SECTOR (IMAGE COORDINATES)
      MAXLIN=LCOR+((LSIZ-1)*LRES)
      MAXELE=ECOR+((ESIZ-1)*ERES)
C
C---INITIALIZE AREA
      CALL OPNARA(IAREA)
C
C---GET THE PROPER NAVIGATION FILE. CODICIL FILES HAVE ENTRY(34) > 0.
      KEY1=IENTRY(34)
      KEY2=IENTRY(35)
C
C---IF IENTRY(34) (CODICIL PRIMARY KEY) IS 0 THEN USE SSYYDDD & HHMMSS
C   FOR THE NAVIGATION PARAMETERS.
       IF(KEY1.EQ.0) THEN
          KEY1=IENTRY(3)*100000+IENTRY(4)
          KEY2=IENTRY(5)
       ENDIF
C
C---PUT NAVIGATION PARAMETERS INTO SLOT 2
      ISTAT = NVSETZ('AREA',IAREA,2)
Cxxxxxxx     ABOVE REPLACES OLD CALLS TO NXI AND NVPREP....
      IF(ISTAT.NE.0) GOTO 901
C
C     JUMP TO HERE ON SUBSEQUENT ENTRIES OF LAT/LON
C
   10 CONTINUE
         ASST=-999.
         ISTAT=NV2EAS (FLAT,FLON,0.0,FLIN,FELE,XDUM)
         IF(ISTAT.NE.0) THEN
            IF (KBUG.NE.0)CALL SDEST('NAV ERRROR IN SST',ISTAT)
            RETURN
         ENDIF
         LNN=FELE+.5
         LMM=FLIN+.5
         IF((LNN.LT.ECOR).OR.(LNN.GT.MAXELE)) GOTO 20
         IF((LMM.LT.LCOR).OR.(LMM.GT.MAXLIN)) GOTO 20
         NN=((LNN-ECOR)/ERES)+1
         MM=((LMM-LCOR)/LRES)+1
         CALL REDARA (IAREA,MM,0,100000,'ALL',IOUT)
         LVAL=LOUT(NN)
C     CONVERT 1 BYTE DATA INTO 4 BYTE INTEGER.
         IWORD=0
         LWORD=LVAL
         IVAL= IAND(IWORD,MASK)
         IF((IVAL.LE.255).AND.(IVAL.GT.0)) THEN
C
C---COMPUTE PIXEL TEMPERATURE
                  ASST=-10.0+FLOAT(IVAL)*0.2
         ENDIF
 20      CONTINUE
                 
      RETURN
C
 901  WRITE (LBUF,6901)  ISTAT, KEY1, KEY2
 6901 FORMAT (' NVSETZ FAILED ISTAT=',I4,' KEYS',2I8)
      CALL LTQ(LBUF)
      RETURN
 903  CALL EDEST('ARSST: SOURCE AREA DOES NOT EXIST',0)
      WRITE (LBUF,6903) IENTRY(1),IENTRY(2)
 6903 FORMAT (' IENTRY(1),IENTRY(2) ',2I5)
      CALL LTQ(LBUF)
C! Below is a change recently made to ARSST... it is currently being
C! commented out.
C!        IF AREA DOES NOT EXIST, SET ISTAT TO POSITIVE NUMBER
C!         ISTAT = 999
C!         ASST = -999
      RETURN
      END
