!+ Subroutine to set the weighting function for the transmittance.
!
! Method:
!	A list of possible weighting functions is displayed and
!	the user selects one. If solarweighting is used the
!	solar spectrum is read in.
!
! 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 SELECT_WEIGHT_TRANS(IERR, I_WEIGHT
     &   , N_SOLAR_POINTS, SOLAR_WAVELENGTH, SOLAR_IRRAD)
!
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/dimensions_pp.ucf'
      INCLUDE 'incl/def_std_io.icf'
      INCLUDE 'incl/weighting.pcf'
      INCLUDE 'incl/error.pcf'
!
!     DUMMY VARIABLES.
      INTEGER	!, INTENT(OUT)
     &     IERR
!             ERROR FLAG
     &   , I_WEIGHT
!             WEIGHTING FLAG
     &   , N_SOLAR_POINTS
!             SIZE OF SOLAR SPECTRUM
      REAL*8	!, INTENT(OUT)
     &     SOLAR_WAVELENGTH(NPD_SOLAR_POINTS)
!             POINTS OF SOLAR SPECTRUM
     &   , SOLAR_IRRAD(NPD_SOLAR_POINTS)
!             SOLAR IRRADIANCES
!
!     LOCAL VARIABLES
!
      LOGICAL
     &     LOCK_CODE
!             LOGICAL TO FORBID INTERACTIVE LOOPING
      EXTERNAL
     &     LOCK_CODE
!
      INTEGER
     &     IOS
!             I/O FLAG
      LOGICAL
     &     L_SOLAR_SPECTRUM
!             LOGICAL FOR READING OF SPECTRUM
!
!     SUBROUTINES CALLED:
      EXTERNAL
     &     READ_SOLAR_SPECTRUM
!
!
!
!     DISPLAY MENU OF WEIGHTINGS.
      WRITE(IU_USER, '(/A)')
     &   'SELECT THE METHOD OF WEIGHTING THE TRANSMITTANCES.'
      WRITE(IU_USER, '(3X, I2, A)' ) IP_WEIGHT_PLANCK
     &   , '. PLANCKIAN WEIGHTING AT TRANSMISSION TEMPERATURE.'
      WRITE(IU_USER, '(3X, I2, A)' ) IP_WEIGHT_DPLANCK
     &   , '. DIFFERENTIAL PLANCKIAN WEIGHTING AT TRANSMISSION '
     &   //'TEMPERATURE.'
      WRITE(IU_USER, '(3X, I2, A)' ) IP_WEIGHT_SOLAR
     &   , '. TOA SOLAR SPECTRAL WEIGHTING.'
      WRITE(IU_USER, '(3X, I2, A)' ) IP_WEIGHT_UNIFORM
     &   , '. UNIFORM WEIGHTING.'
      WRITE(IU_USER, '(A/)') 'ENTER REQUIRED NUMBER.'
1     READ(IU_STDIN, *, IOSTAT=IOS) I_WEIGHT
      IF (IOS.NE.0) THEN
         WRITE(IU_ERR, '(A)') '+++ ERRONEOUS RESPONSE:'
         IF (LOCK_CODE(.TRUE.)) THEN
            INCLUDE 'batch_error.finc'
         ELSE
            WRITE(IU_USER, '(A)') 'PLEASE RE-ENTER.'
            GOTO 1
         ENDIF
      ENDIF
      IF ( (I_WEIGHT.NE.IP_WEIGHT_PLANCK).AND.
     &     (I_WEIGHT.NE.IP_WEIGHT_DPLANCK).AND.
     &     (I_WEIGHT.NE.IP_WEIGHT_SOLAR).AND.
     &     (I_WEIGHT.NE.IP_WEIGHT_UNIFORM) ) THEN
         WRITE(IU_ERR, '(A)') '+++ RESPONSE OUT OF RANGE:'
         IF (LOCK_CODE(.TRUE.)) THEN
            INCLUDE 'batch_error.finc'
         ELSE
            WRITE(IU_USER, '(A)') 'PLEASE RE-ENTER.'
            GOTO 1
         ENDIF
      ENDIF
!
!     IF SOLAR WEIGHTING IS USED READ THE DATA IN.
      IF (I_WEIGHT.EQ.IP_WEIGHT_SOLAR) THEN
         CALL READ_SOLAR_SPECTRUM(IERR, L_SOLAR_SPECTRUM
     &      , N_SOLAR_POINTS, SOLAR_WAVELENGTH, SOLAR_IRRAD)
         IF (IERR.NE.I_NORMAL) RETURN
      ENDIF
!
!
      RETURN
      END
