C**********************************************************                  SW.2     
C             SUBROUTINE SW                                                  SW.3     
C**********************************************************                  SW.4     
      SUBROUTINE SW                                                          SW.5     
     :  (IAER,PAER,ZEPSCQ,ZEPSCT,ZEELOG,                                     SW.6     
     :   PSCT,PRMU0,PCARDI,PPSOL,PWV,                                        SW.7     
     :   PCLDSW,POZ,PPMB,PTAVE,PFDOWN,PFUP,                                  SW.8     
     :   PCG,POMEGA,PTAU,PALBS)                                              SW.9     
                                                                             SW.10    
C                                                                            SW.11    
C**** *SW* - COMPUTES THE SHORTWAVE RADIATION FLUXES.                        SW.12    
C                                                                            SW.13    
C     PURPOSE.                                                               SW.14    
C     --------                                                               SW.15    
C           COMPUTES THE SHORTWAVE RADIATION FLUXES IN TWO SPECTRAL          SW.16    
C     INTERVALS FOLLOWING FOUQUART AND BONNEL (1980).                        SW.17    
C                                                                            SW.18    
                                                                             SW.19    
C                                                                            SW.20    
C          1. COMPUTES ABSORBER AMOUNTS WITH TEMPERATURE AND PRESSURE        SW.21    
C     SCALING.                                                               SW.22    
C          2. COMPUTES UPWARD AND DOWNWARD FLUXES IN THE 0.25-0.68           SW.23    
C     MICRON SPECTRAL INTERVAL.                                              SW.24    
C          3. COMPUTES UPWARD AND DOWNWARD FLUXES IN THE 0.68-4.0            SW.25    
C     MICRON SPECTRAL INTERVAL.                                              SW.26    
C                                                                            SW.27    
C PMF 23-2-98                                                                SW.28    
C     ----------------------------------------------------------------       SW.29    
C                                                                            SW.30    
C                                                                            SW.31    
C                                                                            PARAM1.2     
C     Determines model resolution                                            PARAM1.3     
C                                                                            PARAM1.4     
      PARAMETER(NN=21,MM=21,NHEM=2,NL=5,MOCT=1,MG=64,JG=16,NWJ2=121          NETCDF.35    
     P         ,NCRAY=64,JGL=JG,NTRAC=1,NLEVRF=1)                            NETCDF.36    
                                                                             PARAM1.7     
C                                                                            PARAM1.8     
      INTEGER NLON,NLEV,NLM,KDLON,JLON,JK,IAER,KFLEV                         SW.33    
     : ,JKL,JAE,NLP,JKP1,JKLP1                                               SW.34    
      PARAMETER(NLON=1,NLEV=NL+1)                                            SW.35    
      PARAMETER (NLM=NLEV-1,KDLON=NLON                                       SW.36    
     :          ,KFLEV=NLEV,NLP=KFLEV+1)                                     SW.37    
c passed stuff                                                               SW.38    
      REAL ZEPSCQ,ZEPSCT,ZEELOG                                              SW.39    
      REAL PALBS(NLON,2),PFUP(NLON,NLP),PFDOWN(NLON,NLP)                     SW.40    
     :,     PPMB(NLON,NLP),PRMU0(NLON)                                       SW.41    
      REAL PTAVE(NLON,NLEV),POZ(NLON,NLEV),PCLDSW(NLON,NLEV)                 SW.42    
     :,    PTAU(NLON,2,NLEV),PCG(NLON,2,NLEV),PWV(NLON,NLEV)                 SW.43    
     :,    POMEGA(NLON,2,NLEV),PAER(NLON,NLEV,5)                             SW.44    
      REAL PPSOL(NLON)                                                       SW.45    
      REAL PSCT,PCARDI                                                       SW.46    
C*********************                                                       SW.47    
      REAL   ZAKI  (NLON , 2 )        ,                                      SW.48    
     S       ZCGAZ (NLON , NLEV)     ,                                       SW.49    
     S       ZC1I  (NLON , NLP)    ,                                         SW.50    
     S       ZDSIG (NLON , NLEV)     ,                                       SW.51    
     S       ZFACT (NLON)             ,                                      SW.52    
     S       ZFD   (NLON , NLP)    ,                                         SW.53    
     S       ZFU   (NLON , NLP)    ,                                         SW.54    
     S       ZG    (NLON)             ,                                      SW.55    
     S       ZGG   (NLON)             ,                                      SW.56    
     S       ZPIZAZ(NLON , NLEV)     ,                                       SW.57    
     S       ZRAYL (NLON),  ZRAY1 (NLON , NLP)                               SW.58    
      REAL                                                                   SW.59    
     S       ZRAY2 (NLON , NLP)    ,                                         SW.60    
     S       ZREF  (NLON)             ,                                      SW.61    
     S       ZREFZ (NLON , 2 , NLP),                                         SW.62    
     S       ZRE1  (NLON)             ,                                      SW.63    
     S       ZRE2  (NLON)             ,                                      SW.64    
     S       ZRJ   (NLON , 6 , NLP),                                         SW.65    
     S       ZRK   (NLON , 6 , NLP),                                         SW.66    
     S       ZRL   (NLON , 8)         ,                                      SW.67    
     S       ZRMU  (NLON)             ,                                      SW.68    
     S       ZRMUE (NLON , NLP)    ,                                         SW.69    
     S       ZRMUZ (NLON)                                                    SW.70    
      REAL                                                                   SW.71    
     S       ZRNEB (NLON)             ,                                      SW.72    
     S       ZRUEF (NLON , 8)         ,                                      SW.73    
     S       ZR1   (NLON)             ,                                      SW.74    
     S       ZR21  (NLON)             ,                                      SW.75    
     S       ZR22  (NLON)             ,                                      SW.76    
     S       ZR23  (NLON)             ,                                      SW.77    
     S       ZS    (NLON)             ,                                      SW.78    
     S       ZSEC  (NLON)             ,                                      SW.79    
     S       ZSS1  (NLON)             ,                                      SW.80    
     S       ZTAUAZ(NLON , NLEV)     ,                                       SW.81    
     S       ZTO1  (NLON)             ,                                      SW.82    
     S       ZTR   (NLON , 2 , NLP),                                         SW.83    
     S       ZTRA1 (NLON , NLP)    ,                                         SW.84    
     S       ZTRA2 (NLON , NLP)                                              SW.85    
      REAL                                                                   SW.86    
     S       ZTR1  (NLON)             ,                                      SW.87    
     S       ZTR2  (NLON)             ,                                      SW.88    
     S       ZUD   (NLON , 3 , NLP),                                         SW.89    
     S       ZUM   (NLON , NLP)    ,                                         SW.90    
     S       ZU1D  (NLON)             ,                                      SW.91    
     S       ZU2D  (NLON)             ,                                      SW.92    
     S       ZW    (NLON)             ,                                      SW.93    
     S       ZN175 (NLON)             ,                                      SW.94    
     S       ZN190 (NLON)             ,                                      SW.95    
     S       ZO175 (NLON)             ,                                      SW.96    
     S       ZO190 (NLON)             ,                                      SW.97    
     S       ZP75  (NLON)             ,                                      SW.98    
     S       ZP90  (NLON)             ,                                      SW.99    
     S       ZSIGN (NLON)             ,                                      SW.100   
     S       ZSIGO (NLON)                                                    SW.101   
      INTEGER in,ja,k,j,i,inu,jkm1,jaj,jkki,jn2j,jkkp4,kref                  SW.102   
      INTEGER jajp,jabs,jn                                                   SW.103   
      REAL xl2o,zpsig,ztray,zgar,zratio,zff,zfaoa,zfaoc                      SW.104   
      REAL zcorae,zcorcd,zmue,zgap,zbmu0,zww,zto,zden                        SW.105   
      REAL zmu1,zbmu1,zden1,zre11,zrmum1,zaa,zrki                            SW.106   
      REAL XL2, XL3, ALOS,SOLC,ZRT                                           SW.107   
      REAL ZWH2O,ZDSCO2,ZDSH2O                                               SW.108   
      REAL FOXDWN(NLON, NLP)                                                 SW.109   
      REAL CH2O,CCO2                                                         SW.110   
C SUSW and SUAER vairables                                                   SW.111   
      REAL SUN(2),D(2,3),APAD(2,3,7),BPAD(2,3,7),CRAY(2,6)                   SW.112   
      REAL TAUA(2,5),PIZA(2,5),CGA(2,5)                                      SW.113   
C                                                                            SW.114   
C                                                                            SW.115   
      CH2O   = 5.3669274E-03                                                 SW.116   
      CCO2   = 5.8269497E-03                                                 SW.117   
C SW aerosols init PMF 23-2-98                                               SW.118   
C                                                                            SW.119   
C                                                                            SW.120   
C      -------------------------------------------------------------         SW.121   
C                                                                            SW.122   
C*       1.    SHORTWAVE COEFFICIENTS                                        SW.123   
C              ----------------------                                        SW.124   
C                                                                            SW.125   
      DATA ((TAUA(IN,JA),JA=1,5),IN=1,2) /                                   SW.126   
     S .730719, .912819, .725059, .745405, .682188 ,                         SW.127   
     S .730719, .912819, .725059, .745405, .682188 /                         SW.128   
      DATA ((PIZA(IN,JA),JA=1,5),IN=1,2) /                                   SW.129   
     S .872212, .982545, .623143, .944887, .997975 ,                         SW.130   
     S .872212, .982545, .623143, .944887, .997975 /                         SW.131   
      DATA ((CGA (IN,JA),JA=1,5),IN=1,2) /                                   SW.132   
     S .647596, .739002, .580845, .662657, .624246 ,                         SW.133   
     S .647596, .739002, .580845, .662657, .624246 /                         SW.134   
