!+ Subroutine to bracket a point in an array of wavelengths.
!
! Method:
!	An array of points is searched to find those bracketing
!	a given wavelength.
!
! Current Owner of Code: J. M. Edwards
!
! History:
!	Version		Date			Comment
!	1.0		12-04-95		First Version under RCS
!						(J. M. Edwards)
!
! Description of Code:
!   FORTRAN 77  with extensions listed in documentation.
!
!- ---------------------------------------------------------------------
      SUBROUTINE POINT_BRACKET(LAMBDA
     &   , N_POINTS, SPECTRUM
     &   , I_SHORT, I_LONG)
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADERS.
      INCLUDE 'incl/dimensions_pp.ucf'
!
!     DUMMY ARGUMENTS
      INTEGER	!, INTENT(IN)
     &     N_POINTS
!             NUMBER OF POINTS
      INTEGER	!, INTENT(OUT)
     &     I_SHORT
!             LOWER BRACKETING POINT
     &   , I_LONG
!             UPPER BRACKETING POINT
      REAL*8	!, INTENT(IN)
     &     LAMBDA
!             POINT TO SEARCH FOR
     &   , SPECTRUM(NPD_SOLAR_POINTS)
!             SPECTRUM TO SEARCH
!
!     LOCAL VARIABLES.
      INTEGER
     &     I_MID
!             MID-POINT OF INTERVAL
!
!
!     INITIALIZE THE UPPER AND LOWER POINTS AND THEN 
!     BEGIN A BINARY SEARCH.
      I_SHORT=0
      I_LONG=N_POINTS+1
1     IF (I_LONG-I_SHORT.GT.1) THEN
!        INTERVAL REQUIRES CHOPPING.
         I_MID=(I_LONG+I_SHORT)/2
         IF (SPECTRUM(I_MID).LE.LAMBDA) THEN
            I_SHORT=I_MID
         ENDIF
         IF (SPECTRUM(I_MID).GT.LAMBDA) THEN
            I_LONG=I_MID
         ENDIF
         GOTO 1
      ENDIF
!
!
      RETURN
      END
