!+ Subroutine to read a formatted TAPE8 file.
!
! 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 READ_TAPE8_FORM(IERR
     &   , N_WAVENUMBER_TRANS, WAVENUMBER_TRANS, TRANSMITTANCE
     &   , N_ABSORB_LOWTRAN, I_LOWTRAN_COLUMN)
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/dimensions_spec.ucf'
      INCLUDE 'incl/dimensions_pp.ucf'
      INCLUDE 'incl/def_std_io.icf'
      INCLUDE 'incl/def_lwtrn_io.icf'
      INCLUDE 'incl/gas_list.pcf'
      INCLUDE 'incl/lowtran_parameters.ecf'
      INCLUDE 'incl/error.pcf'
!
!     DUMMY ARGUMENTS
      INTEGER	!, INTENT(OUT)
     &     IERR
!             ERROR FLAG
     &   , N_WAVENUMBER_TRANS
!             NUMBER OF WAVEBNUMBERS
      INTEGER	!, INTENT(IN)
     &     N_ABSORB_LOWTRAN
!             NUMBER OF LOWTRAN ABSORBERS
     &   , I_LOWTRAN_COLUMN(NPD_SPECIES)
!             COLUMNS IN WHICH INPUT OCCURS
      REAL*8	!, INTENT(OUT)
     &     TRANSMITTANCE(NPD_WAVENUMBER_TRANS, NPD_SPECIES)
!             LOWTRAN TRANSMITTANCES
     &   , WAVENUMBER_TRANS(NPD_WAVENUMBER_TRANS)
!
!     LOCAL VARIABLES.
      REAL*8
     &     TRANSMITTANCE_IN(NPD_GAS_LOW)
!             TRANSMITTANCES READ IN
      CHARACTER
     &     LINE*200
!             INPUT LINE OF DATA
      INTEGER
     &     I
!             LOOP VARIABLE
     &   , J
!             LOOP VARIABLE
      CHARACTER
     &     HMODEL(5, 8)*4
!             LOWTRAN CHARACTER NAME
      INTEGER
     &     MODEL
!             LOWTRAN VARIABLE
     &   , ITYPE
!              "
     &   , IEMSCT
!              "
     &   , IMULT
!              "
     &   , M1, M2, M3, M4, M5, M6
!              "
     &   , MDEF
!              "
     &   , IM
!              "
     &   , NOPRT
!              "
     &   , IHAZE
!              "
     &   , ISEASN
!              "
     &   , IVULCN
!              "
     &   , ICSTL
!              "
     &   , ICIR
!              "
     &   , IVSA
!              "
     &   , ISEED
!              "
     &   , ML
!              "
      INTEGER
     &     IPARM
!              "
     &   , IPH
!              "
     &   , IDAY
!              "
     &   , ISOURC
!              "
     &   , LEN
!              "
     &   , IPRT
!              "
      REAL*8
     &     TBOUND
!              "
     &   , SALB
!              "
     &   , VIS
!              "
     &   , WSS
!              "
     &   , WHH
!              "
     &   , RAINRT
!              "
     &   , GNDALT
!              "
     &   , CTHIK
!              "
     &   , CALT
!              "
     &   , CEXT
!              "
     &   , ZCVSA
!              "
     &   , ZTVSA
!              "
     &   , ZINVSA
!              "
      REAL*8
     &     H1
!              "
     &   , H2
!              "
     &   , ANGLE
!              "
     &   , RANGE_1
!              "
     &   , BETA
!              "
     &   , RO
!              "
     &   , P
!              "
     &   , T
!              "
     &   , DP
!              "
     &   , RH
!              "
     &   , WH
!              "
     &   , WO
!              "
      REAL*8
     &     PARM1
!              "
     &   , PARM2
!              "
     &   , PARM3
!              "
     &   , PARM4
!              "
     &   , TIME
!              "
     &   , PSIPO
!              "
     &   , ANGLEM
!              "
     &   , G
!              "
     &   , V1
!              "
     &   , V2
!              "
     &   , DV
!              "
      REAL*8
     &     FEND