C      -------------------------------------------------------------         SW.135   
C Init SW coeffs PMF 23-2-98                                                 SW.136   
C                                                                            SW.137   
C      ----------------------------------------------------------------      SW.138   
C                                                                            SW.139   
C*       1.    SET VALUES.                                                   SW.140   
C              -----------                                                   SW.141   
C    COEFFICIENTS FOR THE SHORTWAVE RADIATION SUBROUTINES                    SW.142   
C                                                                            SW.143   
C APAD  :  PADE APPROXIMANTS NUMERATOR                                       SW.144   
C BPAD  :  PADE APPROXIMANTS DENOMINATOR                                     SW.145   
C D     :  TRANSMISSION LIMIT FOR INFINITE ABSORBER AMOUNT                   SW.146   
C CRAY  :  RAYLEIGH SCATTERING COEFFICIENTS                                  SW.147   
C SUN   :  SOLAR FRACTION IN SPECTRAL INTERVALS                              SW.148   
C                                                                            SW.149   
      DATA SOLC/1376.0/                                                      SW.150   
      DATA SUN(1) / 0.441130 /                                               SW.151   
      DATA (D(1,K),K = 1,3) / 0.00, 0.00, 0.00 /                             SW.152   
c old without O2                                                             SW.153   
c      DATA ((APAD(1,I,J),I=1,3),J=1,7) /                                    SW.154   
c     S 0.000000000E-00, 0.000000000E-00, 0.925887084E-04,                   SW.155   
c     S 0.000000000E-00, 0.000000000E-00, 0.129353723E-01,                   SW.156   
c     S 0.000000000E-00, 0.000000000E-00, 0.800821928E+00,                   SW.157   
c     S 0.000000000E-00, 0.000000000E-00, 0.242715973E+02,                   SW.158   
c     S 0.000000000E-00, 0.000000000E-00, 0.878331486E+02,                   SW.159   
c     S 0.000000000E-00, 0.000000000E-00, 0.191559725E+02,                   SW.160   
c     S 0.000000000E-00, 0.000000000E-00, 0.000000000E+00 /                  SW.161   
C                                                                            SW.162   
c      DATA ((BPAD(1,I,J),I=1,3),J=1,7) /                                    SW.163   
c     S 0.000000000E-00, 0.000000000E-00, 0.925887084E-04,                   SW.164   
c     S 0.000000000E-00, 0.000000000E-00, 0.131812683E-01,                   SW.165   
c     S 0.000000000E-00, 0.000000000E-00, 0.812706117E+00,                   SW.166   
c     S 0.000000000E-00, 0.000000000E-00, 0.249863591E+02,                   SW.167   
c     S 0.000000000E-00, 0.000000000E-00, 0.931071925E+02,                   SW.168   
c     S 0.000000000E-00, 0.000000000E-00, 0.252233437E+02,                   SW.169   
c     S 0.000000000E-00, 0.000000000E-00, 0.100000000E+01 /                  SW.170   
C new with O2                                                                SW.171   
C                                                                            SW.172   
      DATA ((APAD(1,I,J),I=1,3),J=1,7) /                                     SW.173   
     S 0.000000000E-00, 0.000000000E-00,  0.200763774E+00,                   SW.174   
     S 0.000000000E-00, 0.000000000E-00,  0.273755555E+02,                   SW.175   
     S 0.000000000E-00, 0.000000000E-00,  0.759011354E+02,                   SW.176   
     S 0.000000000E-00, 0.000000000E-00, -0.542785355E+03,                   SW.177   
     S 0.000000000E-00, 0.000000000E-00,  0.771898951E+03,                   SW.178   
     S 0.000000000E-00, 0.000000000E-00,  0.240490730E+02,                   SW.179   
     S 0.000000000E-00, 0.000000000E-00,  0.000000000E+00 /                  SW.180   
C                                                                            SW.181   
      DATA ((BPAD(1,I,J),I=1,3),J=1,7) /                                     SW.182   
     S 0.000000000E-00, 0.000000000E-00,  0.200763774E+00,                   SW.183   
     S 0.000000000E-00, 0.000000000E-00,  0.278643596E+02,                   SW.184   
     S 0.000000000E-00, 0.000000000E-00,  0.827455632E+02,                   SW.185   
     S 0.000000000E-00, 0.000000000E-00, -0.561842163E+03,                   SW.186   
     S 0.000000000E-00, 0.000000000E-00,  0.768518240E+03,                   SW.187   
     S 0.000000000E-00, 0.000000000E-00,  0.727341645E+02,                   SW.188   
     S 0.000000000E-00, 0.000000000E-00,  0.100000000E+01 /                  SW.189   
C                                                                            SW.190   
      DATA (CRAY(1,K),K=1,6) /                                               SW.191   
     S .428937E-01, .890743E+00,-.288555E+01,                                SW.192   
     S .522744E+01,-.469173E+01, .161645E+01/                                SW.193   
C                                                                            SW.194   
c      DATA SUN(2) / 0.558324 /                                              SW.195   
      DATA SUN(2) / 0.557633 /                                               SW.196   
      DATA (D(2,K),K=1,3) / 0.317735694, 0.775570952, 0.800000000 /          SW.197   
c      DATA ((APAD(2,I,J),I=1,3),J=1,7) /                                    SW.198   
c     S 0.822745535E-02, 0.145321703E-04, 0.410177786E+03,                   SW.199   
c     S 0.705825794E+01, 0.175741897E-01, 0.672595424E+02,                   SW.200   
c     S 0.348747605E+03, 0.259696276E+01, 0.000000000E-00,                   SW.201   
c     S 0.174921268E+04, 0.599852834E+02, 0.000000000E-00,                   SW.202   
c     S 0.100138721E+04, 0.203510317E+03, 0.000000000E-00,                   SW.203   
c     S 0.518496206E+02, 0.757222990E+02, 0.000000000E-00,                   SW.204   
c     S 0.000000000E+00, 0.000000000E+00, 0.000000000E+00 /                  SW.205   
C                                                                            SW.206   
c      DATA ((BPAD(2,I,J),I=1,3),J=1,7) /                                    SW.207   
c     S 0.822745535E-02, 0.145321703E-04, 0.410177786E+03,                   SW.208   
c     S 0.719686994E+01, 0.176779370E-01, 0.731185438E+02,                   SW.209   
c     S 0.381961022E+03, 0.265802733E+01, 0.100000000E+01,                   SW.210   
c     S 0.219460901E+04, 0.634292876E+02, 0.000000000E+00,                   SW.211   
c     S 0.159321079E+04, 0.228829763E+03, 0.000000000E+00,                   SW.212   
c     S 0.138748279E+03, 0.992586506E+02, 0.000000000E+00,                   SW.213   
c     S 0.100000000E+01, 0.100000000E+01, 0.000000000E+00 /                  SW.214   
C                                                                            SW.215   
      DATA ((APAD(2,I,J),I=1,3),J=1,7) /                                     SW.216   
     S 0.822745535E-02, 0.145321703E-04, 0.262335915E+03,                    SW.217   
     S 0.705825794E+01, 0.175741897E-01, 0.368136730E+03,                    SW.218   
     S 0.348747605E+03, 0.259696276E+01, 0.000000000E-00,                    SW.219   
     S 0.174921268E+04, 0.599852834E+02, 0.000000000E-00,                    SW.220   
     S 0.100138721E+04, 0.203510317E+03, 0.000000000E-00,                    SW.221   
     S 0.518496206E+02, 0.757222990E+02, 0.000000000E-00,                    SW.222   
     S 0.000000000E+00, 0.000000000E+00, 0.000000000E+00 /                   SW.223   
C                                                                            SW.224   
      DATA ((BPAD(2,I,J),I=1,3),J=1,7) /                                     SW.225   
     S 0.822745535E-02, 0.145321703E-04, 0.262335915E+03,                    SW.226   
     S 0.719686994E+01, 0.176779370E-01, 0.368956332E+03,                    SW.227   
     S 0.381961022E+03, 0.265802733E+01, 0.100000000E+01,                    SW.228   
     S 0.219460901E+04, 0.634292876E+02, 0.000000000E+00,                    SW.229   
     S 0.159321079E+04, 0.228829763E+03, 0.000000000E+00,                    SW.230   
     S 0.138748279E+03, 0.992586506E+02, 0.000000000E+00,                    SW.231   
     S 0.100000000E+01, 0.100000000E+01, 0.000000000E+00 /                   SW.232   
                                                                             SW.233   
      DATA (CRAY(2,K),K=1,6) /                                               SW.234   
     S .697200E-02, .173297E-01,-.850903E-01,                                SW.235   
     S .248261E+00,-.302031E+00, .129662E+00/                                SW.236   
C                                                                            SW.237   
C*         1.     COMPUTES AMOUNTS OF ABSORBERS                              SW.238   
C                 -----------------------------                              SW.239   
C                                                                            SW.240   
C*         1.1    INITIALIZES QUANTITIES                                     SW.241   
C                 ----------------------                                     SW.242   
C                                                                            SW.243   
      DO 111 JLON = 1 , KDLON                                                SW.244   
        ZC1I(JLON,KFLEV+1)=0.                                                SW.245   
        ZUD(JLON,1,KFLEV+1)=0.                                               SW.246   
        ZUD(JLON,2,KFLEV+1)=0.                                               SW.247   
        ZUD(JLON,3,KFLEV+1)=0.                                               SW.248   
C        ZFACT(JLON)= PRMU0(JLON) * PSCT * RDAYL(JLON)                       SW.249   
        ZFACT(JLON)= PRMU0(JLON) * PSCT                                      SW.250   
        ZRMU(JLON)=SQRT(1224.* PRMU0(JLON) * PRMU0(JLON) + 1.) / 35.         SW.251   
        ZSEC(JLON)=1./ZRMU(JLON)                                             SW.252   
 111  CONTINUE                                                               SW.253   
