C *****************************COPYRIGHT******************************             RAD_ALL.145   
C (c) CROWN COPYRIGHT 1996, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.146   
C                                                                                  RAD_ALL.147   
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.148   
C restrictions as set forth in the contract.                                       RAD_ALL.149   
C                                                                                  RAD_ALL.150   
C                Meteorological Office                                             RAD_ALL.151   
C                London Road                                                       RAD_ALL.152   
C                BRACKNELL                                                         RAD_ALL.153   
C                Berkshire UK                                                      RAD_ALL.154   
C                RG12 2SZ                                                          RAD_ALL.155   
C                                                                                  RAD_ALL.156   
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.157   
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.158   
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.159   
C Modelling at the above address.                                                  RAD_ALL.160   
C ******************************COPYRIGHT******************************            RAD_ALL.161   
C                                                                                  RAD_ALL.162   
!+ Subroutine to aggregate clouds into regions.                                    RAD_ALL.163   
!                                                                                  RAD_ALL.164   
! Method:                                                                          RAD_ALL.165   
!       The clouds in a layer are combined in groups to form regions               RAD_ALL.166   
!       which will be considered as bulk entities in the solution of the           RAD_ALL.167   
!       equation of transfer. The extents of these regions are also                RAD_ALL.168   
!       determined.                                                                RAD_ALL.169   
!                                                                                  RAD_ALL.170   
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.171   
!                                                                                  RAD_ALL.172   
! History:                                                                         RAD_ALL.173   
!       Version         Date                    Comment                            RAD_ALL.174   
!       HADAM3          05-06-96                Original Code                      RAD_ALL.175   
!                                               (J. M. Edwards)                    RAD_ALL.176   
!                                                                                  RAD_ALL.177   
! Description of Code:                                                             RAD_ALL.178   
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.179   
!                                                                                  RAD_ALL.180   
!- ---------------------------------------------------------------------           RAD_ALL.181   
      SUBROUTINE AGGREGATE_CLOUD(IERR                                              RAD_ALL.182   
     &   , N_PROFILE, N_LAYER, N_CLOUD_TOP                                         RAD_ALL.183   
     &   , I_CLOUD, I_CLOUD_REPRESENTATION, N_CLOUD_TYPE                           RAD_ALL.184   
     &   , FRAC_CLOUD                                                              RAD_ALL.185   
     &   , I_REGION_CLOUD, FRAC_REGION                                             RAD_ALL.186   
     &   , NPD_PROFILE, NPD_LAYER                                                  RAD_ALL.187   
     &   )                                                                         RAD_ALL.188   
!                                                                                  RAD_ALL.189   
!                                                                                  RAD_ALL.190   
!                                                                                  RAD_ALL.191   
      IMPLICIT NONE                                                                RAD_ALL.192   
!                                                                                  RAD_ALL.193   
!                                                                                  RAD_ALL.194   
!     DUMMY ARRAY SIZES                                                            RAD_ALL.195   
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.196   
     &     NPD_PROFILE                                                             RAD_ALL.197   
!             MAXIMUM NUMBER OF PROFILES                                           RAD_ALL.198   
     &   , NPD_LAYER                                                               RAD_ALL.199   
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.200   
!                                                                                  RAD_ALL.201   
!     INCLUDE COMDECKS                                                             RAD_ALL.202   
!     ------------------------------------------------------------------           STDIO3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       STDIO3A.3     
!                                                                                  STDIO3A.4     
!     MODULE TO SET UNIT NUMBERS FOR STANDARD I/O.                                 STDIO3A.5     
!                                                                                  STDIO3A.6     
      INTEGER                                                                      STDIO3A.7     
     &     IU_STDIN                                                                STDIO3A.8     
!             UNIT NUMBER FOR STANDARD INPUT                                       STDIO3A.9     
     &   , IU_STDOUT                                                               STDIO3A.10    
!             UNIT NUMBER FOR STANDARD OUTPUT                                      STDIO3A.11    
     *   , IU_ERR                                                                  STDIO3A.12    
!             UNIT NUMBER FOR ERROR MESSAGES                                       STDIO3A.13    
!                                                                                  STDIO3A.14    
      PARAMETER(                                                                   STDIO3A.15    
     &     IU_STDIN=5                                                              STDIO3A.16    
     &   , IU_STDOUT=6                                                             STDIO3A.17    
     *   , IU_ERR=6                                                                STDIO3A.18    
     &   )                                                                         STDIO3A.19    