!             LOWTRAN END FLAG
!
!
!
!     READ THE HEADER CARDS.
      READ(IU_LOWTRAN_TAPE8, '(13I5, F8.3, F7.2)')
     &     MODEL, ITYPE, IEMSCT, IMULT, M1, M2, M3, M4, M5, M6
     &   , MDEF, IM, NOPRT, TBOUND, SALB
      READ(IU_LOWTRAN_TAPE8, '(6I5, 5F10.3)')
     &     IHAZE, ISEASN, IVULCN, ICSTL, ICIR, IVSA
     &   , VIS, WSS, WHH, RAINRT, GNDALT
      READ(IU_LOWTRAN_TAPE8, '(3F10.3, I10)')
     &     CTHIK, CALT, CEXT, ISEED
      READ(IU_LOWTRAN_TAPE8, '(3F10.3)') ZCVSA, ZTVSA, ZINVSA
      READ(IU_LOWTRAN_TAPE8, '(I5, 18A4)') ML, (HMODEL(I,7), I=1, 5)
      IF (MODEL.NE.0) THEN
         READ(IU_LOWTRAN_TAPE8, '(6F10.3, I5)')
     &      H1, H2, ANGLE, RANGE_1, BETA, RO, LEN
      ELSE
         READ(IU_LOWTRAN_TAPE8, '(3F10.3, 5E10.3)')
     &      H1, P, T, DP, RH, WH, WO, RANGE_1
      ENDIF
      READ(IU_LOWTRAN_TAPE8, '(4I5)') IPARM, IPH, IDAY, ISOURC
      READ(IU_LOWTRAN_TAPE8, '(8F10.3)')
     &   PARM1, PARM2, PARM3, PARM4, TIME, PSIPO, ANGLEM, G
      READ(IU_LOWTRAN_TAPE8, '(3F10.3)') V1, V2, DV
      READ(IU_LOWTRAN_TAPE8, '(I5)') IPRT
!
!     FIND THE NUMBER OF INPUT LINES AND READ THE TRANSMISSIONS.
!     THIS IS USED ONLY AS A CHECK WITH A SAFETY FACTOR, SINCE THE
!     NUMBER OF LINES PRODUCED BY LOWTRAN IS MACHINE-DEPENDENT.
      N_WAVENUMBER_TRANS=INT((V2-V1)/DV)+3
      IF (N_WAVENUMBER_TRANS.GT.NPD_WAVENUMBER_TRANS) THEN
         WRITE(IU_ERR, '(/A)')
     &      '*** ERROR: TOO MANY DATA POINTS IN THIS BAND.'
         WRITE(IU_ERR, '(A)')
     &      'INCREASE NPD_WAVENUMBER_TRANS AND RECOMPILE.'
         IERR=I_ERR_FATAL
         RETURN
      ENDIF
!
      READ(IU_LOWTRAN_TAPE8, '(/)')
!
      N_WAVENUMBER_TRANS=0
!     EACH LINE MUST BE PROCESSED TO CIRCUMVENT THE UNCERTAINITY IN THE
!     NUMBER OF CALCULATIONS LOWTRAN SEES FIT TO PERFORM.
1     READ(IU_LOWTRAN_TAPE8, '(A)') LINE
      READ(LINE, '(F7.0)') FEND
      IF (FEND.GE.0.0D+00) THEN
         N_WAVENUMBER_TRANS=N_WAVENUMBER_TRANS+1
         READ(LINE, '(F7.0, 11(1PE12.5))')
     &      WAVENUMBER_TRANS(N_WAVENUMBER_TRANS)
     &      , (TRANSMITTANCE_IN(J), J=1,11)
!        CONVERT TO S.I. UNITS
         WAVENUMBER_TRANS(N_WAVENUMBER_TRANS)
     &      =1.0D+02*WAVENUMBER_TRANS(N_WAVENUMBER_TRANS)
!        TRANSFER TRANSMITTANCES TO THE MAIN ARRAY.
         DO J=1, N_ABSORB_LOWTRAN
            TRANSMITTANCE(N_WAVENUMBER_TRANS, J)
     &         =TRANSMITTANCE_IN(I_LOWTRAN_COLUMN(J))
         ENDDO
         GOTO 1
      ENDIF
!
!
      RETURN
      END
