      SUBROUTINE TVO3INIT(LVSED,LTV,MR,MGS,NR,NGAS,IDG,NLMX,ZR,TR,
     &TVPATH,VIBSTS,TVIB)
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C TVO3INIT READS IN O3 VIBRATIONAL TEMPERATURES FOR BANDS INCLUDED
C IN THE CO2 FORWARD MODEL.
C
C INPUT PARAMETERS:
C
C  LVSED  --- UNIT NUMBER OF VIBRATIONAL STATE PARAMETER DATABASE.
C  LTV    --- UNIT NUMBER OF INITIAL TV'S.
C  MR     --- MAXIMUM LEVELS IN INPUT ATMOSPHERE.
C  MGS    --- MAXIMUM SIMULATED VIBRATIONAL TRANSITIONS.
C  NR     --- NUMBER OF LEVELS IN INPUT ATMOSPHERE.
C  NGAS   --- NUMBER OF SIMULATED GASES/ISOTOPES/TRANSITIONS.
C  IDG    --- SIMULATED PSEUDO GASID'S IN FORWARD.
C  NLMX   --- NUMBER OF TERMS TO INCLUDE IN FQ IN TV MODEL.
C  ZR     --- INPUT ATMOSPHERE ALTITUDES (KM).
C  TR     --- INPUT ATMOSPHERE TEMPERATURES (K).
C  TVPATH --- DIRECTORY PATH TO INITIAL TV'S.
C  VIBSTS --- UPPER/LOWER VIBRATIONAL STATE DESIGNATIONS IN FORWARD.
C
C OUTPUT PARAMETER:
C
C  TVIB   --- VIBRATIONAL TEMPERATURES FOR FORWARD MODEL RADIANCE
C             SIUMULATIONS (K). 
C
C SOFTWARE WRITTEN BY  Christopher J. Mertens
C                      NASA Langley Research Center
C                      Atmospheric Sciences Competency
C                      21 Langley Blvd., Mail Stop 401B
C                      Hampton, VA 23681-2199
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      PARAMETER(NVLEVMAX=150)
      CHARACTER*(*) TVPATH
      CHARACTER*8 VIBSTS(2,MGS),VSTATES(NVLEVMAX)
      DIMENSION IDG(MGS),NLMX(MGS),ZR(MR),TR(MR),TVIB(MR,MGS,2)
      DIMENSION VENG(NVLEVMAX),DEGEN(NVLEVMAX)
      DATA IDGO3/300/

      DO IG=1,NGAS
        IF(IDG(IG).GT.10000) THEN
          IGAS=IDG(IG)/1000000
          IGAS=IGAS*100
        ELSE
          IGAS=IDG(IG)/100
        ENDIF
        IF(IGAS.EQ.IDGO3) THEN
          IVTS=IDG(IG)/10000
          CALL KP_VSEDRD(LVSED,IVTS,NVLEVS,ABDISO,VENG,DEGEN,VSTATES)
          IF(NVLEVS.GT.NVLEVMAX) THEN
            WRITE(*,*) '!!!!!! DIMENSION ERROR NVLEVS > NVLEVMAX',
     &      NVLEVS,NVLEVMAX
            STOP 'ERROR IN TVO3INIT'
          ENDIF
          DO IS=1,2
            DO IV=1,NVLEVS
              IVV=IV
              IF(VIBSTS(IS,IG).EQ.VSTATES(IV)) GO TO 1
            ENDDO
            WRITE(*,900) IVTS,VIBSTS(IS,IG)
            STOP 'ERROR IN TVO3INIT'
 1          IF(VENG(IVV).GT.0.0D0) THEN
C              CALL KP_TVRD(LTV,MR,NR,IVTS,TVPATH,VSTATES(IVV),ZR,
C     &         TVIB(1,IG,IS)) 
              DO IL=1,NR
                TVIB(IL,IG,IS)=TR(IL)
              ENDDO
            ELSE
              DO IL=1,NR
                TVIB(IL,IG,IS)=TR(IL)
              ENDDO
            ENDIF
          ENDDO 
        ENDIF
      ENDDO     
      RETURN
 900  FORMAT('GASID ',I4,' STATE ',A8,' NOT FOUND IN VSED FILE')
      END  
