      SUBROUTINE SETCO2TVMDPRM(MWRKTVMDS,ML,IDAY,INITTV,NITN,NITD,NITC,
     &SZA,SZA_SECAPPRX,ZSTART,ZEND,ZINCTV,WRKTVMDS)
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C SETCO2TVMDPRM SETS UP NON-LTE CO2 TV MODEL PARAMETER SETTING FOR
C AN INITIAL RETRIEVAL OF KINETIC TEMPERATURE AND/OR CO2 VMR.
C
C INPUT PARAMETER:
C
C   MWRKTVMDS    --- MAXIMUM SIZE OF WRKTVMDS WORK ARRAY.
C   ML           --- MAXIMUM NUMBER OF LEVELS ON MODEL GRID.  
C   IDAY         --- DAYTIME FLAG (TRUE OR FALSE).
C   INITTV       --- INITIALIZE CO2 VIBRATIONAL TEMPERATURES (T OR F).
C   NITN         --- NUMBER OF ITERATIONS FOR CO2 15UM  (NIGHTTIME).
C   NITD         --- NUMBER OF ITERATIONS FOR CO2 4.3UM SYSTEM (DAY).
C   NITC         --- NUMBER OF ITERATIONS FOR CO2 15UM (DAY/ENHANCE). 
C   SZA          --- SOLAR ZENITH ANGLE (DEGREES)
C   SZA_SECAPPRX --- APPLY SOLAR ZENITH ANGLE APPROIMATION TO PHOTOLYSIS
C                    AND PHOTOABSORPTION RATES IF SZA<= SZA_SECAPPRX.
C   ZSTART       --- ALTITUDE TO BEGIN ONION-PEEL RETRIEVAL (KM).
C   ZEND         --- ALTITUDE TO END ONION-PEEL RETRIEVAL (KM).
C   ZINCTV       --- GRID SPACING FOR CO2 TVMODEL (KM).
C   WRKTVMDS     --- WORK ARRAY CONTAINING MOST OF THE PARAMETERS AND
C                    ARRAYS IN THE CO2 TV MODEL.
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
      LOGICAL IDAY,INITTV,ISECANT
      DIMENSION WRKTVMDS(MWRKTVMDS)
      COMMON/LWRKTVMDST/LIDAY,LINITTV,LLVSED,LLVSEDTV,LLTV,LLMCM,LLSHR,
     &LIFLUXAL,LICCM,LISLH,LISECANT,LNITN,LNITD,LNITC,LITVOPT,LITVOPTN2,
     &LMG3,LMSSPC,LMTBLTV,LMWRKTV,LNLTV,LNVTS,LIVTS,LIVTSN,LIVTSG3,
     &LITVID,LITVIDVMR,LNLMX,LNLMXVMR,LNMXTV,LIRADTV,LZATV,LABDISO,
     &LABDISOG3,LENGY,LENGYG3,LSZA,LCSSPC,LWRKTV,LTVTBL,LTVPOUT,LTVTOUT,
     &LTVSOUT,LPN21RMOD,LPN21TMOD,LTVRMOD,LTVTMOD,LTVRN2MOD,LTVTN2MOD,
     &LTVRG3,LTVTG3,LSLHRMOD,LSLHTMOD,LSLHKRMOD,LSLHKTMOD,LSPHARRMOD,
     &LSPHARTMOD,LHRRMOD,LHRTMOD,LFQQ,LFQQT,LFQQVMR,LFQQTVMR

      ISECANT=.FALSE.
      IF(SZA.LE.SZA_SECAPPRX) ISECANT=.TRUE.

      CALL KP_GETINT(IDAY,1,WRKTVMDS(LIDAY))
      CALL KP_GETINT(INITTV,1,WRKTVMDS(LINITTV))
      CALL KP_GETINT(ISECANT,1,WRKTVMDS(LISECANT))
      CALL KP_GETREAL(SZA,1,WRKTVMDS(LSZA))

      IF(IDAY) THEN
        CALL KP_GETINT(NITN,1,WRKTVMDS(LNITN))
        CALL KP_GETINT(NITD,1,WRKTVMDS(LNITD))
        CALL KP_GETINT(NITC,1,WRKTVMDS(LNITC))
      ELSE
        CALL KP_GETINT(NITN,1,WRKTVMDS(LNITN))
        CALL KP_GETINT(0,1,WRKTVMDS(LNITD))
        CALL KP_GETINT(0,1,WRKTVMDS(LNITC))
      ENDIF 

C      write(*,*) lnltv,lzatv   
      CALL SET_ZATV(ML,ZEND,ZSTART,ZINCTV,WRKTVMDS(LNLTV),
     &WRKTVMDS(LZATV))

      RETURN
      END
