!+ Subroutine to make spectral blocks of type 0.
!
! Method:
!	Straightforward.
!
! 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 MAKE_BLOCK_0(IERR, N_BAND
     &   , N_ABSORB, TYPE_ABSORB, TYPE_INDEX
     &   , N_AEROSOL, TYPE_AEROSOL
     &   )
!
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/def_std_io.icf'
      INCLUDE 'incl/gas_list.pcf'
      INCLUDE 'incl/dimensions_spec.ucf'
      INCLUDE 'incl/dimensions_pp.ucf'
      INCLUDE 'incl/error.pcf'
!
!
!     DUMMY ARGUMENTS.
      INTEGER	!, INTENT(OUT)
     &     IERR
!             ERROR FLAG
     &   , N_BAND
!             NUMBER OF SPECTRAL BANDS
     &   , N_ABSORB
!             NUMBER OF ABSORBERS
     &   , TYPE_ABSORB(NPD_SPECIES)
!             TYPE NUMBERS OF ABSORBER
     &   , TYPE_INDEX(NPD_GASES)
!             INDEX OF EACH GASEOUS SPECIES
     &   , N_AEROSOL
!             NUMBER OF AEROSOLS
     &   , TYPE_AEROSOL(NPD_AEROSOL_SPECIES)
!             TYPES OF AEROSOLS
!
!     LOCAL VARIABLES.
!
      LOGICAL
     &     LOCK_CODE
!             LOGICAL TO FORBID INTERACTIVE LOOPING
      EXTERNAL
     &     LOCK_CODE
!
      INTEGER
     &     IOS
!             READING ERROR FLAG
     &   , I
!             LOOP VARIABLE
!
!
!
      WRITE(IU_USER, '(/A/)') 'NUMBER OF SPECTRAL BANDS ?'
1     READ(IU_STDIN, *, IOSTAT=IOS) N_BAND
      IF (IOS.NE.0) THEN
         WRITE(IU_ERR, '(A)') '+++ UNRECOGNISED INPUT:'
         IF (LOCK_CODE(.TRUE.)) THEN
            INCLUDE 'batch_error.finc'
         ELSE
            WRITE(IU_USER, '(A)') 'PLEASE RE-ENTER.'
            GOTO 1
         ENDIF
      ENDIF
      IF (N_BAND.GT.NPD_BAND) THEN
         WRITE(IU_ERR, '(/A)') '*** ERROR: TOO MANY BANDS REQUESTED.'
         IERR=I_ERR_FATAL
         RETURN
      ENDIF
!
      WRITE(IU_USER, '(/A/)') 'NUMBER OF ABSORBERS ?'
2     READ(IU_STDIN, *, IOSTAT=IOS) N_ABSORB
      IF (IOS.NE.0) THEN
         WRITE(IU_ERR, '(A)') '+++ UNRECOGNISED INPUT:'
         IF (LOCK_CODE(.TRUE.)) THEN
            INCLUDE 'batch_error.finc'
         ELSE
            WRITE(IU_USER, '(A)') 'PLEASE RE-ENTER.'
            GOTO 2
         ENDIF
      ENDIF
      IF (N_ABSORB.GT.NPD_SPECIES) THEN
         WRITE(IU_ERR, '(/A)') 
     &      '*** ERROR: TOO MANY ABSORBERS REQUESTED.'
         IERR=I_ERR_FATAL
         RETURN
      ENDIF
!
!     PREPARE THE LIST OF ABSORBERS.
      IF (N_ABSORB.GT.0) THEN
         WRITE(IU_USER, '(/A)')
     &      'GIVE THE TYPE NUMBERS OF THE ABSORBERS.'
         WRITE(IU_USER, '(A)')
     &      'AS IN THE LIST IN THE INCLUSION '
     &      //'FILE incl/gas_list.pcf'
         ENDIF
      DO I=1, N_ABSORB
3        WRITE(IU_USER, '(A29, 1X, I5)')
     &      'ENTER TYPE NUMBER OF ABSORBER ',I
         READ(IU_STDIN, *, IOSTAT=IOS) TYPE_ABSORB(I)
         IF (IOS.NE.0) THEN
            IF (LOCK_CODE(.TRUE.)) THEN
               INCLUDE 'batch_error.finc'
            ELSE
               WRITE(IU_ERR, '(A)') '+++ UNRECOGNISED INPUT'
               GOTO 3
            ENDIF
         ENDIF
!        SET THE INDEX FOR THIS TYPE FOR FUTURE USE.
         TYPE_INDEX(TYPE_ABSORB(I))=I
      ENDDO
!
      WRITE(IU_USER, '(/A/)') 'NUMBER OF AEROSOLS ?'
4     READ(IU_STDIN, *, IOSTAT=IOS) N_AEROSOL
      IF (IOS.NE.0) THEN
         WRITE(IU_ERR, '(A)') '+++ UNRECOGNISED INPUT:'
         IF (LOCK_CODE(.TRUE.)) THEN
            INCLUDE 'batch_error.finc'
         ELSE
            WRITE(IU_USER, '(A)') 'PLEASE RE-ENTER.'
            GOTO 4
         ENDIF
      ENDIF
      IF (N_AEROSOL.GT.NPD_AEROSOL_SPECIES) THEN
         WRITE(IU_ERR, '(/A)') 
     &      '*** ERROR: TOO MANY AEROSOLS REQUESTED.'
         IERR=I_ERR_FATAL
         RETURN
      ENDIF
!
!     PREPARE THE LIST OF AEROSOLS.
      IF (N_AEROSOL.GT.0) THEN
         WRITE(IU_USER, '(/A)')
     &      'GIVE THE TYPE NUMBERS OF THE AEROSOLS.'
         WRITE(IU_USER, '(A)')
     &        'AS IN THE LIST IN THE INCLUSION FILE '
     &        //'incl/aerosol_component.pcf'
      ENDIF
      DO I=1, N_AEROSOL
5        WRITE(IU_USER, '(A28, 1X, I5)')
     &      'ENTER TYPE NUMBER OF AEROSOL ',I
         READ(IU_STDIN, *, IOSTAT=IOS) TYPE_AEROSOL(I)
         IF (IOS.NE.0) THEN
            IF (LOCK_CODE(.TRUE.)) THEN
               INCLUDE 'batch_error.finc'
            ELSE
               WRITE(IU_ERR, '(A)') '+++ UNRECOGNISED INPUT'
               GOTO 5
            ENDIF
         ENDIF
      ENDDO
!
!
      RETURN
      END
