      subroutine satrad (
     1     g3, tb, xland,
     1     nx_p, ny_p, nztn_p
     1      )

      return
      end

      SUBROUTINE TBR_11m(CCL,T,PSIG,PS,TS,LAND
     &                 ,Q,DQ,QPH,KZ,TFB,G
     &                 ,CLTOT,CLFRAC,CLPTOP
     &                 ,CITOT,CIFRAC,CIPTOP
     &                 ,TIR,CATOT,CAPTOP)
C******************************************************************
C    CLDIAG: Diagnose cloud properties from CRAS RS files
C
C---COLUMN INTEGRATED CLOUD LIQUID AND ICE WATER (G/M**2), CLOUD TOP
C   PRESSURE AND FRACTION.
C   NOTE: CLOUD LIQUID AND ICE WATER IS G/KG*100. CLOUD TOP PRESSURE
C   IS SET WHEN THE CLOUD WATER INTEGRAL REACHES 10 G/M**2
C   ICE CLOUDS EXIST AT TEMP < TFB
C
C INPUT   DIM   DESCRIPTION
C   CCL   KZ    CLOUD AMOUNT (g/Kg*100), Water and Ice
C   T     KZ    Temp (K)
C   PSIG  KZ    Pressure on sigma (mb)
C   PS          Surface Pres (mb)
C   TS          Surface Temp (K)
C   LAND        Land flag
C   DCCL        Liquid cloud integration array
C   DCCI        Ice cloud integration array
C   Q     KZ    sigma
C   DQ    KZ    dsigma
C   QPH   KZ    sigma half levels
C   KZ          Number of vertical levels
C   TFB         Ice cloud temp limit (K)
C   G           Gravity (9.90616 m/s**2)
C
C   OUTPUT:
C   CLTOT  = TOTAL INTEGRATED LIQUID CLOUD (mm*100)
C   CLFRAC = CLOUD FRACTION %
C   CLPTOP = LIQUID CLOUD TOP PRESSURE (mb)
C   CITOT  = TOTAL INTEGRATED ICE CLOUD (mm*100)
C   CIPTOP = ICE CLOUD TOP PRESSURE (mb)
C   CIFRAC = ICE CLOUD FRACTION %
C   TIR    = CLOUD TOP TEMPERATURE (K)
C   CATOT  = TOTAL INTEGRATED CLOUD (mm*100)
C   CAPTOP = COMBINED CLOUD TOP PRESSURE (mb)
C
C                  *************************
C  VERSION     DATE         AUTHOR       DESCRIPTION
C    6.0     DEC  91        R.AUNE       ADDED TO POST5
C    6.1     MAR 92         R.AUNE       ADDED PHYS VARIABLES
C    6.1.1   JUN 92         R.AUNE       OUTPUT FOR ANAL OPTION
C    7.0.1   OCT 98         R.AUNE       CLEANED UP
C    7.0.2   MAY 04         R.AUNE       Weighted transmissivity
C******************************************************************
C
      include 'MAPSCON'

c     PARAMETER (LEVL=38)
      PARAMETER (LEVL=nztn_p)
      REAL CCL(*),T(*)
      REAL PSIG(*)
      REAL PS,TS,LAND
      REAL Q(*),DQ(*),QPH(*)
      REAL CLTOT,CLFRAC,CLPTOP
      REAL CITOT,CIFRAC,CIPTOP
      REAL TIR,CATOT,CAPTOP
      REAL DCCL(LEVL),DCCI(LEVL)
C
C---CFREE is clear flag (mb)
      DATA CWLMT,CILMT,CFREE/3.,10.,1050./
C
      GI=1./G
      CLTOT=0.
      CLFRAC=0.
      CLPTOP=CFREE
      CITOT=0.
      CIPTOP=CFREE
      CIFRAC=0.
C
C---Multiply skin temperature by typical emissivity.  Should be a function of
C   surface type.
      IF(LAND.EQ.0.)THEN
         TIR=TS*.995
      ELSE
         TIR=TS*.99
      ENDIF
      BTRR=0.
      CATOT=0.
      CAPTOP=CFREE
      CLDTPR=CFREE
      PGI=PS*GI
C
C---START VERTICAL LOOP
      DO 71 K=1,KZ
         DQPGI=DQ(K)*PGI
         PLV=Q(K)*PS
         DCCI(K)=0.
         DCCL(K)=0.