!                                                                                  STDIO3A.20    
!     ------------------------------------------------------------------           STDIO3A.21    
!     ------------------------------------------------------------------           ERROR3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       ERROR3A.3     
!                                                                                  ERROR3A.4     
!     MODULE TO SET ERROR FLAGS IN THE RADIATION CODE.                             ERROR3A.5     
!                                                                                  ERROR3A.6     
      INTEGER                                                                      ERROR3A.7     
     &     I_NORMAL                                                                ERROR3A.8     
!             ERROR FREE CONDITION                                                 ERROR3A.9     
     &   , I_ERR_FATAL                                                             ERROR3A.10    
!             FATAL ERROR: IMMEDIATE RETURN                                        ERROR3A.11    
     &   , I_ABORT_CALCULATION                                                     ERROR3A.12    
!             CALCULATION ABORTED                                                  ERROR3A.13    
     &   , I_MISSING_DATA                                                          ERROR3A.14    
!             MISSING DATA ERROR: CONDITIONAL                                      ERROR3A.15    
     &   , I_ERR_IO                                                                ERROR3A.16    
!             I/O ERROR                                                            ERROR3A.17    
     &   , I_ERR_RANGE                                                             ERROR3A.18    
!             INTERPOLATION RANGE ERROR                                            ERROR3A.19    
     &   , I_ERR_EXIST                                                             ERROR3A.20    
!             EXISTENCE ERROR                                                      ERROR3A.21    
!                                                                                  ERROR3A.22    
      PARAMETER(                                                                   ERROR3A.23    
     &     I_NORMAL=0                                                              ERROR3A.24    
     &   , I_ERR_FATAL=1                                                           ERROR3A.25    
     &   , I_ABORT_CALCULATION=2                                                   ERROR3A.26    
     &   , I_MISSING_DATA=3                                                        ERROR3A.27    
     &   , I_ERR_IO=4                                                              ERROR3A.28    
     &   , I_ERR_RANGE=5                                                           ERROR3A.29    
     &   , I_ERR_EXIST=6                                                           ERROR3A.30    
     &   )                                                                         ERROR3A.31    
!                                                                                  ERROR3A.32    
!     ------------------------------------------------------------------           ERROR3A.33    
!     ------------------------------------------------------------------           DIMFIX3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       DIMFIX3A.3     
!                                                                                  DIMFIX3A.4     
!     MODULE TO SET INTERNAL DIMENSIONS TIED TO ALGORITHMS,                        DIMFIX3A.5     
!     MOSTLY FOR CLOUDS.                                                           DIMFIX3A.6     
!                                                                                  DIMFIX3A.7     
      INTEGER                                                                      DIMFIX3A.8     
     &     NPD_CLOUD_COMPONENT                                                     DIMFIX3A.9     
!             NUMBER OF COMPONENTS OF CLOUDS                                       DIMFIX3A.10    
     &   , NPD_CLOUD_TYPE                                                          DIMFIX3A.11    
!             NUMBER OF PERMITTED TYPES OF CLOUDS.                                 DIMFIX3A.12    
     &   , NPD_CLOUD_REPRESENTATION                                                DIMFIX3A.13    
!             NUMBER OF PERMITTED REPRESENTATIONS OF CLOUDS.                       DIMFIX3A.14    
     &   , NPD_OVERLAP_COEFF                                                       DIMFIX3A.15    
!             NUMBER OF OVERLAP COEFFICIENTS FOR CLOUDS                            DIMFIX3A.16    
     &   , NPD_SOURCE_COEFF                                                        DIMFIX3A.17    
!             NUMBER OF COEFFICIENTS FOR TWO-STREAM SOURCES                        DIMFIX3A.18    
     &   , NPD_REGION                                                              DIMFIX3A.19    
!             NUMBER OF REGIONS IN A LAYER                                         DIMFIX3A.20    
!                                                                                  DIMFIX3A.21    
      PARAMETER(                                                                   DIMFIX3A.22    
     &     NPD_CLOUD_COMPONENT=4                                                   DIMFIX3A.23    
     &   , NPD_CLOUD_TYPE=4                                                        DIMFIX3A.24    
     &   , NPD_CLOUD_REPRESENTATION=4                                              DIMFIX3A.25    
     &   , NPD_OVERLAP_COEFF=18                                                    DIMFIX3A.26    
     &   , NPD_SOURCE_COEFF=2                                                      DIMFIX3A.27    
     &   , NPD_REGION=3                                                            DIMFIX3A.28    
     &   )                                                                         DIMFIX3A.29    