C                                                                            SW.254   
C                                                                            SW.255   
C*         1.2    OZONE FOR DOWNWARD LOOKING PATH                            SW.256   
C                 -------------------------------                            SW.257   
C                                                                            SW.258   
 120  CONTINUE                                                               SW.259   
C                                                                            SW.260   
      DO 122 JK = 1 , KFLEV                                                  SW.261   
       JKL = KFLEV+1 - JK                                                    SW.262   
       JKLP1 = JKL + 1                                                       SW.263   
       DO 121 JLON = 1 , KDLON                                               SW.264   
        ZUD(JLON,3,JKL)=ZUD(JLON,3,JKLP1)+POZ(JLON,JKL)*ZSEC(JLON)           SW.265   
 121   CONTINUE                                                              SW.266   
 122  CONTINUE                                                               SW.267   
C                                                                            SW.268   
c          SCHUMANN-RUNGE and HERZBERG CONTINUUM (0.12 - 0.25 MICRON)        SW.269   
c          ----------------------------------------------------------        SW.270   
c                                                                            SW.271   
      ALOS=2.687E19                                                          SW.272   
      DO 50 JLON = 1 , KDLON                                                 SW.273   
        FOXDWN(JLON,1)=0.0                                                   SW.274   
        IF (PRMU0(JLON).GT.0.0001) THEN                                      SW.275   
          XL3=0.0                                                            SW.276   
          DO 55 JK=1,KFLEV                                                   SW.277   
            XL3=XL3+POZ(JLON,JK)*ZSEC(JLON)*ALOS                             SW.278   
   55     CONTINUE                                                           SW.279   
C                                                                            SW.280   
C set XL2O as mesopause value if too small                                   SW.281   
          XL2O=4.442E19*1.E-4*ZSEC(JLON)                                     SW.282   
C                                                                            SW.283   
          DO 60 JK=1,KFLEV                                                   SW.284   
            XL3=XL3-POZ(JLON,JK)*ZSEC(JLON)*ALOS                             SW.285   
C            XL2=4.442E19*PPMB(JLON,JK+1)*ZSEC(JLON)*100.0                   SW.286   
            XL2=MAX(4.442E19*PPMB(JLON,JK+1)*ZSEC(JLON)*100.0, XL2O)         SW.287   
C                                                                            SW.288   
            FOXDWN(JLON,JK+1) =                                              SW.289   
     *      (  0.913 *EXP(-5.500E-24*XL2-6.215E-18*XL3)                      SW.290   
     *    + 0.6308 *EXP(-1.342E-26*XL2-1.656E-18*XL3)                        SW.291   
     *    + 0.4*2.30E-3*EXP(-3.159E-20*XL2-1.857E-06*XL2**0.33837)           SW.292   
     *    + 0.4*3.00E-3*EXP(-2.261E-24*XL2-1.917E-14*XL2**0.78903)           SW.293   
     *    + 0.3*3.50E-3*EXP(-5.399E-24*XL2-2.466E-17*XL2**0.92105)           SW.294   
     *    + 0.3*2.80E-3*EXP(-3.406E-24*XL2-7.787E-18*XL2**0.9269 )           SW.295   
     *    + 0.1*0.1466 *EXP(-2.915E-25*XL2**1.06135                          SW.296   
     *                   - 1.866E-07*XL2**0.2895) )/SOLC                     SW.297   
C                                                                            SW.298   
   60     CONTINUE                                                           SW.299   
        ELSE                                                                 SW.300   
          DO 65 JK=KFLEV,1,-1                                                SW.301   
            FOXDWN(JLON,JK)=0.0                                              SW.302   
   65     CONTINUE                                                           SW.303   
        ENDIF                                                                SW.304   
   50 CONTINUE                                                               SW.305   
C                                                                            SW.306   
C*         1.3    OZONE FOR UPWARD LOOKING PATH AND OTHER ABSORBERS          SW.307   
C                 -------------------------------------------------          SW.308   
C                                                                            SW.309   
 130  CONTINUE                                                               SW.310   
C                                                                            SW.311   
      DO 131 JLON = 1 , KDLON                                                SW.312   
         ZUM(JLON,1) = ZUD(JLON,3,1)                                         SW.313   
         ZU1D(JLON) = 0.                                                     SW.314   
         ZU2D(JLON) = 0.                                                     SW.315   
         ZPSIG = PPSOL(JLON) / 101325.                                       SW.316   
         ZP75(JLON) = PPSOL(JLON) * ZPSIG ** 0.75                            SW.317   
         ZP90(JLON) = PPSOL(JLON) * ZPSIG ** 0.90                            SW.318   
         ZO175(JLON) = 1.0                                                   SW.319   
         ZO190(JLON) = 1.0                                                   SW.320   
         ZSIGO(JLON) = 1.0                                                   SW.321   
 131  CONTINUE                                                               SW.322   
C                                                                            SW.323   
      DO 133 JK = 1 , KFLEV                                                  SW.324   
         JKP1 = JK + 1                                                       SW.325   
         JKL = KFLEV+1 - JK                                                  SW.326   
         DO 132 JLON = 1 , KDLON                                             SW.327   
            ZUM(JLON,JKP1) = ZUM(JLON,JK) + POZ(JLON,JK) * 1.66              SW.328   
            ZRT = 273.15 / PTAVE(JLON,JK)                                    SW.329   
            ZWH2O = MAX(PWV(JLON,JK) , ZEPSCQ )                              SW.330   
            ZSIGN(JLON) = 100. * PPMB(JLON,JKP1) / PPSOL(JLON)               SW.331   
            ZDSIG(JLON,JK) = ZSIGO(JLON) - ZSIGN(JLON)                       SW.332   
            ZN175(JLON) = ZSIGN(JLON) ** 1.75                                SW.333   
            ZN190(JLON) = ZSIGN(JLON) ** 1.90                                SW.334   
            ZDSCO2 = ZO175(JLON) - ZN175(JLON)                               SW.335   
            ZDSH2O = ZO190(JLON) - ZN190(JLON)                               SW.336   
            ZUD(JLON,1,JK) = ZP90(JLON) * ZDSH2O*CH2O*ZWH2O  * ZRT **0.45    SW.337   
            ZUD(JLON,2,JK) = ZP75(JLON) * ZDSCO2*CCO2*PCARDI * ZRT **0.375   SW.338   
            ZU1D(JLON) = ZU1D(JLON) + ZUD(JLON,1,JK)                         SW.339   
            ZU2D(JLON) = ZU2D(JLON) + ZUD(JLON,2,JK)                         SW.340   
            ZSIGO(JLON) = ZSIGN(JLON)                                        SW.341   
            ZO175(JLON) = ZN175(JLON)                                        SW.342   
            ZO190(JLON) = ZN190(JLON)                                        SW.343   
 132     CONTINUE                                                            SW.344   
 133  CONTINUE                                                               SW.345   
C                                                                            SW.346   
C*         1.4    COMPUTES CLEAR-SKY GREY ABSORPTION COEFFICIENTS            SW.347   
C                 -----------------------------------------------            SW.348   
C                                                                            SW.349   
 140  CONTINUE                                                               SW.350   
C                                                                            SW.351   
      DO 141 JLON = 1 , KDLON                                                SW.352   
         ZU1D(JLON) = ZU1D(JLON) * ZSEC(JLON)                                SW.353   
         ZU2D(JLON) = ZU2D(JLON) * ZSEC(JLON)                                SW.354   
         ZW(JLON) = ZU1D(JLON)                                               SW.355   
 141  CONTINUE                                                               SW.356   
C                                                                            SW.357   
      CALL SWTT ( 2, 1, APAD,BPAD,D,ZW,ZR1)                                  SW.358   
C                                                                            SW.359   
      DO 142 JLON = 1 , KDLON                                                SW.360   
         ZAKI(JLON,1) = -LOG( ZR1 (JLON)) / ZU1D(JLON)                       SW.361   
         ZW(JLON) = ZU2D(JLON)                                               SW.362   
 142  CONTINUE                                                               SW.363   
C                                                                            SW.364   
      CALL SWTT ( 2, 2, APAD,BPAD,D,ZW,ZR1)                                  SW.365   
C                                                                            SW.366   
      DO 143 JLON = 1 , KDLON                                                SW.367   
         ZAKI(JLON,2) = -LOG( ZR1 (JLON)) / ZU2D(JLON)                       SW.368   
 143  CONTINUE                                                               SW.369   
C                                                                            SW.370   
C     ---------------------------------------------------------------        SW.371   
C                                                                            SW.372   
C*         2.     FIRST SPECTRAL INTERVAL (0.25-0.68 MICRON)                 SW.373   
C                 ----------------------- ------------------                 SW.374   
C                                                                            SW.375   
 200  CONTINUE                                                               SW.376   
C                                                                            SW.377   
      INU = 1                                                                SW.378   
C                                                                            SW.379   
C*         2.1    OPTICAL THICKNESS FOR RAYLEIGH SCATTERING                  SW.380   
C                 -----------------------------------------                  SW.381   
C                                                                            SW.382   
 210  CONTINUE                                                               SW.383   
C                                                                            SW.384   
      DO 211 JLON = 1 , KDLON                                                SW.385   
          ZRAYL(JLON) = CRAY(INU,1) + ZRMU(JLON)                             SW.386   
     :         * (CRAY(INU,2) + ZRMU(JLON)                                   SW.387   
     S         * (CRAY(INU,3) + ZRMU(JLON) * (CRAY(INU,4)+ZRMU(JLON)         SW.388   
     S         * (CRAY(INU,5) + ZRMU(JLON) *   CRAY(INU,6)))))               SW.389   
 211  CONTINUE                                                               SW.390   
