SUBROUTINE conrad(nfile)
  !
  ! $Author: CPTEC $
  ! $Date: 2000/02/24 13:15:43 $
  ! $Revision: 1.0 $
  !
  !read co2 transmission data from unit(nfile)for new vertical  
  !coordinate tests      ...                                  
  !these arrays used to be in block data    ...k.campana-mar 90 
  IMPLICIT NONE

  INCLUDE "parmeta.f90"
  INTEGER, PARAMETER :: ix=2*im-1,kx=lm
  INTEGER, INTENT(in out) :: nfile
  INTEGER, PARAMETER :: l=kx
  INTEGER, PARAMETER :: lp1=kx+1
  INTEGER, PARAMETER :: kp=kx+1
  INTEGER, PARAMETER :: lp12=lp1*lp1
  REAL, DIMENSION(lp1,2) :: sgtmp
  REAL, DIMENSION(l,6)  :: co21d
  REAL, DIMENSION(lp1,lp1,6) :: co22d
  REAL, DIMENSION(lp1,6) :: co21d3,co21d7
  INTEGER, DIMENSION(3) :: rsze
  REAL, DIMENSION(lp12) :: data2
  INTEGER :: rsize,i,k,kk,j,n,i1,i2
  REAL, DIMENSION(lp1,lp1) :: co251,co258,cdt51,cdt58,c2d51,c2d58
  REAL, DIMENSION(l) :: co2m51,co2m58,cdtm51,cdtm58,c2dm51,c2dm58
  REAL, DIMENSION(lp1) :: stemp,gtemp,co231,co238,cdt31,cdt38,c2d31
  REAL, DIMENSION(lp1) :: c2d38,co211,co218,co271,co278,cdt71,cdt78
  REAL, DIMENSION(lp1) :: c2d71,c2d78
  REAL ::  b0,b1,b2,b3


  !co2 data tables for user''s vertical coordinate
  !   the following common blocks contain pretabulated co2 transmission
  !       functions, evaluated using the methods of fels and
  !       schwarzkopf (1981) and schwarzkopf and fels (1985),
  !-----  the 2-dimensional arrays are
  !                    co2 transmission functions and their derivatives
  !        from 109-level line-by-line calculations made using the 1982
  !        mcclatchy tape (12511 lines),consolidated,interpolated
  !        to the nmc mrf vertical coordinatte,and re-consolidated to a
  !        200 cm-1 bandwidth. the interpolation method is described in
  !        schwarzkopf and fels (j.g.r.,1985).
  !-----  the 1-dim arrays are
  !                  co2 transmission functions and their derivatives
  !          for tau(i,i+1),i=1,l,
  !            where the values are not obtained by quadrature,but are the
  !            actual transmissivities,etc,between a pair of pressures.
  !          these used only for nearby layer calculations including qh2o.
  !-----  the weighting function gtemp=p(k)**0.2*(1.+p(k)/30000.)**0.8/
  !         1013250.,where p(k)=pressure,nmc mrf(new)  l18 data levels for
  !         pstar=1013250.
  !-----  stemp is us standard atmospheres,1976,at data pressure levels
  !        using nmc mrf sigmas,where pstar=1013.25 mb (ptz program)
  !***common co2bd3 contains co2 transmission functions and temperature
  !   and pressure derivatives for the 560-800 cm-1 band. also included
  !   are the standard temperatures and the weighting function. these
  !   data are in block data bd3:
  !         co251    =  transmission fctns for t0 (std. profile)
  !                       with p(sfc)=1013.25 mb
  !         co258    =  transmission fctns. for t0 (std. profile)
  !                       with p(sfc)= 810 mb
  !         cdt51    =  first temperature derivative of co251
  !         cdt58    =  first temperature derivative of co258
  !         c2d51    =  second temperature derivative of co251
  !         c2d58    =  second temperature derivative of co251
  !         co2m51   =  transmission fctns for t0 for adjacent pressure
  !                        levels, with no pressure quadrature. used for
  !                        nearby layer computations. p(sfc)=1013.25 mb
  !         co2m58   =  same as co2m51,with p(sfc)= 810 mb
  !         cdtm51   =  first temperature derivative of co2m51
  !         cdtm58   =  first temperature derivative of co2m58
  !         c2dm51   =  second temperature derivative of co2m51
  !         c2dm58   =  second temperature derivative of co2m58
  !         stemp    =  standard temperatures for model pressure level
  !                        structure with p(sfc)=1013.25 mb
  !         gtemp    =  weighting function for model pressure level
  !                        structure with p(sfc)=1013.25 mb.
  !-----       the following are still in block data
  !         b0       =  temp. coefficient used for co2 trans. fctn.
  !                        correction for t(k). (see ref. 4 and bd3)
  !         b1       =  temp. coefficient, used along with b0
  !         b2       =  temp. coefficient, used along with b0
  !         b3       =  temp. coefficient, used along with b0

  COMMON/co2bd3/co251,co258,cdt51,cdt58,c2d51,c2d58,co2m51,  &
       co2m58,cdtm51,cdtm58,c2dm51,c2dm58,stemp,gtemp,b0,b1,b2,b3

  !***common co2bd2 contains co2 transmission functions and temperature
  !   and pressure derivatives for the 560-670 cm-1 part of the 15 um
  !   co2 band.  these data are in block data bd2.
  !     for the 560-670 cm-1 band,only the (1,i) values are used , since
  !     these are used for cts computations.
  !         co231    =  transmission fctns for t0 (std. profile)
  !                       with p(sfc)=1013.25 mb
  !         co238    =  transmission fctns. for t0 (std. profile)
  !                       with p(sfc)= 810 mb
  !         cdt31    =  first temperature derivative of co231
  !         cdt38    =  first temperature derivative of co238
  !         c2d31    =  second temperature derivative of co231
  !         c2d38    =  second temperature derivative of co231
  COMMON / co2bd2 / co231,co238,cdt31,cdt38,c2d31,c2d38

  !***common co2bd4 contains co2 transmission functions and temperature
  !   and pressure derivatives for the 670-800 cm-1 part of the 15 um
  !   co2 band.  these data are in block data bd4.
  !         co271    =  transmission fctns for t0 (std. profile)
  !                       with p(sfc)=1013.25 mb
  !         co278    =  transmission fctns. for t0 (std. profile)
  !                       with p(sfc)= 810 mb
  !         cdt71    =  first temperature derivative of co271
  !         cdt78    =  first temperature derivative of co278
  !         c2d71    =  second temperature derivative of co271
  !         c2d78    =  second temperature derivative of co271
  COMMON / co2bd4 / co271,co278,cdt71,cdt78,c2d71,c2d78

  !the following not used in current version of radiation *******
  ! --common co2bd5 contains co2 transmission functions for the 2270-
  !                                  2380 part of the 4.3 um co2 band.
  !              these data are in block data bd5.
  !         co211    =  transmission fctns for t0 (std. profile)
  !                        with p(sfc)=1013.25 mb
  !         co218    =  transmission fctns. for t0 (std. profile)
  !                       with p(sfc)= 810 mb
  COMMON / co2bd5 / co211,co218
  !the above not used in current version of radiation

  !begin here to get constants for radiation package
  REWIND nfile

  !read in pre-computed co2 transmission data and convert to cyber words
  rsze(1) = lp1
  rsze(2) = l
  rsze(3) = lp1*lp1
  rsize = rsze(1)
  DO  kk=1,2
     !read(nfile) (data2(i),i=1,rsize)
     READ(nfile) (sgtmp(i,kk),i=1,rsize)
  END DO
  rsize = rsze(2)
  DO  kk=1,6
     !read(nfile) (data2(i),i=1,rsize)
     READ(nfile) (co21d(i,kk),i=1,rsize)
  END DO
  rsize = rsze(3)
  DO  kk=1,6
     !read(nfile) (data2(i),i=1,rsize)
     READ(nfile) (data2(i),i=1,rsize)
     n=0
     DO  i1=1,lp1
        DO  i2=1,lp1
           n=n+1
           co22d(i1,i2,kk)=data2(n)
        END DO
     END DO
  END DO
  rsize = rsze(1)
  DO  kk=1,6
     !read(nfile) (data2(i),i=1,rsize)
     READ(nfile) (co21d3(i,kk),i=1,rsize)
  END DO
  DO  kk=1,6
     !read(nfile) (data2(i),i=1,rsize)
     READ(nfile) (co21d7(i,kk),i=1,rsize)
  END DO
  REWIND nfile
  DO  k=1,lp1
     stemp(k) = sgtmp(k,1)
     gtemp(k) = sgtmp(k,2)
  END DO
  DO  k=1,l
     cdtm51(k) = co21d(k,1)
     co2m51(k) = co21d(k,2)
     c2dm51(k) = co21d(k,3)
     cdtm58(k) = co21d(k,4)
     co2m58(k) = co21d(k,5)
     c2dm58(k) = co21d(k,6)
  END DO
  DO  j=1,lp1
     DO  i=1,lp1
        cdt51(i,j) = co22d(i,j,1)
        co251(i,j) = co22d(i,j,2)
        c2d51(i,j) = co22d(i,j,3)
        cdt58(i,j) = co22d(i,j,4)
        co258(i,j) = co22d(i,j,5)
        c2d58(i,j) = co22d(i,j,6)
     END DO
  END DO
  DO  k=1,lp1
     cdt31(k) = co21d3(k,1)
     co231(k) = co21d3(k,2)
     c2d31(k) = co21d3(k,3)
     cdt38(k) = co21d3(k,4)
     co238(k) = co21d3(k,5)
     c2d38(k) = co21d3(k,6)
  END DO
  DO  k=1,lp1
     cdt71(k) = co21d7(k,1)
     co271(k) = co21d7(k,2)
     c2d71(k) = co21d7(k,3)
     cdt78(k) = co21d7(k,4)
     co278(k) = co21d7(k,5)
     c2d78(k) = co21d7(k,6)
  END DO
  PRINT 66,nfile
66 FORMAT(1H ,'----READ CO2 TRANSMISSION FUNCTIONS FROM UNIT ',i2)

  ! define tables for lw radiation
  CALL table
END SUBROUTINE conrad
