      SUBROUTINE NOHSPT(SPOT,LINE,CHNCMB,ACCSPT,ACCLNE)
      IMPLICIT NONE
C
C********************************************************************
C
C   NAME- NOHSPT
C
C   LANGUAGE- VS FORTRAN  TYPE- SUBROUTINE      COMPUTER- CRAY J916
C
C   VERSION- 1.0    DATE- 01/02/92   PROGRAMMER- JEFF MANNING, SMSRC
C   VERSION- 2.0    DATE- 05/06/94   PROGRAMMER- FRANK TILLEY (SMSRC)
C                   XATOV-3 REPLACE COMMON BLOCK /BUFFER/ WITH
C                   PARAMETER FILE INSPARM AND COMMON BLOCK /INSCOM/.
C   VERSION- 2.1    DATE- 06/10/94   PROGRAMMER- JEFF MANNING, SMSRC
C                   XATOV-13 NEED TO SELECT ONE OUT OF EVERY TWO HIRS
C                   SPOTS TO THE RETRIEVAL GRID RATHER THAN ONE OUT OF
C                   EVERY 3X3 ARRAY OF HIRS SPOTS.  REMOVE CALL TO
C                   CLOSER.
C   VERSION- 2.2    DATE- 10/03/94   PROGRAMMER- ALEX POZDNYAK, SMSRC
C                   XATOV-58 COMMENTS FOR 'MSU' AND 'SSU' CHANGED TO
C                   'OTHER SOUNDINGS INSTRUMENTS'. DO LOOPS 10 AND 40
C                   CHANGED FROM 'K=21,27' TO 'K=21,NUMCHN'. 'INCLUDE'
C                   WAS ADDED FOR RETPARM. ACCSPT AND ACCLNE CHANGED
C                   FROM 'I/O' TO 'O'.
C   VERSION- 3.0    DATE- 05/28/96   PROGRAMMER- TIM GARDNER (HSTX)
C   VERSION- 3.1    DATE- 06/18/98   PROGRAMMER- BRIAN BARIL (RSTX)
C   VERSION- 3.2    DATE- 10/01/98   PROGRAMMER- M.P.FERGUSON(RITTS)
C   VERSION- 3.3    DATE-  5/21/99   PROGRAMMER- A. Allegrino (RITTS)
C   VERSION- 3.31   DATE-  2/14/00   PROGRAMMER- M.P. FERGUSON (RITTS)
C   VERSION- 4.0    DATE- 02/27/03   PROGRAMMER- Rickey Rollins (CSC)
C
C   FUNCTION- THIS ROUTINE FINDS THE HIRS SPOT AND LINE NUMBERS, BASED
C             ON THE OTHER SOUNDINGS INSTRUMENTS, TO BE COLLOCATED TO
C             THE RETRIEVAL GRID.  NO HIRS SPOTS ARE AVAILABLE SO THE
C             SPOT AND LINE NUMBERS MUST BE FOUND ON THE BASIS OF THE
C             AVAILABLITY OF THE OTHER SOUNDINGS INSTRUMENTS.
C
C   VERSION 3.0- DOCUMENTATION AND SYNTAX CHANGES FOR ATOVS BASELINE
C                ON THE CRAY.
C   VERSION 3.1- WITH THE CHANGE TO A 2X2 GRID, LINE BOUNDARIES WERE
C                ADDED.  NOW CHOOSES THE BEST SPOT ON THE BEST LINE.
C   VERSION 3.2- INCREASED DIMENSION OF CHNCMB FROM 2X3 TO 2X4.
C   VERSION 3.3- INITIALIZED ACCSPT & ACCLNE TO I4SPV INSTEAD OF ZERO. 
C   VERSION 3.31 INCREASED DIMENSION OF CHNCMB FROM 2X4 TO 2X4X2.
C   VERSION- 4.0    DATE- 02/27/03   PROGRAMMER- Rickey Rollins (CSC)
C        Replace R4SPV equivalence test with ISR4SPV function
C
C   CALLING SEQUENCE PARAMETERS-
C     VARIABLE      I/O   TYPE      DESCRIPTION
C     --------      ---   ----      -----------
C     SPOT           I    INT       SPOT NUMBER CORRESPONDING TO THE
C                                   HIRS.
C     LINE           I    INT       LINE NUMBER CORESSPONDING TO THE
C                                   HIRS.
C     CHNCMB         I    INT       CHANNEL AVAILABILITY COMBINATION FOR
C                                   THE NO-HIRS CASE. DIMENSION (2X4X2)
C     ACCSPT         O    INT       HIRS SPOT NUMBER CORRESPONDING TO
C                                   THE RETRIEVAL GRID POINT.
C     ACCLNE         O    INT       HIRS LINE NUMBER CORRESPONDING TO
C                                   THE RETRIEVAL GRID POINT.
C
C   LOCAL PARAMTERS-
C     VARIABLE      TYPE      DESCRIPTION
C     --------      ----      -----------
C     SPTCNT        INT       SPOT COUNTER.
C     HLDCNT        INT       HOLDS THE SPOT COUNT OF THE CLOSEST SPOT.
C     I, K          INT       LOOP COUNTERS.
C     MSTEMP        INT       TEMPORARY VARIABLE CONTAINING THE
C                             CHANNEL AVAILABILITY OF THE OTHER
C                             SOUNDINGS INSTRUMENTS.
C     CHRSLT        INT       ARRAY (DIM 2) CONTAINING THE RESULTS FROM
C                             THE IAND OPERATION BETWEEN MSTEMP AND
C                             CHNCMB.
C     IBIT          INT       INDICATES WHICH BIT TO SET IN THE
C                             TEMPORARY VARIABLE MSTEMP.
C     TMPUSE        INT       HOLDS THE NUMBER OF AVAILABLE OTHER
C                             SOUNDINGS INSTRUMENTS CHANNELS FOR THE
C                             SPOT BEING CONSIDERED.
C     USE           INT       COUNTER FOR THE NUMBER OF AVAILABLE
C                             CHANNELS.
C
C   FUNCTIONS USED- IBSET, IAND
C
C   EXIT STATES- NONE
C
C   COMMENTS- THE BASE SPOT ALWAYS PASSED INTO THIS ROUTINE IS
C             THE FIRST OF THE TWO SPOTS BEING CONSIDERED, AND IS
C             ALWAYS AN ODD NUMBERED SPOT.
C
C********************************************************************
C
      INTEGER SPOT, LINE, ACCSPT, ACCLNE, CHNCMB(2,4,2)
      INTEGER TMPUSE, USE, ILNDSEA
      INTEGER I, J, K, SPTCNT, HLDCNT, CHRSLT(2), MSTEMP, IBIT
      LOGICAL   ISR4SPV