!                                                                                  DIMFIX3A.30    
!     ------------------------------------------------------------------           DIMFIX3A.31    
!     ------------------------------------------------------------------           CLREPP3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLREPP3A.3     
!                                                                                  CLREPP3A.4     
!     MODULE TO SET REPRESENTATIONS OF CLOUDS.                                     CLREPP3A.5     
!                                                                                  CLREPP3A.6     
!     REPRESENTATIONS                                                              CLREPP3A.7     
      INTEGER                                                                      CLREPP3A.8     
     &     IP_CLOUD_HOMOGEN                                                        CLREPP3A.9     
!             ALL COMPONENTS ARE MIXED HOMOGENEOUSLY                               CLREPP3A.10    
     &   , IP_CLOUD_ICE_WATER                                                      CLREPP3A.11    
!             ICE AND WATER CLOUDS ARE TREATED SEPARATELY                          CLREPP3A.12    
     &   , IP_CLOUD_CONV_STRAT                                                     CLREPP3A.13    
!             CLOUDS ARE DIVIDED INTO HOMOGENEOUSLY MIXED                          CLREPP3A.14    
!             STRATIFORM AND CONVECTIVE PARTS                                      CLREPP3A.15    
     &   , IP_CLOUD_CSIW                                                           CLREPP3A.16    
!             CLOUDS DIVIDED INTO ICE AND WATER PHASES AND                         CLREPP3A.17    
!             INTO STRATIFORM AND CONVECTIVE COMPONENTS.                           CLREPP3A.18    
!                                                                                  CLREPP3A.19    
      PARAMETER(                                                                   CLREPP3A.20    
     &     IP_CLOUD_HOMOGEN=1                                                      CLREPP3A.21    
     &   , IP_CLOUD_ICE_WATER=2                                                    CLREPP3A.22    
     &   , IP_CLOUD_CONV_STRAT=3                                                   CLREPP3A.23    
     &   , IP_CLOUD_CSIW=4                                                         CLREPP3A.24    
     &   )                                                                         CLREPP3A.25    
!                                                                                  CLREPP3A.26    
!     TYPES OF CLOUDS:                                                             CLREPP3A.27    
      INTEGER                                                                      CLREPP3A.28    
     &     NP_CLOUD_TYPE(NPD_CLOUD_REPRESENTATION)                                 CLREPP3A.29    
!             NUMBER OF TYPE OF CLOUDS IN REPRESENTATION                           CLREPP3A.30    
!                                                                                  CLREPP3A.31    
      INTEGER                                                                      CLREPP3A.32    
     &     IP_CLOUD_TYPE_MAP(NPD_CLOUD_COMPONENT                                   CLREPP3A.33    
     &       , NPD_CLOUD_REPRESENTATION)                                           CLREPP3A.34    
!            MAP OF COMPONENTS CONTRIBUTING TO TYPES OF CLOUDS                     CLREPP3A.35    
!                                                                                  CLREPP3A.36    
!     ------------------------------------------------------------------           CLREPP3A.37    
!     ------------------------------------------------------------------           CLDTYP3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLDTYP3A.3     
!                                                                                  CLDTYP3A.4     
!     MODULE TO SET TYPES OF CLOUDS.                                               CLDTYP3A.5     
!                                                                                  CLDTYP3A.6     
      INTEGER                                                                      CLDTYP3A.7     
     &     IP_CLOUD_TYPE_HOMOGEN                                                   CLDTYP3A.8     
!             CLOUD COMPOSED OF MIXED WATER AND ICE                                CLDTYP3A.9     
     &   , IP_CLOUD_TYPE_WATER                                                     CLDTYP3A.10    
!             CLOUD COMPOSED ONLY OF WATER                                         CLDTYP3A.11    
     &   , IP_CLOUD_TYPE_ICE                                                       CLDTYP3A.12    
!             CLOUD COMPOSED ONLY OF ICE                                           CLDTYP3A.13    
     &   , IP_CLOUD_TYPE_STRAT                                                     CLDTYP3A.14    
!             MIXED-PHASE STRATIFORM CLOUD                                         CLDTYP3A.15    
     &   , IP_CLOUD_TYPE_CONV                                                      CLDTYP3A.16    
!             MIXED-PHASE CONVECTIVE CLOUD                                         CLDTYP3A.17    
     &   , IP_CLOUD_TYPE_SW                                                        CLDTYP3A.18    
