C**********************************************************                  DEDD.2     
C             SUBROUTINE DEDD                                                DEDD.3     
C**********************************************************                  DEDD.4     
      SUBROUTINE DEDD(PGG,PREF,PRMUZ,PTO1,PW,PRE1,PTR1,PRE2,PTR2)            DEDD.5     
C                                                                            DEDD.6     
C**** *DEDD* - COMPUTES REFLECTIVITY, TRANSMISSIVITY OF A CLOUDY LAYER       DEDD.7     
C                                                                            DEDD.8     
C     PURPOSE.                                                               DEDD.9     
C     --------                                                               DEDD.10    
C           COMPUTES THE REFLECTIVITY AND TRANSMISSIVITY OF A CLOUDY         DEDD.11    
C     LAYER USING THE DELTA-EDDINGTON'S APPROXIMATION.                       DEDD.12    
C                                                                            DEDD.13    
C**   INTERFACE.                                                             DEDD.14    
C     ----------                                                             DEDD.15    
C          *DEDD* IS CALLED BY *SW*.                                         DEDD.16    
C                                                                            DEDD.17    
C                                                                            DEDD.18    
C        IMPLICIT ARGUMENTS                                                  DEDD.19    
C        --------------------                                                DEDD.20    
C                                                                            DEDD.21    
C     ==== INPUTS ===                                                        DEDD.22    
C PGG    : (NDLON)             ; ASSYMETRY FACTOR                            DEDD.23    
C PREF   : (NDLON)             ; REFLECTIVITY OF THE UNDERLYING LAYER        DEDD.24    
C PRMUZ  : (NDLON)             ; COSINE OF SOLAR ZENITH ANGLE                DEDD.25    
C PTO1   : (NDLON)             ; OPTICAL THICKNESS                           DEDD.26    
C PW     : (NDLON)             ; SINGLE SCATTERING ALBEDO                    DEDD.27    
C     ==== OUTPUTS ===                                                       DEDD.28    
C PRE1   : (NDLON)             ; LAYER REFLECTIVITY ASSUMING NO              DEDD.29    
C                              ; REFLECTION FROM UNDERLYING LAYER            DEDD.30    
C PTR1   : (NDLON)             ; LAYER TRANSMISSIVITY ASSUMING NO            DEDD.31    
C                              ; REFLECTION FROM UNDERLYING LAYER            DEDD.32    
C PRE2   : (NDLON)             ; LAYER REFLECTIVITY ASSUMING                 DEDD.33    
C                              ; REFLECTION FROM UNDERLYING LAYER            DEDD.34    
C PTR2   : (NDLON)             ; LAYER TRANSMISSIVITY ASSUMING               DEDD.35    
C                              ; REFLECTION FROM UNDERLYING LAYER            DEDD.36    
C                                                                            DEDD.37    
C     METHOD.                                                                DEDD.38    
C     -------                                                                DEDD.39    
C                                                                            DEDD.40    
C          STANDARD DELTA-EDDINGTON LAYER CALCULATIONS.                      DEDD.41    
C                                                                            DEDD.42    
C PMF 23-2-98                                                                DEDD.43    
      parameter(NLON=1)  !assumes 1  longitude only                          DEDD.44    
C     -------------------------------------------------------------          DEDD.45    
C                                                                            DEDD.46    
      REAL PGG(NLON),PREF(NLON),PRE1(NLON),PRE2(NLON)                        DEDD.47    
     : ,PRMUZ(NLON),PTO1(NLON)                                               DEDD.48    
     :  ,PTR1(NLON),PTR2(NLON),PW(NLON)                                      DEDD.49    
C                                                                            DEDD.50    
C*         1.      DELTA-EDDINGTON CALCULATIONS                              DEDD.51    
C                                                                            DEDD.52    
C                                                                            DEDD.53    
      DO 131 JLON =  1 , NLON                                                DEDD.54    