C                                                                            SW.391   
C*         2.2    OPTICAL PARAMETERS FOR AEROSOLS AND RAYLEIGH               SW.392   
C                 --------------------------------------------               SW.393   
C                                                                            SW.394   
 220  CONTINUE                                                               SW.395   
C                                                                            SW.396   
      DO 225 JK = 1 , KFLEV                                                  SW.397   
         DO 221 JLON = 1 , KDLON                                             SW.398   
            ZCGAZ(JLON,JK) = 0.                                              SW.399   
            ZPIZAZ(JLON,JK) =  0.                                            SW.400   
            ZTAUAZ(JLON,JK) = 0.                                             SW.401   
 221     CONTINUE                                                            SW.402   
         DO 223 JAE=1,5                                                      SW.403   
            DO 222 JLON = 1 , KDLON                                          SW.404   
               ZTAUAZ(JLON,JK)=ZTAUAZ(JLON,JK)                               SW.405   
     S                      +PAER(JLON,JK,JAE)*TAUA(INU,JAE)                 SW.406   
               ZPIZAZ(JLON,JK)=ZPIZAZ(JLON,JK)+PAER(JLON,JK,JAE)             SW.407   
     S                   * TAUA(INU,JAE)*PIZA(INU,JAE)                       SW.408   
               ZCGAZ(JLON,JK) =  ZCGAZ(JLON,JK) +PAER(JLON,JK,JAE)           SW.409   
     S                   * TAUA(INU,JAE)*PIZA(INU,JAE)*CGA(INU,JAE)          SW.410   
 222        CONTINUE                                                         SW.411   
 223     CONTINUE                                                            SW.412   
C                                                                            SW.413   
         DO 224 JLON = 1 , KDLON                                             SW.414   
            IF(IAER.EQ.0) THEN                                               SW.415   
              ZCGAZ(JLON,JK) = 0.0                                           SW.416   
              ZPIZAZ(JLON,JK) = 1.0                                          SW.417   
            ELSE                                                             SW.418   
              ZCGAZ(JLON,JK) = ZCGAZ(JLON,JK) / ZPIZAZ(JLON,JK)              SW.419   
              ZPIZAZ(JLON,JK) = ZPIZAZ(JLON,JK) / ZTAUAZ(JLON,JK)            SW.420   
            ENDIF                                                            SW.421   
            ZTRAY = ZRAYL(JLON) * ZDSIG(JLON,JK)                             SW.422   
            ZRATIO = ZTRAY / (ZTRAY + ZTAUAZ(JLON,JK))                       SW.423   
            ZGAR = ZCGAZ(JLON,JK)                                            SW.424   
            ZFF = ZGAR * ZGAR                                                SW.425   
            ZTAUAZ(JLON,JK)=ZTRAY+ZTAUAZ(JLON,JK)                            SW.426   
     :                      *(1.-ZPIZAZ(JLON,JK)*ZFF)                        SW.427   
            ZCGAZ(JLON,JK) = ZGAR * (1. - ZRATIO) / (1. + ZGAR)              SW.428   
            ZPIZAZ(JLON,JK) =ZRATIO+(1.-ZRATIO)*ZPIZAZ(JLON,JK)              SW.429   
     S                   *(1.-ZFF) / (1. - ZPIZAZ(JLON,JK) * ZFF)            SW.430   
 224     CONTINUE                                                            SW.431   
 225  CONTINUE                                                               SW.432   
                                                                             SW.433   
C                                                                            SW.434   
C*         2.3    TOTAL EFFECTIVE CLOUDINESS ABOVE A GIVEN LEVEL             SW.435   
C                 ----------------------------------------------             SW.436   
C                                                                            SW.437   
 230  CONTINUE                                                               SW.438   
C                                                                            SW.439   
      DO 231 JLON = 1 , KDLON                                                SW.440   
         ZR23(JLON) = 0.                                                     SW.441   
         ZC1I(JLON,KFLEV+1) = 0.                                             SW.442   
 231  CONTINUE                                                               SW.443   
C                                                                            SW.444   
      DO 233 JK = 1 , KFLEV                                                  SW.445   
         JKL = KFLEV+1 - JK                                                  SW.446   
         JKLP1 = JKL + 1                                                     SW.447   
         DO 232 JLON = 1 , KDLON                                             SW.448   
           ZFAOA = 1.-ZPIZAZ(JLON,JKL)*ZCGAZ(JLON,JKL)*ZCGAZ(JLON,JKL)       SW.449   
           ZFAOC = 1. - POMEGA(JLON,INU,JKL) * PCG(JLON,INU,JKL)             SW.450   
     S                                       * PCG(JLON,INU,JKL)             SW.451   
           ZCORAE = ZFAOA * ZTAUAZ(JLON,JKL) * ZSEC(JLON)                    SW.452   
           ZCORCD = ZFAOC * PTAU(JLON,INU,JKL) * ZSEC(JLON)                  SW.453   
           ZR21(JLON) = EXP(-ZCORAE   )                                      SW.454   
           ZR22(JLON) = EXP(-ZCORCD   )                                      SW.455   
           ZSS1(JLON) = PCLDSW(JLON,JKL)*(1.0-ZR21(JLON)*ZR22(JLON))         SW.456   
     S               + (1.0-PCLDSW(JLON,JKL))*(1.0-ZR21(JLON))               SW.457   
           ZC1I(JLON,JKL) = 1.0-(1.0-ZSS1(JLON))*(1.0-ZC1I(JLON,JKLP1))      SW.458   
 232     CONTINUE                                                            SW.459   
 233  CONTINUE                                                               SW.460   
                                                                             SW.461   
C                                                                            SW.462   
C*         2.4    REFLECTIVITY/TRANSMISSIVITY FOR PURE SCATTERING            SW.463   
C                 -----------------------------------------------            SW.464   
C                                                                            SW.465   
 240  CONTINUE                                                               SW.466   
C                                                                            SW.467   
      DO 241 JLON = 1 , KDLON                                                SW.468   
         ZREFZ(JLON,2,1) = PALBS(JLON,INU)                                   SW.469   
         ZREFZ(JLON,1,1) = PALBS(JLON,INU)                                   SW.470   
 241  CONTINUE                                                               SW.471   
C                                                                            SW.472   
      DO 246 JK = 2 , KFLEV+1                                                SW.473   
         JKM1 = JK-1                                                         SW.474   
         DO 242 JLON = 1 , KDLON                                             SW.475   
            ZRNEB(JLON)= PCLDSW(JLON,JKM1)                                   SW.476   
             ZRE1(JLON)=0.                                                   SW.477   
            ZTR1(JLON)=0.                                                    SW.478   
            ZRE2(JLON)=0.                                                    SW.479   
            ZTR2(JLON)=0.                                                    SW.480   
C                                                                            SW.481   
C*         2.4.1  EQUIVALENT ZENITH ANGLE                                    SW.482   
C                 -----------------------                                    SW.483   
C                                                                            SW.484   
                                                                             SW.485   
 2410 CONTINUE                                                               SW.486   
C                                                                            SW.487   
            ZMUE = (1.-ZC1I(JLON,JK)) * ZSEC(JLON)                           SW.488   
     S            + ZC1I(JLON,JK) * 1.66                                     SW.489   
            ZRMUE(JLON,JK) = 1./ZMUE                                         SW.490   
C                                                                            SW.491   
C*         2.4.2  REFLECT./TRANSMISSIVITY DUE TO RAYLEIGH AND AEROSOLS       SW.492   
C                 ----------------------------------------------------       SW.493   
C                                                                            SW.494   
                                                                             SW.495   
 2420 CONTINUE                                                               SW.496   
C                                                                            SW.497   
            ZGAP = ZCGAZ(JLON,JKM1)                                          SW.498   
            ZBMU0 = 0.5 - 0.75 * ZGAP / ZMUE                                 SW.499   
            ZWW = ZPIZAZ(JLON,JKM1)                                          SW.500   
            ZTO = ZTAUAZ(JLON,JKM1)                                          SW.501   
            ZDEN = 1. + (1. - ZWW + ZBMU0 * ZWW) * ZTO * ZMUE                SW.502   
     S           + (1-ZWW) * (1. - ZWW +2.*ZBMU0*ZWW)*ZTO*ZTO*ZMUE*ZMUE      SW.503   
            ZRAY1(JLON,JKM1) = ZBMU0 * ZWW * ZTO * ZMUE / ZDEN               SW.504   
            ZTRA1(JLON,JKM1) = 1. / ZDEN                                     SW.505   
C                                                                            SW.506   
            ZMU1 = 0.5                                                       SW.507   
            ZBMU1 = 0.5 - 0.75 * ZGAP * ZMU1                                 SW.508   
            ZDEN1= 1. + (1. - ZWW + ZBMU1 * ZWW) * ZTO / ZMU1                SW.509   
     S           + (1-ZWW) * (1. - ZWW +2.*ZBMU1*ZWW)*ZTO*ZTO/ZMU1/ZMU1      SW.510   
            ZRAY2(JLON,JKM1) = ZBMU1 * ZWW * ZTO / ZMU1 / ZDEN1              SW.511   
            ZTRA2(JLON,JKM1) = 1. / ZDEN1                                    SW.512   
C                                                                            SW.513   
C*         2.4.3  EFFECT OF CLOUD LAYER                                      SW.514   
C                 ---------------------                                      SW.515   
C                                                                            SW.516   
 2430 CONTINUE                                                               SW.517   