C---LIQUID CLOUD PATH AND LIQUID CLOUD-TOP PRESSURE
C   DCCL(g/m**2)=CCL(g/Kg /100)*dP(Kg/ms**2 *100)/g(m/s**2)
         IF(CCL(K).GT.0.)THEN
            DCCL(K)=CCL(K)*DQPGI
            CLTOT=CLTOT+DCCL(K)
            IF(CLPTOP.EQ.CFREE)THEN
               CLPTOP=PLV
               CLFRAC=100.
            ENDIF
         ENDIF
C---ICE CLOUD PATH AND CLOUD-TOP PRESSURE
         IF(CCL(K).LT.0.)THEN
            DCCI(K)=-CCL(K)*DQPGI
            CITOT(I)=CITOT(I)+DCCI(K)
            IF(CIPTOP(I).EQ.CFREE)THEN
               CIPTOP(I)=PLV
               CIFRAC(I)=100.
            ENDIF
         ENDIF
C---ABSOLUTE CLOUD-TOP PRESSURE
         IF(ABS(CCL(K)).GT.0.AND.CLDTPR.EQ.CFREE)THEN
            CLDTPR=PLV
         ENDIF
 71      CONTINUE
         CATOT=CLTOT+CITOT
C
C---COMPUTE RADIATIVE PROPERTIES AT LIQUID CLOUD-TOP
         IF(CATOT.GT.0.)THEN
C
C---MASS WEIGHTED TRANSMISSIVITY TO COMPUTE WINDO BRIGHTNESS TEMPERATURE
C   START WITH SURFACE SKIN TEMPERATURE AND INTEGRATE UPWARD
C   Autoconversion limit is used to estimate water cloud fraction/thickness
C   Ice cloud is weighted less (more transparent)
C   
C   NOTE: CLOUD NOT PREDICTED AT LOWEST LEVEL
         DO 76 K=KZ-1,1,-1
C---Water cloud
            IF(DCCL(K).GT.CWLMT)THEN
               CALL CLDLMT(T(K),   CL2RN)
               PATHMX=CL2RN*100000.*DQ(K)*PGI
               IF(DCCL(K).GE.PATHMX)THEN
                  TIR=T(K)
               ELSE
                  FRAC=(DCCL(K)/PATHMX)
                  TIR=T(K)*FRAC+TIR*(1.-FRAC)
               ENDIF
            ENDIF
C---Ice cloud
            IF(DCCI(K).GT.CILMT)THEN
               CALL CLDLMT(T(K),   CL2RN)
               PATHMX=CL2RN*100000.*DQ(K)*PGI
               IF(DCCI(K).GE.PATHMX)THEN
                  TIR=T(K)*.25+TIR*.75
               ELSE
                  FRAC=(DCCI(K)/PATHMX)**2*.25
                  TIR=T(K)*FRAC+TIR*(1.-FRAC)
               ENDIF
            ENDIF
 76      CONTINUE
      ELSE
         IF(CLTOT.EQ.0.)CLTOT=-1.
            IF(CATOT.EQ.0.)CATOT=-1.
            IF(CITOT.EQ.0.)CITOT=-1.
         ENDIF
C
C---ASSIGN NEW CLOUD-TOP PRESSURE (rma 16Jul03)
         CAPTOP=CLDTPR
 70   CONTINUE
C
      RETURN
      END
      SUBROUTINE CLDLMT(T,TFB,CL2RN)
C=================================================================
C   CLOUD AUTOCONVERSION LIMIT. UNITS = g/g
C   A FUNCTION OF TEMPERATURE
C   T      Temperature (K)
C   TFB    Ice cloud temperature (K)
C   CL2RN  Conversion limit, cloud q to precip q  (g/g)
C
C   USING A CUBIC FUNCTION
C   Limit=.0005 at T > 273, minimum=.000015 at T <= 248.  28Nov05
C   Slope is max at 261K, temperature at maximun ice growth
C=================================================================
C
      REAL T,CL2RN
C
      IF(T.GT.273.)THEN
         CL2RN=.0005
      ELSEIF(T.GT.TFB)THEN
         CL2RN=.0005-.00025*((273.-T)/12.)**3.
      ELSEIF(T.GT.249.)THEN
         CL2RN=.00025-.00022*((TFB-T)/12.)**3.
      ELSE
         CL2RN=.00003
      ENDIF
c     DENSITY=P/(287.*T)
c     WRITE(6,300)T,CL2RN,DENSITY
c300  FORMAT(1X,F6.1,' K  ',F9.6,' g/g  ',F8.2,' g/Kg')
C
      RETURN
      END