!             STRATIFORM WATER CLOUD                                               CLDTYP3A.19    
     &   , IP_CLOUD_TYPE_SI                                                        CLDTYP3A.20    
!             STRATIFORM ICE CLOUD                                                 CLDTYP3A.21    
     &   , IP_CLOUD_TYPE_CW                                                        CLDTYP3A.22    
!             CONVECTIVE WATER CLOUD                                               CLDTYP3A.23    
     &   , IP_CLOUD_TYPE_CI                                                        CLDTYP3A.24    
!             CONVECTIVE ICE CLOUD                                                 CLDTYP3A.25    
!                                                                                  CLDTYP3A.26    
      PARAMETER(                                                                   CLDTYP3A.27    
     &     IP_CLOUD_TYPE_HOMOGEN=1                                                 CLDTYP3A.28    
     &   , IP_CLOUD_TYPE_WATER=1                                                   CLDTYP3A.29    
     &   , IP_CLOUD_TYPE_ICE=2                                                     CLDTYP3A.30    
     &   , IP_CLOUD_TYPE_STRAT=1                                                   CLDTYP3A.31    
     &   , IP_CLOUD_TYPE_CONV=2                                                    CLDTYP3A.32    
     &   , IP_CLOUD_TYPE_SW=1                                                      CLDTYP3A.33    
     &   , IP_CLOUD_TYPE_SI=2                                                      CLDTYP3A.34    
     &   , IP_CLOUD_TYPE_CW=3                                                      CLDTYP3A.35    
     &   , IP_CLOUD_TYPE_CI=4                                                      CLDTYP3A.36    
     &   )                                                                         CLDTYP3A.37    
!                                                                                  CLDTYP3A.38    
!     ------------------------------------------------------------------           CLDTYP3A.39    
!     ------------------------------------------------------------------           CLSCHM3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLSCHM3A.3     
!                                                                                  CLSCHM3A.4     
!     MODULE TO DEFINE REFERENCE NUMBERS FOR CLOUD SCHEMES.                        CLSCHM3A.5     
!                                                                                  CLSCHM3A.6     
      INTEGER                                                                      CLSCHM3A.7     
     &     IP_CLOUD_SCHMETZ                                                        CLSCHM3A.8     
!             SCHMETZ'S SCHEME                                                     CLSCHM3A.9     
     &   , IP_CLOUD_MIX_MAX                                                        CLSCHM3A.10    
!             MAXIMUM/RANDOM OVERLAP IN A MIXED COLUMN                             CLSCHM3A.11    
     &   , IP_CLOUD_MIX_RANDOM                                                     CLSCHM3A.12    
!             RANDOM OVERLAP IN A MIXED COLUMN                                     CLSCHM3A.13    
     &   , IP_CLOUD_COLUMN_MAX                                                     CLSCHM3A.14    
!             MAXIMUM OVERLAP IN A COLUMN MODEL                                    CLSCHM3A.15    
     &   , IP_CLOUD_CLEAR                                                          CLSCHM3A.16    
!             CLEAR COLUMN                                                         CLSCHM3A.17    
     &   , IP_CLOUD_TRIPLE                                                         CLSCHM3A.18    
!             MIXED COLUMN WITH SPLIT BETWEEN                                      CLSCHM3A.19    
!             CONVECTIVE AND LAYER CLOUD.                                          CLSCHM3A.20    
!                                                                                  CLSCHM3A.21    
      PARAMETER(                                                                   CLSCHM3A.22    
     &     IP_CLOUD_SCHMETZ=1                                                      CLSCHM3A.23    
     &   , IP_CLOUD_MIX_MAX=2                                                      CLSCHM3A.24    
     &   , IP_CLOUD_MIX_RANDOM=4                                                   CLSCHM3A.25    
     &   , IP_CLOUD_COLUMN_MAX=3                                                   CLSCHM3A.26    
     &   , IP_CLOUD_CLEAR=5                                                        CLSCHM3A.27    
     &   , IP_CLOUD_TRIPLE=6                                                       CLSCHM3A.28    
     &   )                                                                         CLSCHM3A.29    
!                                                                                  CLSCHM3A.30    
!     ------------------------------------------------------------------           CLSCHM3A.31    
!     ------------------------------------------------------------------           CLDREG3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLDREG3A.3     
!                                                                                  CLDREG3A.4     
!     MODULE TO DEFINE REFERENCE NUMBERS FOR REGIONS OF CLOUDS.                    CLDREG3A.5     
!                                                                                  CLDREG3A.6     
      INTEGER                                                                      CLDREG3A.7     
     &     IP_REGION_CLEAR                                                         CLDREG3A.8     