C                                                                            SW.518   
            PTAU(JLON,INU,JKM1) = MAX( PTAU(JLON,INU,JKM1) , ZEPSCT )        SW.519   
            ZW(JLON) = POMEGA(JLON,INU,JKM1)                                 SW.520   
            ZTO1(JLON) = PTAU(JLON,INU,JKM1)/ZW(JLON)                        SW.521   
     S            + ZTAUAZ(JLON,JKM1)/ZPIZAZ(JLON,JKM1)                      SW.522   
            ZR21(JLON) = PTAU(JLON,INU,JKM1) + ZTAUAZ(JLON,JKM1)             SW.523   
            ZR22(JLON) = PTAU(JLON,INU,JKM1) / ZR21(JLON)                    SW.524   
            ZGG(JLON) = ZR22(JLON) * PCG(JLON,INU,JKM1)                      SW.525   
     S              + (1. - ZR22(JLON)) * ZCGAZ(JLON,JKM1)                   SW.526   
            ZW(JLON) = ZR21(JLON) / ZTO1(JLON)                               SW.527   
            ZREF(JLON) = ZREFZ(JLON,1,JKM1)                                  SW.528   
            ZRMUZ(JLON) = ZRMUE(JLON,JK)                                     SW.529   
 242     CONTINUE                                                            SW.530   
C                                                                            SW.531   
         CALL DEDD(ZGG,ZREF,ZRMUZ,ZTO1,ZW,ZRE1,ZTR1,ZRE2,ZTR2)               SW.532   
C                                                                            SW.533   
                                                                             SW.534   
         DO 245 JLON = 1 , KDLON                                             SW.535   
C                                                                            SW.536   
             ZREFZ(JLON,1,JK) = (1.-ZRNEB(JLON)) * (ZRAY1(JLON,JKM1)         SW.537   
     S                     + ZREFZ(JLON,1,JKM1) * ZTRA1(JLON,JKM1)           SW.538   
     S                     * ZTRA2(JLON,JKM1)                                SW.539   
     S                     /(1.-ZRAY2(JLON,JKM1)*ZREFZ(JLON,1,JKM1)))        SW.540   
     S                     + ZRNEB(JLON) * ZRE2(JLON)                        SW.541   
C                                                                            SW.542   
            ZTR(JLON,1,JKM1) = ZRNEB(JLON) * ZTR2(JLON) +                    SW.543   
     S                     (ZTRA1(JLON,JKM1)/(1.-ZRAY2(JLON,JKM1)            SW.544   
     S                     *ZREFZ(JLON,1,JKM1)))* (1.-ZRNEB(JLON))           SW.545   
C                                                                            SW.546   
 245     CONTINUE                                                            SW.547   
 246  CONTINUE                                                               SW.548   
C                                                                            SW.549   
C*         2.5    REFLECT./TRANSMISSIVITY BETWEEN SURFACE AND LEVEL          SW.550   
C                 -------------------------------------------------          SW.551   
C                                                                            SW.552   
                                                                             SW.553   
 250  CONTINUE                                                               SW.554   
C                                                                            SW.555   
      JAJ = 2                                                                SW.556   
      DO 251 JLON = 1 , KDLON                                                SW.557   
         ZRJ(JLON,JAJ,KFLEV+1) = 1.                                          SW.558   
         ZRK(JLON,JAJ,KFLEV+1) = ZREFZ(JLON, 1,KFLEV+1)                      SW.559   
 251  CONTINUE                                                               SW.560   
C                                                                            SW.561   
      DO 253 JK = 1 , KFLEV                                                  SW.562   
         JKL = KFLEV+1 - JK                                                  SW.563   
         JKLP1 = JKL + 1                                                     SW.564   
         DO 252 JLON = 1 , KDLON                                             SW.565   
            ZRE11= ZRJ(JLON,JAJ,JKLP1) * ZTR(JLON, 1,JKL)                    SW.566   
            ZRJ(JLON,JAJ,JKL) = ZRE11                                        SW.567   
            ZRK(JLON,JAJ,JKL) = ZRE11 * ZREFZ(JLON, 1,JKL)                   SW.568   
 252     CONTINUE                                                            SW.569   
 253  CONTINUE                                                               SW.570   
C                                                                            SW.571   
C*         2.6    OZONE ABSORPTION AND FLUXES                                SW.572   
C                 ---------------------------                                SW.573   
C                                                                            SW.574   
 260  CONTINUE                                                               SW.575   
C                                                                            SW.576   
      DO 264 JK = 1 , KFLEV+1                                                SW.577   
         JKL = KFLEV+1 - JK + 1                                              SW.578   
         DO 262 JLON = 1 , KDLON                                             SW.579   
            ZW(JLON) = ZUD(JLON,3,JKL)                                       SW.580   
 262     CONTINUE                                                            SW.581   
C                                                                            SW.582   
         CALL SWTT ( INU, 3, APAD,BPAD,D,ZW,ZR1)                             SW.583   
C                                                                            SW.584   
         DO 263 JLON = 1 , KDLON                                             SW.585   
           ZFD(JLON,JKL) = ZR1(JLON)*ZRJ(JLON,JAJ,JKL)*SUN(INU)              SW.586   
 263     CONTINUE                                                            SW.587   
 264  CONTINUE                                                               SW.588   
C                                                                            SW.589   
      DO 265 JLON = 1 , KDLON                                                SW.590   
         ZFU(JLON,1) = PALBS(JLON,INU) * ZFD(JLON,1)                         SW.591   
 265  CONTINUE                                                               SW.592   
C                                                                            SW.593   
      DO 268 JK = 1 , KFLEV+1                                                SW.594   
         DO 266 JLON = 1 , KDLON                                             SW.595   
            ZW(JLON) = ZUM(JLON,JK)                                          SW.596   
 266     CONTINUE                                                            SW.597   
C                                                                            SW.598   
         CALL SWTT ( INU, 3, APAD,BPAD,D,ZW,ZR1)                             SW.599   
C                                                                            SW.600   
         DO 267 JLON = 1 , KDLON                                             SW.601   
           ZFU(JLON,JK) = ZR1(JLON) * ZRK(JLON,JAJ,JK) * SUN(INU)            SW.602   
 267     CONTINUE                                                            SW.603   
 268  CONTINUE                                                               SW.604   
C                                                                            SW.605   
C                                                                            SW.606   
 878  FORMAT(1X,' LOOP ',I4,' SUCCESSFUL IN SW    INDEX=',I3)                SW.607   
C     ------------------------------------------------------------------     SW.608   
C                                                                            SW.609   
C*         3.     SECOND SPECTRAL INTERVAL (0.68-4.00 MICRON)                SW.610   
C                 ----------------------- -------------------                SW.611   
C                                                                            SW.612   
 300  CONTINUE                                                               SW.613   
C                                                                            SW.614   
      INU = 2                                                                SW.615   
C                                                                            SW.616   
C*         3.1    OPTICAL THICKNESS FOR RAYLEIGH SCATTERING                  SW.617   
C                 -----------------------------------------                  SW.618   
C                                                                            SW.619   
 310  CONTINUE                                                               SW.620   
C                                                                            SW.621   
      DO 311 JLON = 1 , KDLON                                                SW.622   
         ZRMUM1 = 1. - ZRMU(JLON)                                            SW.623   
         ZRAYL(JLON) = CRAY(INU,1) + ZRMUM1   * (CRAY(INU,2) + ZRMUM1        SW.624   
     S            * (CRAY(INU,3) + ZRMUM1   * (CRAY(INU,4) + ZRMUM1          SW.625   
     S            * (CRAY(INU,5) + ZRMUM1   *  CRAY(INU,6)       ))))        SW.626   
 311  CONTINUE                                                               SW.627   
C                                                                            SW.628   
C*         3.2    OPTICAL PARAMETERS FOR AEROSOLS AND RAYLEIGH               SW.629   
C                 --------------------------------------------               SW.630   
C                                                                            SW.631   
 320  CONTINUE                                                               SW.632   
C                                                                            SW.633   
      DO 325 JK = 1 , KFLEV                                                  SW.634   
         DO 321 JLON = 1 , KDLON                                             SW.635   
            ZCGAZ(JLON,JK) = 0.                                              SW.636   
            ZPIZAZ(JLON,JK) = 0.                                             SW.637   
            ZTAUAZ(JLON,JK) = 0.                                             SW.638   
 321     CONTINUE                                                            SW.639   
         DO 323 JAE=1,5                                                      SW.640   
            DO 322 JLON = 1 , KDLON                                          SW.641   
               ZTAUAZ(JLON,JK) = ZTAUAZ(JLON,JK) + PAER(JLON,JK,JAE)         SW.642   
     S                       * TAUA(INU,JAE)                                 SW.643   
               ZPIZAZ(JLON,JK) = ZPIZAZ(JLON,JK) + PAER(JLON,JK,JAE)         SW.644   
     S                       * TAUA(INU,JAE) * PIZA(INU,JAE)                 SW.645   
               ZCGAZ(JLON,JK) =  ZCGAZ(JLON,JK) + PAER(JLON,JK,JAE)          SW.646   
     S                   * TAUA(INU,JAE)*PIZA(INU,JAE)*CGA(INU,JAE)          SW.647   
 322        CONTINUE                                                         SW.648   
 323     CONTINUE                                                            SW.649   
         DO 324 JLON = 1 , KDLON                                             SW.650   
            IF(IAER.EQ.0) THEN                                               SW.651   
              ZCGAZ(JLON,JK) = 0.0                                           SW.652   
              ZPIZAZ(JLON,JK) = 1.0                                          SW.653   
            ELSE                                                             SW.654   
              ZCGAZ(JLON,JK) = ZCGAZ(JLON,JK) / ZPIZAZ(JLON,JK)              SW.655   
              ZPIZAZ(JLON,JK) = ZPIZAZ(JLON,JK) / ZTAUAZ(JLON,JK)            SW.656   
            ENDIF                                                            SW.657   
            ZTRAY = ZRAYL(JLON) * ZDSIG(JLON,JK)                             SW.658   
            ZRATIO = ZTRAY / (ZTRAY + ZTAUAZ(JLON,JK))                       SW.659   
            ZGAR = ZCGAZ(JLON,JK)                                            SW.660   
            ZFF = ZGAR * ZGAR                                                SW.661   
            ZTAUAZ(JLON,JK)=ZTRAY+ZTAUAZ(JLON,JK)                            SW.662   
     :                           *(1.-ZPIZAZ(JLON,JK)*ZFF)                   SW.663   
            ZCGAZ(JLON,JK) = ZGAR * (1. - ZRATIO) / (1. + ZGAR)              SW.664   
            ZPIZAZ(JLON,JK) = ZRATIO+(1. - ZRATIO)*ZPIZAZ(JLON,JK)           SW.665   
     S                   *(1.-ZFF) / (1. - ZPIZAZ(JLON,JK) * ZFF)            SW.666   
 324     CONTINUE                                                            SW.667   
 325  CONTINUE                                                               SW.668   