C                                                                            DEDD.55    
C*         1.1     SET UP THE DELTA-MODIFIED PARAMETERS                      DEDD.56    
C                                                                            DEDD.57    
C                                                                            DEDD.58    
         ZFF = PGG(JLON)*PGG(JLON)                                           DEDD.59    
         ZGP = PGG(JLON)/(1.+PGG(JLON))                                      DEDD.60    
         ZTOP = (1.- PW(JLON) * ZFF) * PTO1(JLON)                            DEDD.61    
         ZWCP = (1-ZFF)* PW(JLON) /(1.- PW(JLON) * ZFF)                      DEDD.62    
         ZDT = 2./3.                                                         DEDD.63    
         ZX1 = 1.-ZWCP*ZGP                                                   DEDD.64    
         ZWM = 1.-ZWCP                                                       DEDD.65    
         ZRM2 =  PRMUZ(JLON) * PRMUZ(JLON)                                   DEDD.66    
         ZZRK = SQRT(3.*ZWM*ZX1)                                             DEDD.67    
         ZX2 = 4.*(1.-ZZRK*ZZRK*ZRM2)                                        DEDD.68    
         ZRP = SQRT(3.*ZWM/ZX1)                                              DEDD.69    
         ZALPHA = 3.*ZWCP*ZRM2*(1.+ZGP*ZWM)/ZX2                              DEDD.70    
         ZBETA = 3.*ZWCP* PRMUZ(JLON) *(1.+3.*ZGP*ZRM2*ZWM)/ZX2              DEDD.71    
         ZEXMUO = EXP(-ZTOP/ PRMUZ(JLON) )                                   DEDD.72    
         ZEXKP = EXP(ZZRK*ZTOP)                                              DEDD.73    
         ZEXKM = 1./ZEXKP                                                    DEDD.74    
         ZXP2P = 1.+ZDT*ZRP                                                  DEDD.75    
         ZXM2P = 1.-ZDT*ZRP                                                  DEDD.76    
         ZAP2B = ZALPHA+ZDT*ZBETA                                            DEDD.77    
         ZAM2B = ZALPHA-ZDT*ZBETA                                            DEDD.78    
C                                                                            DEDD.79    
C*         1.2     WITHOUT REFLECTION FROM THE UNDERLYING LAYER              DEDD.80    
C                                                                            DEDD.81    
 120  CONTINUE                                                               DEDD.82    
C                                                                            DEDD.83    
         ZA11 = ZXP2P                                                        DEDD.84    
         ZA12 = ZXM2P                                                        DEDD.85    
         ZA13 = ZAP2B                                                        DEDD.86    
         ZA22 = ZXP2P*ZEXKP                                                  DEDD.87    
         ZA21 = ZXM2P*ZEXKM                                                  DEDD.88    
         ZA23 = ZAM2B*ZEXMUO                                                 DEDD.89    
         ZDENA = ZA11 * ZA22 - ZA21 * ZA12                                   DEDD.90    
         ZC1A = (ZA22*ZA13-ZA12*ZA23)/ZDENA                                  DEDD.91    
         ZC2A = (ZA11*ZA23-ZA21*ZA13)/ZDENA                                  DEDD.92    
         ZRI0A = ZC1A+ZC2A-ZALPHA                                            DEDD.93    
         ZRI1A = ZRP*(ZC1A-ZC2A)-ZBETA                                       DEDD.94    
         PRE1(JLON) = (ZRI0A-ZDT*ZRI1A)/ PRMUZ(JLON)                         DEDD.95    
         ZRI0B = ZC1A*ZEXKM+ZC2A*ZEXKP-ZALPHA*ZEXMUO                         DEDD.96    
         ZRI1B = ZRP*(ZC1A*ZEXKM-ZC2A*ZEXKP)-ZBETA*ZEXMUO                    DEDD.97    
         PTR1(JLON) = ZEXMUO+(ZRI0B+ZDT*ZRI1B)/ PRMUZ(JLON)                  DEDD.98    
C                                                                            DEDD.99    
C*         1.3     WITH REFLECTION FROM THE UNDERLYING LAYER                 DEDD.100   
C                                                                            DEDD.101   
 130  CONTINUE                                                               DEDD.102   
C                                                                            DEDD.103   
         ZB21 = ZA21- PREF(JLON) *ZXP2P*ZEXKM                                DEDD.104   
         ZB22 = ZA22- PREF(JLON) *ZXM2P*ZEXKP                                DEDD.105   
         ZB23 = ZA23- PREF(JLON) *ZEXMUO*(ZAP2B - PRMUZ(JLON) )              DEDD.106   
         ZDENB = ZA11 * ZB22 - ZB21 * ZA12                                   DEDD.107   
         ZC1B = (ZB22*ZA13-ZA12*ZB23)/ZDENB                                  DEDD.108   
         ZC2B = (ZA11*ZB23-ZB21*ZA13)/ZDENB                                  DEDD.109   
         ZRI0C = ZC1B+ZC2B-ZALPHA                                            DEDD.110   
         ZRI1C = ZRP*(ZC1B-ZC2B)-ZBETA                                       DEDD.111   
         PRE2(JLON) = (ZRI0C-ZDT*ZRI1C) / PRMUZ(JLON)                        DEDD.112   
         ZRI0D = ZC1B*ZEXKM + ZC2B*ZEXKP - ZALPHA*ZEXMUO                     DEDD.113   
         ZRI1D = ZRP * (ZC1B*ZEXKM - ZC2B*ZEXKP) - ZBETA*ZEXMUO              DEDD.114   
         PTR2(JLON) = ZEXMUO + (ZRI0D + ZDT*ZRI1D) / PRMUZ(JLON)             DEDD.115   
C                                                                            DEDD.116   
 131  CONTINUE                                                               DEDD.117   
      RETURN                                                                 DEDD.118   
      END                                                                    DEDD.119   