!             REFERENCE NUMBER FOR CLEAR-SKY REGION                                CLDREG3A.9     
     &   , IP_REGION_STRAT                                                         CLDREG3A.10    
!             REFERENCE NUMBER FOR STRATIFORM CLOUDY REGION                        CLDREG3A.11    
     &   , IP_REGION_CONV                                                          CLDREG3A.12    
!             REFERENCE NUMBER FOR CONVECTIVE CLOUDY REGION                        CLDREG3A.13    
!                                                                                  CLDREG3A.14    
      PARAMETER(                                                                   CLDREG3A.15    
     &     IP_REGION_CLEAR=1                                                       CLDREG3A.16    
     &   , IP_REGION_STRAT=2                                                       CLDREG3A.17    
     &   , IP_REGION_CONV=3                                                        CLDREG3A.18    
     &   )                                                                         CLDREG3A.19    
!                                                                                  CLDREG3A.20    
!     ------------------------------------------------------------------           CLDREG3A.21    
!                                                                                  RAD_ALL.210   
!     DUMMY VARIABLES.                                                             RAD_ALL.211   
      INTEGER   !, INTENT(OUT)                                                     RAD_ALL.212   
     &     IERR                                                                    RAD_ALL.213   
!             ERROR FLAG                                                           RAD_ALL.214   
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.215   
     &     N_PROFILE                                                               RAD_ALL.216   
!             NUMBER OF PROFILES                                                   RAD_ALL.217   
     &   , N_LAYER                                                                 RAD_ALL.218   
!             NUMBER OF LAYERS                                                     RAD_ALL.219   
     &   , N_CLOUD_TOP                                                             RAD_ALL.220   
!             TOPMOST CLOUDY LAYER                                                 RAD_ALL.221   
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.222   
     &     I_CLOUD                                                                 RAD_ALL.223   
!             CLOUD SCHEME USED                                                    RAD_ALL.224   
     &   , I_CLOUD_REPRESENTATION                                                  RAD_ALL.225   
!             REPRESENTATION OF CLOUDS USED                                        RAD_ALL.226   
     &   , N_CLOUD_TYPE                                                            RAD_ALL.227   
!             NUMBER OF TYPES OF CLOUD                                             RAD_ALL.228   
!                                                                                  RAD_ALL.229   
      REAL      !, INTENT(OUT)                                                     RAD_ALL.230   
     &     FRAC_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                      RAD_ALL.231   
!             FRACTIONS OF EACH TYPE OF CLOUD                                      RAD_ALL.232   
!                                                                                  RAD_ALL.233   
      INTEGER   !, INTENT(OUT)                                                     RAD_ALL.234   
     &     I_REGION_CLOUD(NPD_CLOUD_TYPE)                                          RAD_ALL.235   
!             REGIONS IN WHICH PARTICULAR TYPES OF CLOUD FALL                      RAD_ALL.236   
      REAL      !, INTENT(OUT)                                                     RAD_ALL.237   
     &     FRAC_REGION(NPD_PROFILE, NPD_LAYER, NPD_REGION)                         RAD_ALL.238   
!             FRACTIONS OF TOTAL CLOUD OCCUPIED BY EACH REGION                     RAD_ALL.239   
!                                                                                  RAD_ALL.240   
!                                                                                  RAD_ALL.241   
!     LOCAL VARIABLES                                                              RAD_ALL.242   
      INTEGER                                                                      RAD_ALL.243   
     &     I                                                                       RAD_ALL.244   
!            LOOP VARIABLE                                                         RAD_ALL.245   
     &   , L                                                                       RAD_ALL.246   
!            LOOP VARIABLE                                                         RAD_ALL.247   
     &   , K                                                                       RAD_ALL.248   
!            LOOP VARIABLE                                                         RAD_ALL.249   
!                                                                                  RAD_ALL.250   
!                                                                                  RAD_ALL.251   
!                                                                                  RAD_ALL.252   
      IF (I_CLOUD.EQ.IP_CLOUD_TRIPLE) THEN                                         RAD_ALL.253   
!                                                                                  RAD_ALL.254   
         IF (I_CLOUD_REPRESENTATION.EQ.IP_CLOUD_CSIW) THEN                         RAD_ALL.255   