C                                                                            SW.669   
C*         3.3    TOTAL EFFECTIVE CLOUDINESS ABOVE A GIVEN LEVEL             SW.670   
C                 ----------------------------------------------             SW.671   
C                                                                            SW.672   
 330  CONTINUE                                                               SW.673   
C                                                                            SW.674   
      DO 331 JLON = 1 , KDLON                                                SW.675   
         ZR23(JLON) = 0.                                                     SW.676   
         ZC1I(JLON,KFLEV+1) = 0.                                             SW.677   
 331  CONTINUE                                                               SW.678   
      DO 333 JK = 1 , KFLEV                                                  SW.679   
         JKL = KFLEV+1 - JK                                                  SW.680   
         JKLP1 = JKL + 1                                                     SW.681   
         DO 332 JLON = 1 , KDLON                                             SW.682   
           ZFAOA =1.-ZPIZAZ(JLON,JKL)*ZCGAZ(JLON,JKL)*ZCGAZ(JLON,JKL)        SW.683   
           ZFAOC =1. - POMEGA(JLON,INU,JKL) * PCG(JLON,INU,JKL)              SW.684   
     S                                       * PCG(JLON,INU,JKL)             SW.685   
           ZCORAE = ZFAOA * ZTAUAZ(JLON,JKL) * ZSEC(JLON)                    SW.686   
           ZCORCD = ZFAOC * PTAU(JLON,INU,JKL) * ZSEC(JLON)                  SW.687   
           ZR21(JLON) = EXP(-ZCORAE   )                                      SW.688   
           ZR22(JLON) = EXP(-ZCORCD   )                                      SW.689   
           ZSS1(JLON) = PCLDSW(JLON,JKL)*(1.0-ZR21(JLON)*ZR22(JLON))         SW.690   
     S               + (1.0-PCLDSW(JLON,JKL))*(1.0-ZR21(JLON))               SW.691   
           ZC1I(JLON,JKL) = 1.0-(1.0-ZSS1(JLON))*(1.0-ZC1I(JLON,JKLP1))      SW.692   
 332     CONTINUE                                                            SW.693   
 333  CONTINUE                                                               SW.694   
C                                                                            SW.695   
C*         3.4    REFLECTIVITY/TRANSMISSIVITY FOR PURE SCATTERING            SW.696   
C                 -----------------------------------------------            SW.697   
C                                                                            SW.698   
 340  CONTINUE                                                               SW.699   
C                                                                            SW.700   
      DO 341 JLON = 1 , KDLON                                                SW.701   
         ZREFZ(JLON,2,1) = PALBS(JLON,INU)                                   SW.702   
         ZREFZ(JLON,1,1) = PALBS(JLON,INU)                                   SW.703   
 341  CONTINUE                                                               SW.704   
C                                                                            SW.705   
      DO 346 JK = 2 , KFLEV+1                                                SW.706   
         JKM1 = JK - 1                                                       SW.707   
         DO 342 JLON = 1 , KDLON                                             SW.708   
            ZRNEB(JLON) = PCLDSW(JLON,JKM1)                                  SW.709   
            ZRE1(JLON)=0.                                                    SW.710   
            ZTR1(JLON)=0.                                                    SW.711   
            ZRE2(JLON)=0.                                                    SW.712   
            ZTR2(JLON)=0.                                                    SW.713   
C                                                                            SW.714   
C*         3.4.1  EQUIVALENT ZENITH ANGLE                                    SW.715   
C                 -----------------------                                    SW.716   
C                                                                            SW.717   
 3410 CONTINUE                                                               SW.718   
C                                                                            SW.719   
            ZMUE = (1.-ZC1I(JLON,JK)) * ZSEC(JLON)                           SW.720   
     S           + ZC1I(JLON,JK) * 1.66                                      SW.721   
            ZRMUE(JLON,JK) = 1./ZMUE                                         SW.722   
C                                                                            SW.723   
C*         3.4.2  REFLECT./TRANSMISSIVITY DUE TO RAYLEIGH AND AEROSOLS       SW.724   
C                 ----------------------------------------------------       SW.725   
C                                                                            SW.726   
 3420 CONTINUE                                                               SW.727   
C                                                                            SW.728   
            ZGAP = ZCGAZ(JLON,JKM1)                                          SW.729   
            ZBMU0 = 0.5 - 0.75 * ZGAP / ZMUE                                 SW.730   
            ZWW = ZPIZAZ(JLON,JKM1)                                          SW.731   
            ZTO = ZTAUAZ(JLON,JKM1)                                          SW.732   
            ZDEN = 1. + (1. - ZWW + ZBMU0 * ZWW) * ZTO * ZMUE                SW.733   
     S           + (1-ZWW)*(1.-ZWW+2.*ZBMU0*ZWW)*ZTO*ZTO*ZMUE*ZMUE           SW.734   
            ZRAY1(JLON,JKM1) = ZBMU0 * ZWW * ZTO * ZMUE / ZDEN               SW.735   
            ZTRA1(JLON,JKM1) = 1. / ZDEN                                     SW.736   
C                                                                            SW.737   
            ZMU1 = 0.5                                                       SW.738   
            ZBMU1 = 0.5 - 0.75 * ZGAP * ZMU1                                 SW.739   
            ZDEN1= 1. + (1. - ZWW + ZBMU1 * ZWW) * ZTO / ZMU1                SW.740   
     S           + (1.-ZWW)*(1.-ZWW+2.*ZBMU1*ZWW)*ZTO*ZTO/ZMU1/ZMU1          SW.741   
            ZRAY2(JLON,JKM1) = ZBMU1 * ZWW * ZTO / ZMU1 / ZDEN1              SW.742   
            ZTRA2(JLON,JKM1) = 1. / ZDEN1                                    SW.743   
C                                                                            SW.744   
C*         3.4.3  EFFECT OF CLOUD LAYER                                      SW.745   
C                 ---------------------                                      SW.746   
C                                                                            SW.747   
 3430 CONTINUE                                                               SW.748   
C                                                                            SW.749   
            PTAU(JLON,INU,JKM1) = MAX( PTAU(JLON,INU,JKM1) , ZEPSCT )        SW.750   
            ZW(JLON) = POMEGA(JLON,INU,JKM1)                                 SW.751   
            ZTO1(JLON) = PTAU(JLON,INU,JKM1)/ZW(JLON)                        SW.752   
     S               + ZTAUAZ(JLON,JKM1)/ZPIZAZ(JLON,JKM1)                   SW.753   
            ZR21(JLON) = PTAU(JLON,INU,JKM1) + ZTAUAZ(JLON,JKM1)             SW.754   
            ZR22(JLON) = PTAU(JLON,INU,JKM1) / ZR21(JLON)                    SW.755   
            ZGG(JLON) = ZR22(JLON) * PCG(JLON,INU,JKM1)                      SW.756   
     S              + (1. - ZR22(JLON)) * ZCGAZ(JLON,JKM1)                   SW.757   
             ZW(JLON) = ZR21(JLON) / ZTO1(JLON)                              SW.758   
            ZREF(JLON)=ZREFZ(JLON,1,JKM1)                                    SW.759   
            ZRMUZ(JLON)=ZRMUE(JLON,JK)                                       SW.760   
 342     CONTINUE                                                            SW.761   
C                                                                            SW.762   
      CALL DEDD(ZGG,ZREF,ZRMUZ,ZTO1,ZW,ZRE1,ZTR1,ZRE2,ZTR2)                  SW.763   
C                                                                            SW.764   
                                                                             SW.765   
         DO 345 JLON = 1 , KDLON                                             SW.766   
C                                                                            SW.767   
            ZREFZ(JLON,2,JK) = (1.-ZRNEB(JLON)) * (ZRAY1(JLON,JKM1)          SW.768   
     S                     + ZREFZ(JLON,2,JKM1) * ZTRA1(JLON,JKM1)           SW.769   
     S                     * ZTRA2(JLON,JKM1) )                              SW.770   
     S                     + ZRNEB(JLON) * ZRE1(JLON)                        SW.771   
C                                                                            SW.772   
            ZTR(JLON,2,JKM1) = ZRNEB(JLON) * ZTR1(JLON)                      SW.773   
     S                     + ZTRA1(JLON,JKM1) * (1.-ZRNEB(JLON))             SW.774   
C                                                                            SW.775   
            ZREFZ(JLON,1,JK) = (1.-ZRNEB(JLON)) * (ZRAY1(JLON,JKM1)          SW.776   
     S                     + ZREFZ(JLON,1,JKM1) * ZTRA1(JLON,JKM1)           SW.777   
     S                     * ZTRA2(JLON,JKM1)                                SW.778   
     S                     / (1.-ZRAY2(JLON,JKM1)*ZREFZ(JLON,1,JKM1)))       SW.779   
     S                     + ZRNEB(JLON)*ZRE2(JLON)                          SW.780   