C
      INCLUDE 'INSPARM'
      INCLUDE 'INSCOM'
      INCLUDE 'RETPARM'
      INCLUDE 'SPVAL'
C
C     INITIALIZE VARIABLES.
C
      ACCSPT = i4spv
      ACCLNE = i4spv
      SPTCNT = 0
      HLDCNT = 0
      TMPUSE = 0

C     LOOP THROUGH THE LINES
C
      DO 30 J = LINE, LINE + 1
C
C     LOOP THROUGH THE SPOTS.
C
      DO 20, I = SPOT, SPOT+1
CMPF
         ILNDSEA = 1
         IF(HIRANC(I,J,9).NE.0)ILNDSEA = 2
C
C        INCREMENT SPOT COUNTER.
C
         SPTCNT = SPTCNT + 1
C
C        SET UP THE TEMPORARY VARIABLE CONTAINING THE CHANNEL
C        AVAILABILITY OF THE OTHER SOUNDING INSTRUMENTS.
C
         MSTEMP = 0
         DO 10, K = 21,NUMCHN
            IF(.NOT. ISR4SPV(HIRDAT(I,J,K))) THEN
              IBIT = K - 20
               MSTEMP = IBSET(MSTEMP,32-IBIT)
             END IF
C
   10    CONTINUE
C
C        IF THE OTHER SOUNDINGS INSTRUMENTS CHANNELS ARE UNAVAILABLE
C        FOR THE NO-HIRS CASE THEN GO TO THE NEXT SPOT.
C
         CHRSLT(2) = IAND(MSTEMP,CHNCMB(2,3,ILNDSEA))
         IF(CHRSLT(2).NE.CHNCMB(2,3,ILNDSEA)) GO TO 20
C
C        IF OTHER SOUNDINGS INSTRUMENTS ARE AVAILABLE.
C

         IF(HLDCNT.EQ.0) THEN
           HLDCNT = SPTCNT
           ACCSPT = I
           ACCLNE = J
         ELSE
C
C        HOLD THE CLOSEST SPOT TO NADIR.
C
           IF(SPOT.LE.28) THEN
             ACCSPT = SPOT + 1
           ELSE
             ACCSPT = SPOT
           END IF
            ACCLNE = J
         END IF
C
 20     CONTINUE
 30    CONTINUE
C
C     IF AN ACCEPTABLE COMBINATION OF OTHER SOUNDING INSTRUMENTS CANNOT
C     BE FOUND THEN RETURN THE SPOT CLOSEST TO NADIR WITH THE MOST
C     AVAILABLE CHANNELS.
C
      IF(HLDCNT.EQ.0) THEN
        SPTCNT = 0
         DO 60, J = LINE, LINE+1
          DO 50, I = SPOT,SPOT+1
           USE = 0
           SPTCNT = SPTCNT + 1
           DO 40, K = 21,NUMCHN
C
C          IF THE CHANNEL VALUE IS NOT MISSING INCREMENT THE
C          USABLE CHANNEL COUNTER.
C
              IF(.NOT. ISR4SPV(HIRDAT(I,J,K))) USE = USE + 1
   40      CONTINUE
C
C           SEE IF THE CHANNEL COUNTER IS GREATER THAN THE HELD
C           VALUE.
C
            IF(USE.GT.TMPUSE) THEN
C
C           IF THE CHANNEL COUNTER IS GREATER THAN THE HELD VALUE
C           THEN SAVE THE CHANNEL COUNTER, THE SPOT COUNT AND THE
C           SPOT AND LINE NUMBERS.
C
              TMPUSE = USE
              HLDCNT = SPTCNT
              ACCSPT = I
              ACCLNE = J
C
C           CHECK TO SEE IF THE CHANNEL COUNTER IS EQUAL TO THE
C           HELD VALUE, BUT NOT EQUAL TO ZERO.
C
            ELSE IF((USE.NE.0).AND.(USE.EQ.TMPUSE)) THEN
C
C           FIND THE VALUE CLOSEST TO NADIR.
C
              IF(SPOT.LE.28) THEN
                 ACCSPT = SPOT + 1
              ELSE
                 ACCSPT = SPOT
              END IF
                ACCLNE = J
C 
            END IF
   50   CONTINUE
 60     CONTINUE
      END IF
C
C     IF A SPOT COULD NOT BE FOUND WITH ANY AVAILABLE CHANNELS RETURN
C     THE ACCEPTABLE SPOT AND LINE NUMBERS BACK AS MISSING VALUES.
C
      IF(HLDCNT.EQ.0) THEN
        ACCSPT = I4SPV
        ACCLNE = I4SPV
      END IF
C
C     RETURN TO COLDVR.
C
      RETURN
      END