!                                                                                  RAD_ALL.256   
            DO K=1, N_CLOUD_TYPE                                                   RAD_ALL.257   
               IF (K.EQ.IP_CLOUD_TYPE_SW) THEN                                     RAD_ALL.258   
                  I_REGION_CLOUD(K)=IP_REGION_STRAT                                RAD_ALL.259   
               ELSE IF (K.EQ.IP_CLOUD_TYPE_SI) THEN                                RAD_ALL.260   
                  I_REGION_CLOUD(K)=IP_REGION_STRAT                                RAD_ALL.261   
               ELSE IF (K.EQ.IP_CLOUD_TYPE_CW) THEN                                RAD_ALL.262   
                  I_REGION_CLOUD(K)=IP_REGION_CONV                                 RAD_ALL.263   
               ELSE IF (K.EQ.IP_CLOUD_TYPE_CI) THEN                                RAD_ALL.264   
                  I_REGION_CLOUD(K)=IP_REGION_CONV                                 RAD_ALL.265   
               ENDIF                                                               RAD_ALL.266   
            ENDDO                                                                  RAD_ALL.267   
!                                                                                  RAD_ALL.268   
            DO I=N_CLOUD_TOP, N_LAYER                                              RAD_ALL.269   
               DO L=1, N_PROFILE                                                   RAD_ALL.270   
                  FRAC_REGION(L, I, IP_REGION_STRAT)                               RAD_ALL.271   
     &               =FRAC_CLOUD(L, I, IP_CLOUD_TYPE_SW)                           RAD_ALL.272   
     &               +FRAC_CLOUD(L, I, IP_CLOUD_TYPE_SI)                           RAD_ALL.273   
                  FRAC_REGION(L, I, IP_REGION_CONV)                                RAD_ALL.274   
     &               =FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CW)                           RAD_ALL.275   
     &               +FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CI)                           RAD_ALL.276   
               ENDDO                                                               RAD_ALL.277   
            ENDDO                                                                  RAD_ALL.278   
!                                                                                  RAD_ALL.279   
         ELSE IF (I_CLOUD_REPRESENTATION.EQ.IP_CLOUD_CONV_STRAT) THEN              RAD_ALL.280   
!                                                                                  RAD_ALL.281   
            DO K=1, N_CLOUD_TYPE                                                   RAD_ALL.282   
               IF (K.EQ.IP_CLOUD_TYPE_STRAT) THEN                                  RAD_ALL.283   
                  I_REGION_CLOUD(K)=IP_REGION_STRAT                                RAD_ALL.284   
               ELSE IF (K.EQ.IP_CLOUD_TYPE_CONV) THEN                              RAD_ALL.285   
                  I_REGION_CLOUD(K)=IP_REGION_CONV                                 RAD_ALL.286   
               ENDIF                                                               RAD_ALL.287   
            ENDDO                                                                  RAD_ALL.288   
!                                                                                  RAD_ALL.289   
            DO I=N_CLOUD_TOP, N_LAYER                                              RAD_ALL.290   
               DO L=1, N_PROFILE                                                   RAD_ALL.291   
                  FRAC_REGION(L, I, IP_REGION_STRAT)                               RAD_ALL.292   
     &               =FRAC_CLOUD(L, I, IP_CLOUD_TYPE_STRAT)                        RAD_ALL.293   
                  FRAC_REGION(L, I, IP_REGION_CONV)                                RAD_ALL.294   
     &               =FRAC_CLOUD(L, I, IP_CLOUD_TYPE_CONV)                         RAD_ALL.295   
               ENDDO                                                               RAD_ALL.296   
            ENDDO                                                                  RAD_ALL.297   
!                                                                                  RAD_ALL.298   
!                                                                                  RAD_ALL.299   
         ELSE                                                                      RAD_ALL.300   
            WRITE(IU_ERR, '(/A)')                                                  RAD_ALL.301   
     &         '*** ERROR: THIS REPRESENTATION OF CLOUDS IS NOT '                  RAD_ALL.302   
     &         //'COMPATIBLE WITH THE TRIPLE OVERLAP.'                             RAD_ALL.303   
            IERR=I_ERR_FATAL                                                       RAD_ALL.304   
            RETURN                                                                 RAD_ALL.305   
         ENDIF                                                                     RAD_ALL.306   
!                                                                                  RAD_ALL.307   
      ENDIF                                                                        RAD_ALL.308   
!                                                                                  RAD_ALL.309   
!                                                                                  RAD_ALL.310   
!                                                                                  RAD_ALL.311   
      RETURN                                                                       RAD_ALL.312   
      END   