C                                                                            SW.781   
            ZTR(JLON,1,JKM1) = ZRNEB(JLON) * ZTR2(JLON)                      SW.782   
     S                     + (ZTRA1(JLON,JKM1)/ (1.-ZRAY2(JLON,JKM1)         SW.783   
     S                     * ZREFZ(JLON,1,JKM1)))* (1.-ZRNEB(JLON))          SW.784   
C                                                                            SW.785   
 345     CONTINUE                                                            SW.786   
 346  CONTINUE                                                               SW.787   
C                                                                            SW.788   
C*         3.5    REFLECT./TRANSMISSIVITY BETWEEN SURFACE AND LEVEL          SW.789   
C                 -------------------------------------------------          SW.790   
C                                                                            SW.791   
 350  CONTINUE                                                               SW.792   
C                                                                            SW.793   
      DO 354 JABS = 1 , 2                                                    SW.794   
         DO 351 JLON = 1 , KDLON                                             SW.795   
            ZRJ(JLON,JABS,KFLEV+1) = 1.                                      SW.796   
            ZRK(JLON,JABS,KFLEV+1) = ZREFZ(JLON,JABS,KFLEV+1)                SW.797   
 351     CONTINUE                                                            SW.798   
C                                                                            SW.799   
         DO 353 JK = 1 , KFLEV                                               SW.800   
            JKL = KFLEV+1 - JK                                               SW.801   
            JKLP1 = JKL + 1                                                  SW.802   
            DO 352 JLON = 1 , KDLON                                          SW.803   
               ZRE11 = ZRJ(JLON,JABS,JKLP1) * ZTR(JLON,JABS,JKL)             SW.804   
               ZRJ(JLON,JABS,JKL) = ZRE11                                    SW.805   
               ZRK(JLON,JABS,JKL) = ZRE11 * ZREFZ(JLON,JABS,JKL)             SW.806   
 352        CONTINUE                                                         SW.807   
 353     CONTINUE                                                            SW.808   
 354  CONTINUE                                                               SW.809   
C                                                                            SW.810   
C*         3.6    REFLECT./TRANSMISSIVITY WITH GREY ABSORPTION               SW.811   
C                 --------------------------------------------               SW.812   
C                                                                            SW.813   
 360  CONTINUE                                                               SW.814   
C                                                                            SW.815   
      JN = 2                                                                 SW.816   
C                                                                            SW.817   
      DO 369 JABS=1,2                                                        SW.818   
C                                                                            SW.819   
         DO 361 JLON = 1 , KDLON                                             SW.820   
            ZREFZ(JLON,2,1) = PALBS(JLON,INU)                                SW.821   
            ZREFZ(JLON,1,1) = PALBS(JLON,INU)                                SW.822   
 361     CONTINUE                                                            SW.823   
C                                                                            SW.824   
      DO 364 JK = 2 , KFLEV+1                                                SW.825   
         JKM1 = JK - 1                                                       SW.826   
         DO 362 JLON = 1 , KDLON                                             SW.827   
            ZRNEB(JLON) = PCLDSW(JLON,JKM1)                                  SW.828   
            ZAA = ZUD(JLON,JABS,JKM1)                                        SW.829   
            ZRKI = ZAKI(JLON,JABS)                                           SW.830   
            ZS(JLON) = EXP(-ZRKI * ZAA * 1.66)                               SW.831   
            ZG(JLON) = EXP(-ZRKI * ZAA / ZRMUE(JLON,JK))                     SW.832   
            ZTR1(JLON) = 0.                                                  SW.833   
            ZRE1(JLON) = 0.                                                  SW.834   
            ZTR2(JLON) = 0.                                                  SW.835   
            ZRE2(JLON) = 0.                                                  SW.836   
C                                                                            SW.837   
C*         3.6.1  INTRODUCING CLOUD EFFECTS                                  SW.838   
C                 -------------------------                                  SW.839   
C                                                                            SW.840   
 3610 CONTINUE                                                               SW.841   
C                                                                            SW.842   
            PTAU(JLON,INU,JKM1) = MAX( PTAU(JLON,INU,JKM1) , ZEPSCT )        SW.843   
            ZW(JLON)= POMEGA(JLON,INU,JKM1)                                  SW.844   
            ZTO1(JLON) = PTAU(JLON,INU,JKM1) / ZW(JLON)                      SW.845   
     S               + ZTAUAZ(JLON,JKM1) / ZPIZAZ(JLON,JKM1)                 SW.846   
     S               + ZAA * ZRKI                                            SW.847   
            ZR21(JLON) = PTAU(JLON,INU,JKM1) + ZTAUAZ(JLON,JKM1)             SW.848   
            ZR22(JLON) = PTAU(JLON,INU,JKM1) / ZR21(JLON)                    SW.849   
            ZGG(JLON) = ZR22(JLON) * PCG(JLON,INU,JKM1)                      SW.850   
     S              + (1. - ZR22(JLON)) * ZCGAZ(JLON,JKM1)                   SW.851   
            ZW(JLON) = ZR21(JLON) / ZTO1(JLON)                               SW.852   
            ZREF(JLON) = ZREFZ(JLON,1,JKM1)                                  SW.853   
            ZRMUZ(JLON) = ZRMUE(JLON,JK)                                     SW.854   
 362     CONTINUE                                                            SW.855   
C                                                                            SW.856   
         CALL DEDD(ZGG,ZREF,ZRMUZ,ZTO1,ZW,ZRE1,ZTR1,ZRE2,ZTR2)               SW.857   
C                                                                            SW.858   
         DO 363 JLON = 1 , KDLON                                             SW.859   
C                                                                            SW.860   
            ZREFZ(JLON,2,JK) = (1.-ZRNEB(JLON)) * (ZRAY1(JLON,JKM1)          SW.861   
     S                     + ZREFZ(JLON,2,JKM1) * ZTRA1(JLON,JKM1)           SW.862   
     S                     * ZTRA2(JLON,JKM1) ) * ZG(JLON) * ZS(JLON)        SW.863   
     S                     + ZRNEB(JLON) * ZRE1(JLON)                        SW.864   
C                                                                            SW.865   
            ZTR(JLON,2,JKM1)=ZRNEB(JLON)*ZTR1(JLON)                          SW.866   
     S              + (ZTRA1(JLON,JKM1)) * ZG(JLON) * (1.-ZRNEB(JLON))       SW.867   
C                                                                            SW.868   
            ZREFZ(JLON,1,JK)=(1.-ZRNEB(JLON))*(ZRAY1(JLON,JKM1)              SW.869   
     S             +ZREFZ(JLON,1,JKM1)*ZTRA1(JLON,JKM1)*ZTRA2(JLON,JKM1)     SW.870   
     S             /(1.-ZRAY2(JLON,JKM1)*ZREFZ(JLON,1,JKM1)))                SW.871   
     S             *ZG(JLON)*ZS(JLON)+ ZRNEB(JLON) * ZRE2(JLON)              SW.872   
C                                                                            SW.873   
            ZTR(JLON,1,JKM1)= ZRNEB(JLON) * ZTR2(JLON)                       SW.874   
     S                    + (ZTRA1(JLON,JKM1)/(1.-ZRAY2(JLON,JKM1)           SW.875   
     S                    * ZREFZ(JLON,1,JKM1)))                             SW.876   
     S                    * ZG(JLON) * (1. -ZRNEB(JLON))                     SW.877   
C                                                                            SW.878   
C                                                                            SW.879   
 363        CONTINUE                                                         SW.880   
 364     CONTINUE                                                            SW.881   
C                                                                            SW.882   
C*         3.6.2  REFLECT./TRANSMISSIVITY BETWEEN SURFACE AND LEVEL          SW.883   
C                 -------------------------------------------------          SW.884   
C                                                                            SW.885   
 3620 CONTINUE                                                               SW.886   
C                                                                            SW.887   
         DO 368 KREF=1,2                                                     SW.888   
C                                                                            SW.889   
            JN = JN + 1                                                      SW.890   
C                                                                            SW.891   
            DO 365 JLON = 1 , KDLON                                          SW.892   
               ZRJ(JLON,JN,KFLEV+1) = 1.                                     SW.893   
               ZRK(JLON,JN,KFLEV+1) = ZREFZ(JLON,KREF,KFLEV+1)               SW.894   
 365        CONTINUE                                                         SW.895   
C                                                                            SW.896   
            DO 367 JK = 1 , KFLEV                                            SW.897   
               JKL = KFLEV+1 - JK                                            SW.898   
               JKLP1 = JKL + 1                                               SW.899   
               DO 366 JLON = 1 , KDLON                                       SW.900   
                  ZRE11 = ZRJ(JLON,JN,JKLP1) * ZTR(JLON,KREF,JKL)            SW.901   
                  ZRJ(JLON,JN,JKL) = ZRE11                                   SW.902   
                  ZRK(JLON,JN,JKL) = ZRE11 * ZREFZ(JLON,KREF,JKL)            SW.903   
 366           CONTINUE                                                      SW.904   
 367        CONTINUE                                                         SW.905   
 368     CONTINUE                                                            SW.906   
 369  CONTINUE                                                               SW.907   
C                                                                            SW.908   
C*         3.7    UPWARD (ZRK) AND DOWNWARD (ZRJ) PSEUDO-FLUXES              SW.909   
C                 ---------------------------------------------              SW.910   
C                                                                            SW.911   
 370  CONTINUE                                                               SW.912   
