!+ Subroutine to remove neative continuum p-scalings.
!
! Method:
!	The exponent of the pressure-scaling of the continuum is
!	examined, and if neagtive it is reset to 0.
!
! 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 REMOVE_NEGATIVE_CONT(N_BAND, N_BAND_CONTINUUM
     &   , INDEX_CONTINUUM
     &   , I_SCALE_FNC_CONT, SCALE_CONTINUUM
     &   )
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES
      INCLUDE 'incl/def_std_io.icf'
      INCLUDE 'incl/dimensions_spec.ucf'
      INCLUDE 'incl/continuum.pcf'
      INCLUDE 'incl/scale_fnc.pcf'
!
!     DUMMY ARGUMENTS.
      INTEGER	!, INTENT(IN)
     &     N_BAND
!             NUMBER OF BANDS
     &   , N_BAND_CONTINUUM(NPD_BAND)
!             NUMBER OF CONTINUA IN BANDS
     &   , INDEX_CONTINUUM(NPD_BAND, NPD_CONTINUUM)
!             LIST OF ACTIVE CONTINUA
     &   , I_SCALE_FNC_CONT(NPD_BAND, NPD_CONTINUUM)
!             SCALING FUNCTIONS FOR CONTINUA
      REAL*8	!, INTENT(OUT)
     &     SCALE_CONTINUUM(NPD_SCALE_VARIABLE, NPD_BAND, NPD_CONTINUUM)
!             CONTINUUM SCALING PARAMETERS
!
!     LOCAL VARIABLES.
      INTEGER
     &     I
!             LOOP VARIABLE
     &   , J
!             LOOP VARIABLE
     &   , K
!             LOOP VARIABLE
!
!
!     LOOP THROUGH THE BANDS CHECKING THE SCALING DATA DEPENDING ON
!     THE SCALING FUNCTION USED.
      DO I=1, N_BAND
         DO K=1, N_BAND_CONTINUUM(I)
            J=INDEX_CONTINUUM(I, K)
            IF (I_SCALE_FNC_CONT(I, J).EQ.IP_SCALE_POWER_LAW) THEN
               IF (SCALE_CONTINUUM(1, I, J).LT.0.0D+00) THEN
                  WRITE(IU_STDOUT, '(A, I5, /A, I5)')
     &               'RESETTING PRESSURE SCALING IN BAND ', I
     &               , 'FOR CONTINUUM ', J
                  WRITE(IU_STDOUT, '(A, 1PE10.3)') 'OLD SCALING WAS '
     &               , SCALE_CONTINUUM(1, I, J)
                  SCALE_CONTINUUM(1, I, J)=0.0D+00
               ENDIF
            ELSE IF (I_SCALE_FNC_CONT(I, J).EQ.IP_SCALE_POWER_QUAD) THEN
               IF (SCALE_CONTINUUM(1, I, J).LT.0.0D+00) THEN
                  WRITE(IU_STDOUT, '(A, I5, /A, I5)')
     &               'RESETTING PRESSURE SCALING IN BAND ', I
     &               , 'FOR CONTINUUM ', J
                  WRITE(IU_STDOUT, '(A, 1PE10.3)') 'OLD SCALING WAS '
     &               , SCALE_CONTINUUM(1, I, J)
                  SCALE_CONTINUUM(1, I, J)=0.0D+00
               ENDIF
            ELSE IF (I_SCALE_FNC_CONT(I, J)
     &         .EQ.IP_SCALE_DOPPLER_QUAD) THEN
               IF (SCALE_CONTINUUM(1, I, J).LT.0.0D+00) THEN
                  WRITE(IU_STDOUT, '(A, I5, /A, I5)')
     &               'RESETTING PRESSURE SCALING IN BAND ', I
     &               , 'FOR CONTINUUM ', J
                  WRITE(IU_STDOUT, '(A, 1PE10.3)') 'OLD SCALING WAS '
     &               , SCALE_CONTINUUM(1, I, J)
                  SCALE_CONTINUUM(1, I, J)=0.0D+00
               ENDIF
            ENDIF
         ENDDO
      ENDDO
!
      RETURN
      END