C                                                                            SW.913   
      DO 374 JK = 1 , KFLEV+1                                                SW.914   
         DO 373 JAJ = 1 , 5 , 2                                              SW.915   
            JAJP = JAJ + 1                                                   SW.916   
            DO 372 JLON = 1 , KDLON                                          SW.917   
               ZRJ(JLON,JAJ,JK)= ZRJ(JLON,JAJ,JK) - ZRJ(JLON,JAJP,JK)        SW.918   
               ZRK(JLON,JAJ,JK)= ZRK(JLON,JAJ,JK) - ZRK(JLON,JAJP,JK)        SW.919   
               ZRJ(JLON,JAJ,JK)= MAX( ZRJ(JLON,JAJ,JK) , ZEELOG )            SW.920   
               ZRK(JLON,JAJ,JK)= MAX( ZRK(JLON,JAJ,JK) , ZEELOG )            SW.921   
 372        CONTINUE                                                         SW.922   
 373     CONTINUE                                                            SW.923   
 374  CONTINUE                                                               SW.924   
C                                                                            SW.925   
      DO 377 JK = 1 , KFLEV+1                                                SW.926   
         DO 376 JAJ = 2 , 6 , 2                                              SW.927   
            DO 375 JLON = 1 , KDLON                                          SW.928   
               ZRJ(JLON,JAJ,JK)= MAX( ZRJ(JLON,JAJ,JK) , ZEELOG )            SW.929   
               ZRK(JLON,JAJ,JK)= MAX( ZRK(JLON,JAJ,JK) , ZEELOG )            SW.930   
 375        CONTINUE                                                         SW.931   
 376     CONTINUE                                                            SW.932   
 377  CONTINUE                                                               SW.933   
C                                                                            SW.934   
C*         3.8    EFFECTIVE ABSORBER AMOUNTS BY INVERSE LAPLACE              SW.935   
C                 ---------------------------------------------              SW.936   
C                                                                            SW.937   
 380  CONTINUE                                                               SW.938   
C                                                                            SW.939   
      DO 387 JK = 1 , KFLEV+1                                                SW.940   
         JKKI = 1                                                            SW.941   
         DO 385 JAJ = 1 , 2                                                  SW.942   
            DO 384 JN = 1 , 2                                                SW.943   
               JN2J = JN + 2 * JAJ                                           SW.944   
               JKKP4 = JKKI + 4                                              SW.945   
C                                                                            SW.946   
C*         3.8.1  EFFECTIVE ABSORBER AMOUNTS                                 SW.947   
C                 ---------------------------------------------              SW.948   
C                                                                            SW.949   
 3810 CONTINUE                                                               SW.950   
C                                                                            SW.951   
C                                                                            SW.952   
               DO 3811 JLON = 1 , KDLON                                      SW.953   
                 ZW(JLON) = LOG( ZRJ(JLON,JN,JK) / ZRJ(JLON,JN2J,JK))        SW.954   
     S                   / ZAKI(JLON,JAJ)                                    SW.955   
 3811          CONTINUE                                                      SW.956   
C                                                                            SW.957   
C*         3.8.2  TRANSMISSION FUNCTION                                      SW.958   
C                 ---------------------                                      SW.959   
C                                                                            SW.960   
 3820 CONTINUE                                                               SW.961   
C                                                                            SW.962   
                CALL SWTT ( INU, JAJ,APAD,BPAD,D,ZW,ZR1)                     SW.963   
C                                                                            SW.964   
                DO 3821 JLON = 1 , KDLON                                     SW.965   
                   ZRL(JLON,JKKI) = ZR1(JLON)                                SW.966   
                   ZRUEF(JLON,JKKI) = ZW(JLON)                               SW.967   
                   ZW(JLON) = LOG( ZRK(JLON,JN,JK) / ZRK(JLON,JN2J,JK))      SW.968   
     S                    / ZAKI(JLON,JAJ)                                   SW.969   
 3821           CONTINUE                                                     SW.970   
C                                                                            SW.971   
                CALL SWTT ( INU, JAJ, APAD,BPAD,D,ZW,ZR1)                    SW.972   
C                                                                            SW.973   
                DO 383 JLON = 1 , KDLON                                      SW.974   
                   ZRL(JLON,JKKP4) = ZR1(JLON)                               SW.975   
                   ZRUEF(JLON,JKKP4) = ZW(JLON)                              SW.976   
 383            CONTINUE                                                     SW.977   
C                                                                            SW.978   
                JKKI=JKKI+1                                                  SW.979   
 384         CONTINUE                                                        SW.980   
 385      CONTINUE                                                           SW.981   
C                                                                            SW.982   
C*         3.8.3  UPWARD AND DOWNWARD FLUXES WITH H2O AND UMG ABSORPTION     SW.983   
C                 ------------------------------------------------------     SW.984   
C                                                                            SW.985   
 3830 CONTINUE                                                               SW.986   
C                                                                            SW.987   
          DO 386 JLON = 1 , KDLON                                            SW.988   
            PFDOWN(JLON,JK) = ZRJ(JLON,1,JK)*ZRL(JLON,1)*ZRL(JLON,3)         SW.989   
     S                      + ZRJ(JLON,2,JK)*ZRL(JLON,2)*ZRL(JLON,4)         SW.990   
            PFUP(JLON,JK)   = ZRK(JLON,1,JK)*ZRL(JLON,5)*ZRL(JLON,7)         SW.991   
     S                      + ZRK(JLON,2,JK)*ZRL(JLON,6)*ZRL(JLON,8)         SW.992   
 386      CONTINUE                                                           SW.993   
 387  CONTINUE                                                               SW.994   
C                                                                            SW.995   
C*         3.9    INTRODUCTION OF OZONE ABSORPTION                           SW.996   
C                 --------------------------------                           SW.997   
C                                                                            SW.998   
 390  CONTINUE                                                               SW.999   
C                                                                            SW.1000  
      JABS=3                                                                 SW.1001  
      DO 395 JK = 1 , KFLEV+1                                                SW.1002  
         DO 392 JLON = 1 , KDLON                                             SW.1003  
            ZW(JLON) = ZUD(JLON,JABS,JK)                                     SW.1004  
 392     CONTINUE                                                            SW.1005  
C                                                                            SW.1006  
         CALL SWTT ( INU, JABS, APAD,BPAD,D,ZW,ZR1)                          SW.1007  
C                                                                            SW.1008  
         DO 393 JLON = 1 , KDLON                                             SW.1009  
            PFDOWN(JLON,JK) = ZR1(JLON) * PFDOWN(JLON,JK) * SUN(INU)         SW.1010  
            ZW(JLON) = ZUM(JLON,JK)                                          SW.1011  
 393     CONTINUE                                                            SW.1012  
C                                                                            SW.1013  
         CALL SWTT ( INU, JABS,APAD,BPAD,D,ZW,ZR1)                           SW.1014  
C                                                                            SW.1015  
         DO 394 JLON = 1 , KDLON                                             SW.1016  
            PFUP(JLON,JK) = ZR1(JLON) * PFUP(JLON,JK) * SUN(INU)             SW.1017  
 394     CONTINUE                                                            SW.1018  
 395  CONTINUE                                                               SW.1019  
C                                                                            SW.1020  
C     ------------------------------------------------------------           SW.1021  
C                                                                            SW.1022  
C*         4.     NET TOTAL SHORTWAVE FLUXES                                 SW.1023  
C                 --------------------------                                 SW.1024  
C                                                                            SW.1025  
C 400  CONTINUE                                                              SW.1026  
CZ      DO 402 JK = 1 , KFLEV+1                                              SW.1027  
C         DO 401 JLON = 1 , KDLON                                            SW.1028  
C           PFUP(JLON,JK) = (PFUP(JLON,JK) +ZFU(JLON,JK)) * ZFACT(JLON)      SW.1029  
C           PFDOWN(JLON,JK)= (PFDOWN(JLON,JK)+ZFD(JLON,JK))*ZFACT(JLON)      SW.1030  
C 401     CONTINUE                                                           SW.1031  
C 402  CONTINUE                                                              SW.1032  
C                                                                            SW.1033  
C*         4.     NET TOTAL SHORTWAVE FLUXES                                 SW.1034  
C                 --------------------------                                 SW.1035  
C                                                                            SW.1036  
 400  CONTINUE                                                               SW.1037  
      DO 402 JK = 1 , KFLEV+1                                                SW.1038  
         DO 401 JLON = 1 , KDLON                                             SW.1039  
c            IF(ITASK.EQ.1)THEN                                              SW.1040  
c              PFUP(JLON,JK)   = ZFU(JLON,JK) * ZFACT(JLON)                  SW.1041  
c              PFDOWN(JLON,JK) = ZFD(JLON,JK) * ZFACT(JLON)                  SW.1042  
c            ELSE IF(ITASK.EQ.2)THEN                                         SW.1043  
c              PFUP(JLON,JK)   = PFUP(JLON,JK) * ZFACT(JLON)                 SW.1044  
c              PFDOWN(JLON,JK) = PFDOWN(JLON,JK) * ZFACT(JLON)               SW.1045  
c            ELSE IF(ITASK.EQ.3)THEN                                         SW.1046  
              PFUP(JLON,JK)=(PFUP(JLON,JK)+ZFU(JLON,JK))*ZFACT(JLON)         SW.1047  
              PFDOWN(JLON,JK) = (PFDOWN(JLON,JK) + ZFD(JLON,JK)              SW.1048  
     *                      + FOXDWN(JLON,JK)) * ZFACT(JLON)                 SW.1049  
c            ENDIF                                                           SW.1050  
 401     CONTINUE                                                            SW.1051  
 402  CONTINUE                                                               SW.1052  
C                                                                            SW.1053  
      RETURN                                                                 SW.1054  
      END                                                                    SW.1055  
