C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.21209 
C                                                                                  RAD_ALL.21210 
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.21211 
C restrictions as set forth in the contract.                                       RAD_ALL.21212 
C                                                                                  RAD_ALL.21213 
C                Meteorological Office                                             RAD_ALL.21214 
C                London Road                                                       RAD_ALL.21215 
C                BRACKNELL                                                         RAD_ALL.21216 
C                Berkshire UK                                                      RAD_ALL.21217 
C                RG12 2SZ                                                          RAD_ALL.21218 
C                                                                                  RAD_ALL.21219 
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.21220 
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.21221 
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.21222 
C Modelling at the above address.                                                  RAD_ALL.21223 
C ******************************COPYRIGHT******************************            RAD_ALL.21224 
C                                                                                  RAD_ALL.21225 
!+ Subroutine to read a shortwave spectral namelist.                               RAD_ALL.21226 
!                                                                                  RAD_ALL.21227 
! Purpose:                                                                         RAD_ALL.21228 
!   To read a shortwave namelist into a spectral array.                            RAD_ALL.21229 
!                                                                                  RAD_ALL.21230 
! Method:                                                                          RAD_ALL.21231 
!   The spectrum is read into the dynamically allocated array                      RAD_ALL.21232 
!   and then reduced to a more manageable size.                                    RAD_ALL.21233 
!                                                                                  RAD_ALL.21234 
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.21235 
!                                                                                  RAD_ALL.21236 
! History:                                                                         RAD_ALL.21237 
!       Version         Date                    Comment                            RAD_ALL.21238 
!       4.0             27-07-95                Original Code                      RAD_ALL.21239 
!                                               (J. M. Edwards)                    RAD_ALL.21240 
!       4.1             14-05-96                Set lower limits                   RAD_ALL.21241 
!                                               for reduced dimensions             RAD_ALL.21242 
!                                               to ensure that they                RAD_ALL.21243 
!                                               may never be 0.                    RAD_ALL.21244 
!                                               (J. M. Edwards)                    RAD_ALL.21245 
!       4.4             02-09-97                Aerosol flags passed               RAD_ALL.21246 
!                                               in to the code to                  RAD_ALL.21247 
!                                               enable only those                  RAD_ALL.21248 
!                                               required to be                     RAD_ALL.21249 
!                                               selected. Spectral                 RAD_ALL.21250 
!                                               data are now longer                RAD_ALL.21251 
!                                               compressed into a                  RAD_ALL.21252 
!                                               single array.                      RAD_ALL.21253 
!                                               Actual IOS code put                RAD_ALL.21254 
!                                               into CMESSAGE.                     RAD_ALL.21255 
!                                               (J. M. Edwards)                    RAD_ALL.21256 
!                                                                                  RAD_ALL.21257 
! Description of Code:                                                             RAD_ALL.21258 
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.21259 
!                                                                                  RAD_ALL.21260 
!- ---------------------------------------------------------------------           RAD_ALL.21261 
      SUBROUTINE R2_SW_SPECIN(IERR, CMESSAGE                                       RAD_ALL.21262 
     &   , L_CLIMAT_AEROSOL, L_USE_SULPC_DIRECT                                    RAD_ALL.21263 
     &   )                                                                         RAD_ALL.21264 
!                                                                                  RAD_ALL.21265 
!                                                                                  RAD_ALL.21266 
!     ------------------------------------------------------------------           MXSIZE3A.2     
!     MODULE SETTING MAXIMUM DIMENSIONS OF ARRAYS IN THE RADIATION CODE.           MXSIZE3A.3     
!                                                                                  MXSIZE3A.4     
      INTEGER                                                                      MXSIZE3A.5     
     &     NPD_TYPE                                                                MXSIZE3A.6     
!             NUMBER OF TYPES OF DATA                                              MXSIZE3A.7     
     &   , NPD_BAND                                                                MXSIZE3A.8     
!             NUMBER OF SPECTRAL BANDS                                             MXSIZE3A.9     
     &   , NPD_EXCLUDE                                                             MXSIZE3A.10    
!             NUMER OF EXCLUDED BANDS                                              MXSIZE3A.11    
     &   , NPD_SPECIES                                                             MXSIZE3A.12    
!             NUMBER OF GASEOUS SPECIES                                            MXSIZE3A.13    
     &   , NPD_ESFT_TERM                                                           MXSIZE3A.14    
!             NUMBER OF ESFT TERMS                                                 MXSIZE3A.15    
     &   , NPD_SCALE_FNC                                                           MXSIZE3A.16    
!             NUMBER OF SCALING FUNCTIONS                                          MXSIZE3A.17    
     &   , NPD_SCALE_VARIABLE                                                      MXSIZE3A.18    
!             NUMBER OF SCALING VARIABLES                                          MXSIZE3A.19    
     &   , NPD_SURFACE                                                             MXSIZE3A.20    
!             NUMBER OF SURFACE TYPES                                              MXSIZE3A.21    
     &   , NPD_ALBEDO_PARM                                                         MXSIZE3A.22    
!             NUMBER OF ALBEDO PARAMETERS                                          MXSIZE3A.23    
     &   , NPD_CONTINUUM                                                           MXSIZE3A.24    
!             NUMBER OF CONTINUA                                                   MXSIZE3A.25    
     &   , NPD_DROP_TYPE                                                           MXSIZE3A.26    
!             NUMBER OF DROP TYPES                                                 MXSIZE3A.27    
     &   , NPD_ICE_TYPE                                                            MXSIZE3A.28    
!             NUMBER OF ICE CRYSTAL TYPES                                          MXSIZE3A.29    
     &   , NPD_AEROSOL_SPECIES                                                     MXSIZE3A.30    
!             NUMBER OF AEROSOL SPECIES                                            MXSIZE3A.31    
     &   , NPD_CLOUD_PARAMETER                                                     MXSIZE3A.32    
!             MAX NUMBER OF CLOUD PARAMETERS                                       MXSIZE3A.33    
     &   , NPD_HUMIDITIES                                                          MXSIZE3A.34    
!             MAXIMUM NUMBER OF HUMIDITIES                                         MXSIZE3A.35    
     &   , NPD_THERMAL_COEFF                                                       MXSIZE3A.36    
!             NUMBER OF THERMAL COEFFICIENTS                                       MXSIZE3A.37    
!                                                                                  MXSIZE3A.38    
      PARAMETER(                                                                   MXSIZE3A.39    
     &     NPD_TYPE=15                                                             MXSIZE3A.40    
     &   , NPD_BAND=20                                                             MXSIZE3A.41    
     &   , NPD_EXCLUDE=2                                                           MXSIZE3A.42    
     &   , NPD_SPECIES=15                                                          MXSIZE3A.43    
     &   , NPD_ESFT_TERM=16                                                        MXSIZE3A.44    
     &   , NPD_SCALE_FNC=3                                                         MXSIZE3A.45    
     &   , NPD_SCALE_VARIABLE=4                                                    MXSIZE3A.46    
     &   , NPD_THERMAL_COEFF=9                                                     MXSIZE3A.47    
     &   , NPD_SURFACE=1                                                           MXSIZE3A.48    
     &   , NPD_ALBEDO_PARM=4                                                       MXSIZE3A.49    
     &   , NPD_CONTINUUM=2                                                         MXSIZE3A.50    
     &   , NPD_DROP_TYPE=6                                                         MXSIZE3A.51    
     &   , NPD_ICE_TYPE=7                                                          MXSIZE3A.52    
     &   , NPD_CLOUD_PARAMETER=30                                                  MXSIZE3A.53    
     &   , NPD_AEROSOL_SPECIES=7                                                   MXSIZE3A.54    
     &   , NPD_HUMIDITIES=21                                                       MXSIZE3A.55    
     &   )                                                                         MXSIZE3A.56    
!     ------------------------------------------------------------------           MXSIZE3A.57    
!                                                                                  RAD_ALL.21268 
!                                                                                  RAD_ALL.21269 
!     DUMMY ARGUMENTS                                                              RAD_ALL.21270 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.21271 
     &     L_CLIMAT_AEROSOL                                                        RAD_ALL.21272 
!             CLIMATOLOGICAL AEROSOLS ARE TO BE INCLUDED                           RAD_ALL.21273 
     &   , L_USE_SULPC_DIRECT                                                      RAD_ALL.21274 
!             THE DIRECT EFFECTS OF SULPHATE AEROSOLS ARE                          RAD_ALL.21275 
!             TO BE INCLUDED                                                       RAD_ALL.21276 
!                                                                                  RAD_ALL.21277 
      INTEGER   !, INTENT(OUT)                                                     RAD_ALL.21278 
     &     IERR                                                                    RAD_ALL.21279 
!             ERROR FLAG                                                           RAD_ALL.21280 
      CHARACTER*80      !, INTENT(OUT)                                             RAD_ALL.21281 
     &     CMESSAGE                                                                RAD_ALL.21282 
!                                                                                  RAD_ALL.21283 
!                                                                                  RAD_ALL.21284 
!                                                                                  RAD_ALL.21285 
!     LOCAL VARIABLES.                                                             RAD_ALL.21286 
!                                                                                  RAD_ALL.21287 
      CHARACTER*80                                                                 RAD_ALL.21288 
     &     SW_SPECTRAL_FILE                                                        RAD_ALL.21289 
!             NAME OF FILE CONTAINING THE SPECTRAL DATA                            RAD_ALL.21290 
      INTEGER                                                                      RAD_ALL.21291 
     &     IERR_GET_FILE                                                           RAD_ALL.21292 
!             ERROR FLAG RETURNED BY GET_FILE (NOT NECESSARILY                     RAD_ALL.21293 
!             CONSISTENT WITH THE FLAGS IN ERROR3A).                               RAD_ALL.21294 
c      &   , IOS - this needs to be single precision                               INT_IOSTAT.1     
      integer*4 ios                                                                INT_IOSTAT.2     
!             STATUS OF I/O                                                        RAD_ALL.21296 
!                                                                                  RAD_ALL.21297 
      INTEGER                                                                      RAD_ALL.21298 
     &     N_AEROSOL_RETAIN                                                        RAD_ALL.21299 
!             NUMBER OF AEROSOLS IN THE SPECTRAL FILE TO BE RETAINED               RAD_ALL.21300 
!             FOR THE RADIATIVE CALCULATION                                        RAD_ALL.21301 
     &   , INDEX_AEROSOL_RETAIN(NPD_AEROSOL_SPECIES)                               RAD_ALL.21302 
!             INDEXING NUMBERS OF THE RETAINED AEROSOLS                            RAD_ALL.21303 
     &   , N_AEROSOL_FOUND                                                         RAD_ALL.21304 
!             NUMBER OF AEROSOLS FOR THE CURRENT GROUP OF PROCESSES                RAD_ALL.21305 
!             FOUND IN THE SPECTRAL FILE                                           RAD_ALL.21306 
!                                                                                  RAD_ALL.21307 
!                                                                                  RAD_ALL.21308 
!                                                                                  RAD_ALL.21309 
!     DECLARE THE ELEMENTS OF THE INITIAL SPECTRUM FOR DYNAMIC                     RAD_ALL.21310 
!     ALLOCATION AND SET UP AN APPROPRIATE NAMELIST.                               RAD_ALL.21311 
!                                                                                  RAD_ALL.21312 
!     ------------------------------------------------------------------           SPDEC3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       SPDEC3A.3     
!                                                                                  SPDEC3A.4     
!     MODULE CONTAINING DECLARATIONS FOR SPECTRAL FILE.                            SPDEC3A.5     
!     ------------------------------------------------------------------           SPDEC3A.6     
!                                                                                  SPDEC3A.7     
!                                                                                  SPDEC3A.8     
!                                                                                  SPDEC3A.9     
!     GENERAL FIELDS:                                                              SPDEC3A.10    
!                                                                                  SPDEC3A.11    
      LOGICAL                                                                      SPDEC3A.12    
     &     L_PRESENT(0: NPD_TYPE)                                                  SPDEC3A.13    
!             FLAG FOR TYPES OF DATA PRESENT                                       SPDEC3A.14    
!                                                                                  SPDEC3A.15    
!                                                                                  SPDEC3A.16    
!                                                                                  SPDEC3A.17    
!     PROPERTIES OF THE SPECTRAL BANDS:                                            SPDEC3A.18    
!                                                                                  SPDEC3A.19    
      INTEGER                                                                      SPDEC3A.20    
     &     N_BAND                                                                  SPDEC3A.21    
!             NUMBER OF SPECTRAL BANDS                                             SPDEC3A.22    
!                                                                                  SPDEC3A.23    
      REAL                                                                         SPDEC3A.24    
     &     WAVE_LENGTH_SHORT(NPD_BAND)                                             SPDEC3A.25    
!             SHORTER WAVELENGTH LIMITS                                            SPDEC3A.26    
     &   , WAVE_LENGTH_LONG(NPD_BAND)                                              SPDEC3A.27    
!             LONGER WAVELENGTH LIMITS                                             SPDEC3A.28    
!                                                                                  SPDEC3A.29    
!                                                                                  SPDEC3A.30    
!                                                                                  SPDEC3A.31    
!     EXCLUSION OF SPECIFIC BANDS FROM PARTS OF THE SPECTRUM:                      SPDEC3A.32    
!                                                                                  SPDEC3A.33    
      INTEGER                                                                      SPDEC3A.34    
     &     N_BAND_EXCLUDE(NPD_BAND)                                                SPDEC3A.35    
!             NUMBER OF EXCLUDED BANDS WITHIN EACH SPECTRAL BAND                   SPDEC3A.36    
     &   , INDEX_EXCLUDE(NPD_EXCLUDE, NPD_BAND)                                    SPDEC3A.37    
!             INDICES OF EXCLUDED BANDS                                            SPDEC3A.38    
!                                                                                  SPDEC3A.39    
!                                                                                  SPDEC3A.40    
!                                                                                  SPDEC3A.41    
!     FIELDS FOR THE SOLAR FLUX:                                                   SPDEC3A.42    
!                                                                                  SPDEC3A.43    
      REAL                                                                         SPDEC3A.44    
     &     SOLAR_FLUX_BAND(NPD_BAND)                                               SPDEC3A.45    
!             FRACTION OF THE INCIDENT SOLAR FLUX IN EACH BAND                     SPDEC3A.46    
!                                                                                  SPDEC3A.47    
!                                                                                  SPDEC3A.48    
!                                                                                  SPDEC3A.49    
!     FIELDS FOR RAYLEIGH SCATTERING:                                              SPDEC3A.50    
!                                                                                  SPDEC3A.51    
      REAL                                                                         SPDEC3A.52    
     &     RAYLEIGH_COEFFICIENT(NPD_BAND)                                          SPDEC3A.53    
!             RAYLEIGH COEFFICIENTS                                                SPDEC3A.54    
!                                                                                  SPDEC3A.55    
!                                                                                  SPDEC3A.56    
!                                                                                  SPDEC3A.57    
!     FIELDS FOR GASEOUS ABSORPTION:                                               SPDEC3A.58    
!                                                                                  SPDEC3A.59    
      INTEGER                                                                      SPDEC3A.60    
     &     N_ABSORB                                                                SPDEC3A.61    
!             NUMBER OF ABSORBERS                                                  SPDEC3A.62    
     &   , N_BAND_ABSORB(NPD_BAND)                                                 SPDEC3A.63    
!             NUMBER OF ABSORBERS IN EACH BAND                                     SPDEC3A.64    
     &   , INDEX_ABSORB(NPD_SPECIES, NPD_BAND)                                     SPDEC3A.65    
!             LIST OF ABSORBERS IN EACH BAND                                       SPDEC3A.66    
     &   , TYPE_ABSORB(NPD_SPECIES)                                                SPDEC3A.67    
!             TYPES OF EACH GAS IN THE SPECTRAL FILE                               SPDEC3A.68    
     &   , I_BAND_ESFT(NPD_BAND, NPD_SPECIES)                                      SPDEC3A.69    
!             NUMBER OF ESFT TERMS IN BAND FOR EACH GAS                            SPDEC3A.70    
     &   , I_SCALE_ESFT(NPD_BAND, NPD_SPECIES)                                     SPDEC3A.71    
!             TYPE OF ESFT SCALING                                                 SPDEC3A.72    
     &   , I_SCALE_FNC(NPD_BAND, NPD_SPECIES)                                      SPDEC3A.73    
!             TYPE OF SCALING FUNCTION                                             SPDEC3A.74    
!                                                                                  SPDEC3A.75    
      REAL                                                                         SPDEC3A.76    
     &     K_ESFT(NPD_ESFT_TERM, NPD_BAND, NPD_SPECIES)                            SPDEC3A.77    
!             ESFT EXPONENTS                                                       SPDEC3A.78    
     &   , W_ESFT(NPD_ESFT_TERM, NPD_BAND, NPD_SPECIES)                            SPDEC3A.79    
!             ESFT WEIGHTS                                                         SPDEC3A.80    
     &   , SCALE_VECTOR(NPD_SCALE_VARIABLE, NPD_ESFT_TERM, NPD_BAND                SPDEC3A.81    
     &        , NPD_SPECIES)                                                       SPDEC3A.82    
!             SCALING PARAMETERS FOR EACH ABSORBER AND TERM                        SPDEC3A.83    
     &   , P_REFERENCE(NPD_SPECIES, NPD_BAND)                                      SPDEC3A.84    
!             REFERENCE PRESSURE FOR SCALING FUNCTION                              SPDEC3A.85    
     &   , T_REFERENCE(NPD_SPECIES, NPD_BAND)                                      SPDEC3A.86    
!             REFERENCE TEMPERATURE FOR SCALING FUNCTION                           SPDEC3A.87    
!                                                                                  SPDEC3A.88    
!                                                                                  SPDEC3A.89    
!                                                                                  SPDEC3A.90    
!     REPRESENTATION OF THE PLANCKIAN:                                             SPDEC3A.91    
!                                                                                  SPDEC3A.92    
      INTEGER                                                                      SPDEC3A.93    
     &     N_DEG_FIT                                                               SPDEC3A.94    
!             DEGREE OF THERMAL POLYNOMIAL                                         SPDEC3A.95    
!                                                                                  SPDEC3A.96    
      REAL                                                                         SPDEC3A.97    
     &     THERMAL_COEFFICIENT(0: NPD_THERMAL_COEFF-1, NPD_BAND)                   SPDEC3A.98    
!             COEFFICIENTS IN POLYNOMIAL FIT TO SOURCE FUNCTION                    SPDEC3A.99    
     &   , T_REF_PLANCK                                                            SPDEC3A.100   
!             PLANCKIAN REFERENCE TEMPERATURE                                      SPDEC3A.101   
!                                                                                  SPDEC3A.102   
!                                                                                  SPDEC3A.103   
!                                                                                  SPDEC3A.104   
!     SURFACE PROPERTIES:                                                          SPDEC3A.105   
!                                                                                  SPDEC3A.106   
      INTEGER                                                                      SPDEC3A.107   
     &     I_SPEC_SURFACE(NPD_SURFACE)                                             SPDEC3A.108   
!             METHOD OF SPECIFYING PROPERTIES OF SURFACE                           SPDEC3A.109   
     &   , N_DIR_ALBEDO_FIT(NPD_SURFACE)                                           SPDEC3A.110   
!             NUMBER OF PARAMETERS FITTING THE DIRECT ALBEDO                       SPDEC3A.111   
!                                                                                  SPDEC3A.112   
      LOGICAL                                                                      SPDEC3A.113   
     &     L_SURFACE(NPD_SURFACE)                                                  SPDEC3A.114   
!             SURFACE TYPES INCLUDED                                               SPDEC3A.115   
!                                                                                  SPDEC3A.116   
      REAL                                                                         SPDEC3A.117   
     &     SURFACE_ALBEDO(NPD_BAND, NPD_SURFACE)                                   SPDEC3A.118   
!             SURFACE ALBEDOS                                                      SPDEC3A.119   
     &   , DIRECT_ALBEDO_PARM(0: NPD_ALBEDO_PARM, NPD_BAND, NPD_SURFACE)           SPDEC3A.120   
!             COEFFICIENTS FOR FITTING DIRECT ALBEDO                               SPDEC3A.121   
     &   , EMISSIVITY_GROUND(NPD_BAND, NPD_SURFACE)                                SPDEC3A.122   
!             SURFACE EMISSIVITIES                                                 SPDEC3A.123   
!                                                                                  SPDEC3A.124   
!                                                                                  SPDEC3A.125   
!                                                                                  SPDEC3A.126   
!     FIELDS FOR CONTINUA:                                                         SPDEC3A.127   
!                                                                                  SPDEC3A.128   
      INTEGER                                                                      SPDEC3A.129   
     &     N_BAND_CONTINUUM(NPD_BAND)                                              SPDEC3A.130   
!             NUMBER OF CONTINUA IN EACH BAND                                      SPDEC3A.131   
     &   , INDEX_CONTINUUM(NPD_BAND, NPD_CONTINUUM)                                SPDEC3A.132   
!             LIST OF CONTINUA CONTINUUA IN EACH BAND                              SPDEC3A.133   
     &   , INDEX_WATER                                                             SPDEC3A.134   
!             INDEX OF WATER VAPOUR                                                SPDEC3A.135   
     &   , I_SCALE_FNC_CONT(NPD_BAND, NPD_CONTINUUM)                               SPDEC3A.136   
!             TYPE OF SCALING FUNCTION FOR CONTINUUM                               SPDEC3A.137   
!                                                                                  SPDEC3A.138   
      REAL                                                                         SPDEC3A.139   
     &     K_CONTINUUM(NPD_BAND, NPD_CONTINUUM)                                    SPDEC3A.140   
!             GREY EXTINCTION COEFFICIENTS FOR CONTINUUM                           SPDEC3A.141   
     &   , SCALE_CONTINUUM(NPD_SCALE_VARIABLE, NPD_BAND, NPD_CONTINUUM)            SPDEC3A.142   
!             SCALING PARAMETERS FOR CONTINUUM                                     SPDEC3A.143   
     &   , P_REF_CONTINUUM(NPD_CONTINUUM, NPD_BAND)                                SPDEC3A.144   
!             REFERENCE PRESSURE FOR SCALING OF CONTINUUM                          SPDEC3A.145   
     &   , T_REF_CONTINUUM(NPD_CONTINUUM, NPD_BAND)                                SPDEC3A.146   
!             REFERENCE TEMPERATURE FOR SCALING OF CONTINUUM                       SPDEC3A.147   
!                                                                                  SPDEC3A.148   
!                                                                                  SPDEC3A.149   
!                                                                                  SPDEC3A.150   
!     FIELDS FOR WATER DROPLETS:                                                   SPDEC3A.151   
!                                                                                  SPDEC3A.152   
      INTEGER                                                                      SPDEC3A.153   
     &     I_DROP_PARAMETRIZATION(NPD_DROP_TYPE)                                   SPDEC3A.154   
!             PARAMETRIZATION TYPE OF DROPLETS                                     SPDEC3A.155   
!                                                                                  SPDEC3A.156   
      LOGICAL                                                                      SPDEC3A.157   
     &     L_DROP_TYPE(NPD_DROP_TYPE)                                              SPDEC3A.158   
!             TYPES OF DROPLET PRESENT                                             SPDEC3A.159   
!                                                                                  SPDEC3A.160   
      REAL                                                                         SPDEC3A.161   
     &     DROP_PARAMETER_LIST(NPD_CLOUD_PARAMETER                                 SPDEC3A.162   
     &        , NPD_BAND, NPD_DROP_TYPE)                                           SPDEC3A.163   
!             PARAMETERS USED TO FIT OPTICAL PROPERTIES OF CLOUDS                  SPDEC3A.164   
     &   , DROP_PARM_MIN_DIM(NPD_DROP_TYPE)                                        SPDEC3A.165   
!             MINIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 SPDEC3A.166   
     &   , DROP_PARM_MAX_DIM(NPD_DROP_TYPE)                                        SPDEC3A.167   
!             MAXIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 SPDEC3A.168   
!                                                                                  SPDEC3A.169   
!                                                                                  SPDEC3A.170   
!                                                                                  SPDEC3A.171   
!     FIELDS FOR AEROSOLS:                                                         SPDEC3A.172   
!                                                                                  SPDEC3A.173   
      INTEGER                                                                      SPDEC3A.174   
     &     N_AEROSOL                                                               SPDEC3A.175   
!             NUMBER OF SPECIES OF AEROSOL                                         SPDEC3A.176   
     &   , TYPE_AEROSOL(NPD_AEROSOL_SPECIES)                                       SPDEC3A.177   
!             TYPES OF AEROSOLS                                                    SPDEC3A.178   
     &   , I_AEROSOL_PARAMETRIZATION(NPD_AEROSOL_SPECIES)                          SPDEC3A.179   
!             PARAMETRIZATION OF AEROSOLS                                          SPDEC3A.180   
     &   , NHUMIDITY(NPD_AEROSOL_SPECIES)                                          SPDEC3A.181   
!             NUMBERS OF HUMIDITIES                                                SPDEC3A.182   
!                                                                                  SPDEC3A.183   
      LOGICAL                                                                      SPDEC3A.184   
     &     L_AEROSOL_SPECIES(NPD_AEROSOL_SPECIES)                                  SPDEC3A.185   
!             AEROSOL SPECIES INCLUDED                                             SPDEC3A.186   
!                                                                                  SPDEC3A.187   
      REAL                                                                         SPDEC3A.188   
     &     AEROSOL_ABSORPTION(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES                  SPDEC3A.189   
     &        , NPD_BAND)                                                          SPDEC3A.190   
!             ABSORPTION BY AEROSOLS                                               SPDEC3A.191   
     &   , AEROSOL_SCATTERING(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES                  SPDEC3A.192   
     &        , NPD_BAND)                                                          SPDEC3A.193   
!             SCATTERING BY AEROSOLS                                               SPDEC3A.194   
     &   , AEROSOL_ASYMMETRY(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES                   SPDEC3A.195   
     &        , NPD_BAND)                                                          SPDEC3A.196   
!             ASYMMETRY OF AEROSOLS                                                SPDEC3A.197   
     &   , HUMIDITIES(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES)                         SPDEC3A.198   
!             HUMIDITIES FOR COMPONENTS                                            SPDEC3A.199   
!                                                                                  SPDEC3A.200   
!                                                                                  SPDEC3A.201   
!                                                                                  SPDEC3A.202   
!     FIELDS FOR ICE CRYSTALS:                                                     SPDEC3A.203   
!                                                                                  SPDEC3A.204   
      INTEGER                                                                      SPDEC3A.205   
     &     I_ICE_PARAMETRIZATION(NPD_ICE_TYPE)                                     SPDEC3A.206   
!             TYPES OF PARAMETRIZATION OF ICE CRYSTALS                             SPDEC3A.207   
!                                                                                  SPDEC3A.208   
      LOGICAL                                                                      SPDEC3A.209   
     &     L_ICE_TYPE(NPD_ICE_TYPE)                                                SPDEC3A.210   
!             TYPES OF ICE CRYSTAL PRESENT                                         SPDEC3A.211   
!                                                                                  SPDEC3A.212   
      REAL                                                                         SPDEC3A.213   
     &     ICE_PARAMETER_LIST(NPD_CLOUD_PARAMETER                                  SPDEC3A.214   
     &        , NPD_BAND, NPD_ICE_TYPE)                                            SPDEC3A.215   
!             PARAMETERS USED TO FIT SINGLE SCATTERING OF ICE CRYSTALS             SPDEC3A.216   
     &   , ICE_PARM_MIN_DIM(NPD_ICE_TYPE)                                          SPDEC3A.217   
!             MINIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 SPDEC3A.218   
     &   , ICE_PARM_MAX_DIM(NPD_ICE_TYPE)                                          SPDEC3A.219   
!             MAXIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 SPDEC3A.220   
!                                                                                  SPDEC3A.221   
!                                                                                  SPDEC3A.222   
!                                                                                  SPDEC3A.223   
!     FIELDS FOR DOPPLER BROADENING:                                               SPDEC3A.224   
!                                                                                  SPDEC3A.225   
      LOGICAL                                                                      SPDEC3A.226   
     &     L_DOPPLER_PRESENT(NPD_SPECIES)                                          SPDEC3A.227   
!             FLAG FOR DOPPLER BROADENING FOR EACH SPECIES                         SPDEC3A.228   
!                                                                                  SPDEC3A.229   
      REAL                                                                         SPDEC3A.230   
     &     DOPPLER_CORRECTION(NPD_SPECIES)                                         SPDEC3A.231   
!             DOPPLER CORRECTION TERMS                                             SPDEC3A.232   
!                                                                                  SPDEC3A.233   
!                                                                                  SPDEC3A.234   
!                                                                                  SPDEC3A.235   
!    ------------------------------------------------------------------            SPDEC3A.236   
!     ------------------------------------------------------------------           SWSP3A.2     
!     MODULE TO DECLARE ELEMENTS OF A SPECTRAL FILE AS A NAMELIST.                 SWSP3A.3     
!                                                                                  SWSP3A.4     
      NAMELIST/R2SWSP/                                                             SWSP3A.5     
!                       Blocks Present                                             SWSP3A.6     
     &     L_PRESENT                                                               SWSP3A.7     
!                       Block 0                                                    SWSP3A.8     
     &   , N_BAND, N_ABSORB, N_AEROSOL, TYPE_ABSORB, TYPE_AEROSOL                  SWSP3A.9     
!                       Block 1                                                    SWSP3A.10    
     &   , WAVE_LENGTH_SHORT, WAVE_LENGTH_LONG                                     SWSP3A.11    
!                       Block 2                                                    SWSP3A.12    
     &   , SOLAR_FLUX_BAND                                                         SWSP3A.13    
!                       Block 3                                                    SWSP3A.14    
     &   , RAYLEIGH_COEFFICIENT                                                    SWSP3A.15    
!                       Block 4                                                    SWSP3A.16    
     &   , N_BAND_ABSORB, INDEX_ABSORB                                             SWSP3A.17    
!                       Block 5                                                    SWSP3A.18    
     &   , I_BAND_ESFT, I_SCALE_ESFT, I_SCALE_FNC                                  SWSP3A.19    
     &   , P_REFERENCE, T_REFERENCE, K_ESFT, W_ESFT, SCALE_VECTOR                  SWSP3A.20    
!                       Block 6                                                    SWSP3A.21    
     &   , N_DEG_FIT, T_REF_PLANCK, THERMAL_COEFFICIENT                            SWSP3A.22    
!                       Block 7                                                    SWSP3A.23    
     &   , I_SPEC_SURFACE, N_DIR_ALBEDO_FIT, L_SURFACE                             SWSP3A.24    
     &   , SURFACE_ALBEDO, DIRECT_ALBEDO_PARM, EMISSIVITY_GROUND                   SWSP3A.25    
!                       Block 8                                                    SWSP3A.26    
     &   , N_BAND_CONTINUUM, INDEX_CONTINUUM, INDEX_WATER                          SWSP3A.27    
!                       Block 9                                                    SWSP3A.28    
     &   , I_SCALE_FNC_CONT, P_REF_CONTINUUM, T_REF_CONTINUUM                      SWSP3A.29    
     &   , K_CONTINUUM, SCALE_CONTINUUM                                            SWSP3A.30    
!                       Block 10                                                   SWSP3A.31    
     &   , I_DROP_PARAMETRIZATION, L_DROP_TYPE, DROP_PARAMETER_LIST                SWSP3A.32    
     &   , DROP_PARM_MIN_DIM, DROP_PARM_MAX_DIM                                    SWSP3A.33    
!                       Block 11                                                   SWSP3A.34    
     &   , I_AEROSOL_PARAMETRIZATION, NHUMIDITY, L_AEROSOL_SPECIES                 SWSP3A.35    
     &   , AEROSOL_ABSORPTION, AEROSOL_SCATTERING, AEROSOL_ASYMMETRY               SWSP3A.36    
     &   , HUMIDITIES                                                              SWSP3A.37    
!                       Block 12                                                   SWSP3A.38    
     &   , I_ICE_PARAMETRIZATION, L_ICE_TYPE, ICE_PARAMETER_LIST                   SWSP3A.39    
     &   , ICE_PARM_MIN_DIM, ICE_PARM_MAX_DIM                                      SWSP3A.40    
!                       Block 13                                                   SWSP3A.41    
     &   , L_DOPPLER_PRESENT, DOPPLER_CORRECTION                                   SWSP3A.42    
!                       Block 14                                                   SWSP3A.43    
     &   , N_BAND_EXCLUDE, INDEX_EXCLUDE                                           SWSP3A.44    
!                                                                                  SWSP3A.45    
!     ------------------------------------------------------------------           SWSP3A.46    
!                                                                                  RAD_ALL.21315 
!                                                                                  RAD_ALL.21316 
!     DECLARE THE REDUCED SW SPECTRAL FILE AND ITS HOLDING COMMON BLOCK.           RAD_ALL.21317 
!                                                                                  RAD_ALL.21318 
!     ------------------------------------------------------------------           SWSPDL3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       SWSPDL3A.3     
!                                                                                  SWSPDL3A.4     
!     MODULE CONTAINING DECLARATIONS FOR REDUCED SW-SPECTRAL FILE.                 SWSPDL3A.5     
!     NOTE: SWSPDC3A, SWSPCM3A AND SWSARG3A MUST BE CONSISTENT                     SWSPDL3A.6     
!     NOTE: SINCE THE ARRAYS HERE WILL BE PASSED IN A COMMON BLOCK                 SWSPDL3A.7     
!     THEIR SIZES MUST BE FIXED, EVEN THOUGH VARIABLE SIZES ARE USED               SWSPDL3A.8     
!     LOWER IN THE CODE. THEY ARE ACCORDINGLY DEFINED AS 1-DIMENSIONAL             SWSPDL3A.9     
!     ARRAYS WITH FIXED MAXIMUM SIZES AT THIS LEVEL.                               SWSPDL3A.10    
!                                                                                  SWSPDL3A.11    
!     ------------------------------------------------------------------           SWSPDL3A.12    
!                                                                                  SWSPDL3A.13    
!                                                                                  SWSPDL3A.14    
!     DIMENSIONS FOR THE SPECTRUM                                                  SWSPDL3A.15    
!                                                                                  SWSPDL3A.16    
      INTEGER                                                                      SWSPDL3A.17    
     &     NPD_TYPE_SW                                                             SWSPDL3A.18    
!             NUMBER OF TYPES OF DATA IN SW SPECTRUM                               SWSPDL3A.19    
     &   , NPD_BAND_SW                                                             SWSPDL3A.20    
!             NUMBER OF SPECTRAL BANDS IN SW SPECTRUM                              SWSPDL3A.21    
     &   , NPD_EXCLUDE_SW                                                          SWSPDL3A.22    
!             NUMBER OF EXCLUDED BANDS IN SW SPECTRUM                              SWSPDL3A.23    
     &   , NPD_SPECIES_SW                                                          SWSPDL3A.24    
!             NUMBER OF GASEOUS SPECIES IN SW SPECTRUM                             SWSPDL3A.25    
     &   , NPD_ESFT_TERM_SW                                                        SWSPDL3A.26    
!             NUMBER OF ESFT TERMS IN SW SPECTRUM                                  SWSPDL3A.27    
     &   , NPD_SCALE_FNC_SW                                                        SWSPDL3A.28    
!             NUMBER OF SCALING FUNCTIONS IN SW SPECTRUM                           SWSPDL3A.29    
     &   , NPD_SCALE_VARIABLE_SW                                                   SWSPDL3A.30    
!             NUMBER OF SCALING VARIABLES IN SW SPECTRUM                           SWSPDL3A.31    
     &   , NPD_SURFACE_SW                                                          SWSPDL3A.32    
!             NUMBER OF SURFACE TYPES IN SW SPECTRUM                               SWSPDL3A.33    
     &   , NPD_ALBEDO_PARM_SW                                                      SWSPDL3A.34    
!             NUMBER OF ALBEDO PARAMETERS IN SW SPECTRUM                           SWSPDL3A.35    
     &   , NPD_CONTINUUM_SW                                                        SWSPDL3A.36    
!             NUMBER OF CONTINUA IN SW SPECTRUM                                    SWSPDL3A.37    
     &   , NPD_DROP_TYPE_SW                                                        SWSPDL3A.38    
!             NUMBER OF DROP TYPES IN SW SPECTRUM                                  SWSPDL3A.39    
     &   , NPD_ICE_TYPE_SW                                                         SWSPDL3A.40    
!             NUMBER OF ICE CRYSTAL TYPES IN SW SPECTRUM                           SWSPDL3A.41    
     &   , NPD_AEROSOL_SPECIES_SW                                                  SWSPDL3A.42    
!             NUMBER OF AEROSOL SPECIES IN SW SPECTRUM                             SWSPDL3A.43    
     &   , NPD_CLOUD_PARAMETER_SW                                                  SWSPDL3A.44    
!             MAX NUMBER OF CLOUD PARAMETERS IN SW SPECTRUM                        SWSPDL3A.45    
     &   , NPD_HUMIDITIES_SW                                                       SWSPDL3A.46    
!             MAXIMUM NUMBER OF HUMIDITIES IN SW SPECTRUM                          SWSPDL3A.47    
     &   , NPD_THERMAL_COEFF_SW                                                    SWSPDL3A.48    
!             NUMBER OF THERMAL COEFFICIENTS IN SW SPECTRUM                        SWSPDL3A.49    
!                                                                                  SWSPDL3A.50    
!                                                                                  SWSPDL3A.51    
!                                                                                  SWSPDL3A.52    
!     GENERAL FIELDS:                                                              SWSPDL3A.53    
!                                                                                  SWSPDL3A.54    
      LOGICAL                                                                      SWSPDL3A.55    
     &     L_PRESENT_SW(0: NPD_TYPE)                                               SWSPDL3A.56    
!             FLAG FOR TYPES OF DATA PRESENT                                       SWSPDL3A.57    
!                                                                                  SWSPDL3A.58    
!                                                                                  SWSPDL3A.59    
!                                                                                  SWSPDL3A.60    
!     PROPERTIES OF THE SPECTRAL BANDS:                                            SWSPDL3A.61    
!                                                                                  SWSPDL3A.62    
      INTEGER                                                                      SWSPDL3A.63    
     &     N_BAND_SW                                                               SWSPDL3A.64    
!             NUMBER OF SPECTRAL BANDS                                             SWSPDL3A.65    
!                                                                                  SWSPDL3A.66    
      REAL                                                                         SWSPDL3A.67    
     &     WAVE_LENGTH_SHORT_SW(NPD_BAND)                                          SWSPDL3A.68    
!             SHORTER WAVELENGTH LIMITS                                            SWSPDL3A.69    
     &   , WAVE_LENGTH_LONG_SW(NPD_BAND)                                           SWSPDL3A.70    
!             LONGER WAVELENGTH LIMITS                                             SWSPDL3A.71    
!                                                                                  SWSPDL3A.72    
!                                                                                  SWSPDL3A.73    
!                                                                                  SWSPDL3A.74    
!     EXCLUSION OF SPECIFIC BANDS FROM PARTS OF THE SPECTRUM:                      SWSPDL3A.75    
!                                                                                  SWSPDL3A.76    
      INTEGER                                                                      SWSPDL3A.77    
     &     N_BAND_EXCLUDE_SW(NPD_BAND)                                             SWSPDL3A.78    
!             NUMBER OF EXCLUDED BANDS WITHIN EACH SPECTRAL BAND                   SWSPDL3A.79    
     &   , INDEX_EXCLUDE_SW(NPD_EXCLUDE, NPD_BAND)                                 SWSPDL3A.80    
!             INDICES OF EXCLUDED BANDS                                            SWSPDL3A.81    
!                                                                                  SWSPDL3A.82    
!                                                                                  SWSPDL3A.83    
!                                                                                  SWSPDL3A.84    
!     FIELDS FOR THE SOLAR FLUX:                                                   SWSPDL3A.85    
!                                                                                  SWSPDL3A.86    
      REAL                                                                         SWSPDL3A.87    
     &     SOLAR_FLUX_BAND_SW(NPD_BAND)                                            SWSPDL3A.88    
!             FRACTION OF THE INCIDENT SOLAR FLUX IN EACH BAND                     SWSPDL3A.89    
!                                                                                  SWSPDL3A.90    
!                                                                                  SWSPDL3A.91    
!                                                                                  SWSPDL3A.92    
!     FIELDS FOR RAYLEIGH SCATTERING:                                              SWSPDL3A.93    
!                                                                                  SWSPDL3A.94    
      REAL                                                                         SWSPDL3A.95    
     &     RAYLEIGH_COEFFICIENT_SW(NPD_BAND)                                       SWSPDL3A.96    
!             RAYLEIGH COEFFICIENTS                                                SWSPDL3A.97    
!                                                                                  SWSPDL3A.98    
!                                                                                  SWSPDL3A.99    
!                                                                                  SWSPDL3A.100   
!     FIELDS FOR GASEOUS ABSORPTION:                                               SWSPDL3A.101   
!                                                                                  SWSPDL3A.102   
      INTEGER                                                                      SWSPDL3A.103   
     &     N_ABSORB_SW                                                             SWSPDL3A.104   
!             NUMBER OF ABSORBERS                                                  SWSPDL3A.105   
     &   , N_BAND_ABSORB_SW(NPD_BAND)                                              SWSPDL3A.106   
!             NUMBER OF ABSORBERS IN EACH BAND                                     SWSPDL3A.107   
     &   , INDEX_ABSORB_SW(NPD_SPECIES, NPD_BAND)                                  SWSPDL3A.108   
!             LIST OF ABSORBERS IN EACH BAND                                       SWSPDL3A.109   
     &   , TYPE_ABSORB_SW(NPD_SPECIES)                                             SWSPDL3A.110   
!             TYPES OF EACH GAS IN THE SPECTRAL FILE                               SWSPDL3A.111   
     &   , I_BAND_ESFT_SW(NPD_BAND, NPD_SPECIES)                                   SWSPDL3A.112   
!             NUMBER OF ESFT TERMS IN EACH BAND FOR EACH GAS                       SWSPDL3A.113   
     &   , I_SCALE_ESFT_SW(NPD_BAND, NPD_SPECIES)                                  SWSPDL3A.114   
!             TYPE OF ESFT SCALING                                                 SWSPDL3A.115   
     &   , I_SCALE_FNC_SW(NPD_BAND, NPD_SPECIES)                                   SWSPDL3A.116   
!             TYPE OF SCALING FUNCTION                                             SWSPDL3A.117   
!                                                                                  SWSPDL3A.118   
      REAL                                                                         SWSPDL3A.119   
     &     K_ESFT_SW(NPD_ESFT_TERM, NPD_BAND, NPD_SPECIES)                         SWSPDL3A.120   
!             ESFT EXPONENTS                                                       SWSPDL3A.121   
     &   , W_ESFT_SW(NPD_ESFT_TERM, NPD_BAND, NPD_SPECIES)                         SWSPDL3A.122   
!             ESFT WEIGHTS                                                         SWSPDL3A.123   
     &   , SCALE_VECTOR_SW(NPD_SCALE_VARIABLE, NPD_ESFT_TERM                       SWSPDL3A.124   
     &        , NPD_BAND, NPD_SPECIES)                                             SWSPDL3A.125   
!             SCALING PARAMETERS FOR EACH ABSORBER AND TERM                        SWSPDL3A.126   
     &   , P_REFERENCE_SW(NPD_SPECIES, NPD_BAND)                                   SWSPDL3A.127   
!             REFERENCE PRESSURE FOR SCALING FUNCTION                              SWSPDL3A.128   
     &   , T_REFERENCE_SW(NPD_SPECIES, NPD_BAND)                                   SWSPDL3A.129   
!             REFERENCE TEMPERATURE FOR SCALING FUNCTION                           SWSPDL3A.130   
!                                                                                  SWSPDL3A.131   
!                                                                                  SWSPDL3A.132   
!                                                                                  SWSPDL3A.133   
!     REPRESENTATION OF THE PLANCKIAN:                                             SWSPDL3A.134   
!                                                                                  SWSPDL3A.135   
      INTEGER                                                                      SWSPDL3A.136   
     &     N_DEG_FIT_SW                                                            SWSPDL3A.137   
!             DEGREE OF THERMAL POLYNOMIAL                                         SWSPDL3A.138   
!                                                                                  SWSPDL3A.139   
      REAL                                                                         SWSPDL3A.140   
     &     THERMAL_COEFFICIENT_SW(0: NPD_THERMAL_COEFF-1                           SWSPDL3A.141   
     &        , NPD_BAND)                                                          SWSPDL3A.142   
!             COEFFICIENTS IN POLYNOMIAL FIT TO SOURCE FUNCTION                    SWSPDL3A.143   
     &   , T_REF_PLANCK_SW                                                         SWSPDL3A.144   
!             PLANCKIAN REFERENCE TEMPERATURE                                      SWSPDL3A.145   
!                                                                                  SWSPDL3A.146   
!                                                                                  SWSPDL3A.147   
!                                                                                  SWSPDL3A.148   
!     SURFACE PROPERTIES:                                                          SWSPDL3A.149   
!                                                                                  SWSPDL3A.150   
      INTEGER                                                                      SWSPDL3A.151   
     &     I_SPEC_SURFACE_SW(NPD_SURFACE)                                          SWSPDL3A.152   
!             METHOD OF SPECIFYING PROPERTIES OF SURFACE                           SWSPDL3A.153   
     &   , N_DIR_ALBEDO_FIT_SW(NPD_SURFACE)                                        SWSPDL3A.154   
!             NUMBER OF PARAMETERS FITTING THE DIRECT ALBEDO                       SWSPDL3A.155   
!                                                                                  SWSPDL3A.156   
      LOGICAL                                                                      SWSPDL3A.157   
     &     L_SURFACE_SW(NPD_SURFACE)                                               SWSPDL3A.158   
!             SURFACE TYPES INCLUDED                                               SWSPDL3A.159   
!                                                                                  SWSPDL3A.160   
      REAL                                                                         SWSPDL3A.161   
     &     SURFACE_ALBEDO_SW(NPD_BAND, NPD_SURFACE)                                SWSPDL3A.162   
!             SURFACE ALBEDOS                                                      SWSPDL3A.163   
     &   , DIRECT_ALBEDO_PARM_SW(0: NPD_ALBEDO_PARM                                SWSPDL3A.164   
     &      , NPD_BAND, NPD_SURFACE)                                               SWSPDL3A.165   
!             COEFFICIENTS FOR FITTING DIRECT ALBEDO                               SWSPDL3A.166   
     &   , EMISSIVITY_GROUND_SW(NPD_BAND, NPD_SURFACE)                             SWSPDL3A.167   
!             SURFACE EMISSIVITIES                                                 SWSPDL3A.168   
!                                                                                  SWSPDL3A.169   
!                                                                                  SWSPDL3A.170   
!                                                                                  SWSPDL3A.171   
!     FIELDS FOR CONTINUA:                                                         SWSPDL3A.172   
!                                                                                  SWSPDL3A.173   
      INTEGER                                                                      SWSPDL3A.174   
     &     N_BAND_CONTINUUM_SW(NPD_BAND)                                           SWSPDL3A.175   
!             NUMBER OF CONTINUA IN EACH BAND                                      SWSPDL3A.176   
     &   , INDEX_CONTINUUM_SW(NPD_BAND, NPD_CONTINUUM)                             SWSPDL3A.177   
!             LIST OF CONTINUA IN EACH BAND                                        SWSPDL3A.178   
     &   , INDEX_WATER_SW                                                          SWSPDL3A.179   
!             INDEX OF WATER VAPOUR                                                SWSPDL3A.180   
     &   , I_SCALE_FNC_CONT_SW(NPD_BAND, NPD_CONTINUUM)                            SWSPDL3A.181   
!             TYPE OF SCALING FUNCTION FOR CONTINUUM                               SWSPDL3A.182   
!                                                                                  SWSPDL3A.183   
      REAL                                                                         SWSPDL3A.184   
     &     K_CONTINUUM_SW(NPD_BAND, NPD_CONTINUUM)                                 SWSPDL3A.185   
!             GREY EXTINCTION COEFFICIENTS FOR CONTINUUM                           SWSPDL3A.186   
     &   , SCALE_CONTINUUM_SW(NPD_SCALE_VARIABLE                                   SWSPDL3A.187   
     &      , NPD_BAND, NPD_CONTINUUM)                                             SWSPDL3A.188   
!             SCALING PARAMETERS FOR CONTINUUM                                     SWSPDL3A.189   
     &   , P_REF_CONTINUUM_SW(NPD_CONTINUUM, NPD_BAND)                             SWSPDL3A.190   
!             REFERENCE PRESSURE FOR SCALING OF CONTINUUM                          SWSPDL3A.191   
     &   , T_REF_CONTINUUM_SW(NPD_CONTINUUM, NPD_BAND)                             SWSPDL3A.192   
!             REFERENCE TEMPERATURE FOR SCALING OF CONTINUUM                       SWSPDL3A.193   
!                                                                                  SWSPDL3A.194   
!                                                                                  SWSPDL3A.195   
!                                                                                  SWSPDL3A.196   
!     FIELDS FOR WATER DROPLETS:                                                   SWSPDL3A.197   
!                                                                                  SWSPDL3A.198   
      INTEGER                                                                      SWSPDL3A.199   
     &     I_DROP_PARAMETRIZATION_SW(NPD_DROP_TYPE)                                SWSPDL3A.200   
!             PARAMETRIZATION TYPE OF DROPLETS                                     SWSPDL3A.201   
!                                                                                  SWSPDL3A.202   
      LOGICAL                                                                      SWSPDL3A.203   
     &     L_DROP_TYPE_SW(NPD_DROP_TYPE)                                           SWSPDL3A.204   
!             TYPES OF DROPLET PRESENT                                             SWSPDL3A.205   
!                                                                                  SWSPDL3A.206   
      REAL                                                                         SWSPDL3A.207   
     &     DROP_PARAMETER_LIST_SW(NPD_CLOUD_PARAMETER                              SWSPDL3A.208   
     &        , NPD_BAND, NPD_DROP_TYPE)                                           SWSPDL3A.209   
!             PARAMETERS USED TO FIT OPTICAL PROPERTIES OF CLOUDS                  SWSPDL3A.210   
     &   , DROP_PARM_MIN_DIM_SW(NPD_DROP_TYPE)                                     SWSPDL3A.211   
!             MINIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 SWSPDL3A.212   
     &   , DROP_PARM_MAX_DIM_SW(NPD_DROP_TYPE)                                     SWSPDL3A.213   
!             MAXIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 SWSPDL3A.214   
!                                                                                  SWSPDL3A.215   
!                                                                                  SWSPDL3A.216   
!                                                                                  SWSPDL3A.217   
!     FIELDS FOR AEROSOLS:                                                         SWSPDL3A.218   
!                                                                                  SWSPDL3A.219   
      INTEGER                                                                      SWSPDL3A.220   
     &     N_AEROSOL_SW                                                            SWSPDL3A.221   
!             NUMBER OF SPECIES OF AEROSOL                                         SWSPDL3A.222   
     &   , TYPE_AEROSOL_SW(NPD_AEROSOL_SPECIES)                                    SWSPDL3A.223   
!             TYPES OF AEROSOLS                                                    SWSPDL3A.224   
     &   , I_AEROSOL_PARAMETRIZATION_SW(NPD_AEROSOL_SPECIES)                       SWSPDL3A.225   
!             PARAMETRIZATION OF AEROSOLS                                          SWSPDL3A.226   
     &   , NHUMIDITY_SW(NPD_AEROSOL_SPECIES)                                       SWSPDL3A.227   
!             NUMBERS OF HUMIDITIES                                                SWSPDL3A.228   
!                                                                                  SWSPDL3A.229   
      LOGICAL                                                                      SWSPDL3A.230   
     &     L_AEROSOL_SPECIES_SW(NPD_AEROSOL_SPECIES)                               SWSPDL3A.231   
!             AEROSOL SPECIES INCLUDED                                             SWSPDL3A.232   
!                                                                                  SWSPDL3A.233   
      REAL                                                                         SWSPDL3A.234   
     &     AEROSOL_ABSORPTION_SW(NPD_HUMIDITIES                                    SWSPDL3A.235   
     &        , NPD_AEROSOL_SPECIES, NPD_BAND)                                     SWSPDL3A.236   
!             ABSORPTION BY AEROSOLS                                               SWSPDL3A.237   
     &   , AEROSOL_SCATTERING_SW(NPD_HUMIDITIES                                    SWSPDL3A.238   
     &        , NPD_AEROSOL_SPECIES, NPD_BAND)                                     SWSPDL3A.239   
!             SCATTERING BY AEROSOLS                                               SWSPDL3A.240   
     &   , AEROSOL_ASYMMETRY_SW(NPD_HUMIDITIES                                     SWSPDL3A.241   
     &        , NPD_AEROSOL_SPECIES, NPD_BAND)                                     SWSPDL3A.242   
!             ASYMMETRY OF AEROSOLS                                                SWSPDL3A.243   
     &   , HUMIDITIES_SW(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES)                      SWSPDL3A.244   
!             HUMIDITIES FOR COMPONENTS                                            SWSPDL3A.245   
!                                                                                  SWSPDL3A.246   
!                                                                                  SWSPDL3A.247   
!                                                                                  SWSPDL3A.248   
!     FIELDS FOR ICE CRYSTALS:                                                     SWSPDL3A.249   
!                                                                                  SWSPDL3A.250   
      INTEGER                                                                      SWSPDL3A.251   
     &     I_ICE_PARAMETRIZATION_SW(NPD_ICE_TYPE)                                  SWSPDL3A.252   
!             TYPES OF PARAMETRIZATION OF ICE CRYSTALS                             SWSPDL3A.253   
!                                                                                  SWSPDL3A.254   
      LOGICAL                                                                      SWSPDL3A.255   
     &     L_ICE_TYPE_SW(NPD_ICE_TYPE)                                             SWSPDL3A.256   
!             TYPES OF ICE CRYSTAL PRESENT                                         SWSPDL3A.257   
!                                                                                  SWSPDL3A.258   
      REAL                                                                         SWSPDL3A.259   
     &     ICE_PARAMETER_LIST_SW(NPD_CLOUD_PARAMETER                               SWSPDL3A.260   
     &        , NPD_BAND, NPD_ICE_TYPE)                                            SWSPDL3A.261   
!             PARAMETERS USED TO FIT SINGLE SCATTERING OF ICE CRYSTALS             SWSPDL3A.262   
     &   , ICE_PARM_MIN_DIM_SW(NPD_ICE_TYPE)                                       SWSPDL3A.263   
!             MINIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 SWSPDL3A.264   
     &   , ICE_PARM_MAX_DIM_SW(NPD_ICE_TYPE)                                       SWSPDL3A.265   
!             MAXIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 SWSPDL3A.266   
!                                                                                  SWSPDL3A.267   
!                                                                                  SWSPDL3A.268   
!                                                                                  SWSPDL3A.269   
!     FIELDS FOR DOPPLER BROADENING:                                               SWSPDL3A.270   
!                                                                                  SWSPDL3A.271   
      LOGICAL                                                                      SWSPDL3A.272   
     &     L_DOPPLER_PRESENT_SW(NPD_SPECIES)                                       SWSPDL3A.273   
!             FLAG FOR DOPPLER BROADENING FOR EACH SPECIES                         SWSPDL3A.274   
!                                                                                  SWSPDL3A.275   
      REAL                                                                         SWSPDL3A.276   
     &     DOPPLER_CORRECTION_SW(NPD_SPECIES)                                      SWSPDL3A.277   
!             OFFSET TO PRESSURE TO REPRESENT DOPPLER BROADENING                   SWSPDL3A.278   
!                                                                                  SWSPDL3A.279   
!                                                                                  SWSPDL3A.280   
!                                                                                  SWSPDL3A.281   
!    ------------------------------------------------------------------            SWSPDL3A.282   
!     ------------------------------------------------------------------           SWSPCM3A.2     
!     MODULE DECLARING COMMON BLOCK CONTAINING THE REDUCED SW SPECTRAL             SWSPCM3A.3     
!     FILE.                                                                        SWSPCM3A.4     
!     (NOTE: SWSPDC3A, SWSPCM3A AND SWSARG3A MUST BE CONSISTENT)                   SWSPCM3A.5     
!                                                                                  SWSPCM3A.6     
!                                                                                  SWSPCM3A.7     
      COMMON/R2SWSPCM/                                                             SWSPCM3A.8     
!                                                                                  SWSPCM3A.9     
!     DIMENSIONS OF ARRAYS:                                                        SWSPCM3A.10    
     &     NPD_TYPE_SW, NPD_BAND_SW, NPD_EXCLUDE_SW                                SWSPCM3A.11    
     &   , NPD_SPECIES_SW, NPD_ESFT_TERM_SW, NPD_SCALE_FNC_SW                      SWSPCM3A.12    
     &   , NPD_SCALE_VARIABLE_SW                                                   SWSPCM3A.13    
     &   , NPD_THERMAL_COEFF_SW                                                    SWSPCM3A.14    
     &   , NPD_SURFACE_SW, NPD_ALBEDO_PARM_SW                                      SWSPCM3A.15    
     &   , NPD_CONTINUUM_SW                                                        SWSPCM3A.16    
     &   , NPD_DROP_TYPE_SW, NPD_ICE_TYPE_SW, NPD_CLOUD_PARAMETER_SW               SWSPCM3A.17    
     &   , NPD_AEROSOL_SPECIES_SW, NPD_HUMIDITIES_SW                               SWSPCM3A.18    
!                                                                                  SWSPCM3A.19    
!     GENERAL ARRAYS:                                                              SWSPCM3A.20    
     &   , L_PRESENT_SW                                                            SWSPCM3A.21    
!                                                                                  SWSPCM3A.22    
!     PROPERTIES OF BANDS:                                                         SWSPCM3A.23    
     &   , N_BAND_SW, WAVE_LENGTH_SHORT_SW, WAVE_LENGTH_LONG_SW                    SWSPCM3A.24    
!                                                                                  SWSPCM3A.25    
!     EXCLUSIONS FROM BANDS:                                                       SWSPCM3A.26    
     &   , N_BAND_EXCLUDE_SW, INDEX_EXCLUDE_SW                                     SWSPCM3A.27    
!                                                                                  SWSPCM3A.28    
!     SOLAR FIELDS:                                                                SWSPCM3A.29    
     &   , SOLAR_FLUX_BAND_SW, RAYLEIGH_COEFFICIENT_SW                             SWSPCM3A.30    
!                                                                                  SWSPCM3A.31    
!     GASEOUS ABSORPTION:                                                          SWSPCM3A.32    
     &   , N_ABSORB_SW, N_BAND_ABSORB_SW, INDEX_ABSORB_SW                          SWSPCM3A.33    
     &   , TYPE_ABSORB_SW                                                          SWSPCM3A.34    
     &   , I_BAND_ESFT_SW, I_SCALE_ESFT_SW, I_SCALE_FNC_SW                         SWSPCM3A.35    
     &   , K_ESFT_SW, W_ESFT_SW                                                    SWSPCM3A.36    
     &   , SCALE_VECTOR_SW, P_REFERENCE_SW, T_REFERENCE_SW                         SWSPCM3A.37    
!                                                                                  SWSPCM3A.38    
!     THERMAL SOURCE FUNCTION:                                                     SWSPCM3A.39    
     &   , N_DEG_FIT_SW, THERMAL_COEFFICIENT_SW, T_REF_PLANCK_SW                   SWSPCM3A.40    
!                                                                                  SWSPCM3A.41    
!     SURFACE PROPERTIES:                                                          SWSPCM3A.42    
     &   , I_SPEC_SURFACE_SW, N_DIR_ALBEDO_FIT_SW, L_SURFACE_SW                    SWSPCM3A.43    
     &   , SURFACE_ALBEDO_SW, DIRECT_ALBEDO_PARM_SW                                SWSPCM3A.44    
     &   , EMISSIVITY_GROUND_SW                                                    SWSPCM3A.45    
!                                                                                  SWSPCM3A.46    
!     CONTINUA:                                                                    SWSPCM3A.47    
     &   , N_BAND_CONTINUUM_SW, INDEX_CONTINUUM_SW, INDEX_WATER_SW                 SWSPCM3A.48    
     &   , I_SCALE_FNC_CONT_SW, K_CONTINUUM_SW                                     SWSPCM3A.49    
     &   , SCALE_CONTINUUM_SW, P_REF_CONTINUUM_SW, T_REF_CONTINUUM_SW              SWSPCM3A.50    
!                                                                                  SWSPCM3A.51    
!     WATER DROPLETS:                                                              SWSPCM3A.52    
     &   , I_DROP_PARAMETRIZATION_SW, L_DROP_TYPE_SW                               SWSPCM3A.53    
     &   , DROP_PARAMETER_LIST_SW                                                  SWSPCM3A.54    
     &   , DROP_PARM_MIN_DIM_SW, DROP_PARM_MAX_DIM_SW                              SWSPCM3A.55    
!                                                                                  SWSPCM3A.56    
!     AEROSOLS:                                                                    SWSPCM3A.57    
     &   , N_AEROSOL_SW, TYPE_AEROSOL_SW, I_AEROSOL_PARAMETRIZATION_SW             SWSPCM3A.58    
     &   , NHUMIDITY_SW, HUMIDITIES_SW, L_AEROSOL_SPECIES_SW                       SWSPCM3A.59    
     &   , AEROSOL_ABSORPTION_SW, AEROSOL_SCATTERING_SW                            SWSPCM3A.60    
     &   , AEROSOL_ASYMMETRY_SW                                                    SWSPCM3A.61    
!                                                                                  SWSPCM3A.62    
!     ICE CRYSTALS:                                                                SWSPCM3A.63    
     &   , I_ICE_PARAMETRIZATION_SW, L_ICE_TYPE_SW                                 SWSPCM3A.64    
     &   , ICE_PARAMETER_LIST_SW                                                   SWSPCM3A.65    
     &   , ICE_PARM_MIN_DIM_SW, ICE_PARM_MAX_DIM_SW                                SWSPCM3A.66    
!                                                                                  SWSPCM3A.67    
!     DOPPLER BROADENING:                                                          SWSPCM3A.68    
     &   , L_DOPPLER_PRESENT_SW, DOPPLER_CORRECTION_SW                             SWSPCM3A.69    
!                                                                                  SWSPCM3A.70    
!     ------------------------------------------------------------------           SWSPCM3A.71    
!                                                                                  RAD_ALL.21321 
!                                                                                  RAD_ALL.21322 
!     OTHER RADIATIVE VARIABLES FOR REDUCING THE SPECTRUM                          RAD_ALL.21323 
!                                                                                  RAD_ALL.21324 
!     ------------------------------------------------------------------           AERPRM3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       AERPRM3A.3     
!                                                                                  AERPRM3A.4     
!     MODULE TO SET THE AEROSOL PARAMETRIZATIONS.                                  AERPRM3A.5     
!                                                                                  AERPRM3A.6     
      INTEGER                                                                      AERPRM3A.7     
     &     IP_AEROSOL_PARAM_DRY                                                    AERPRM3A.8     
!             PARAMETRIZATION FOR DRY AEROSOLS                                     AERPRM3A.9     
     &   , IP_AEROSOL_PARAM_MOIST                                                  AERPRM3A.10    
!             PARAMETRIZATION FOR MOIST AEROSOLS                                   AERPRM3A.11    
     &   , IP_AEROSOL_UNPARAMETRIZED                                               AERPRM3A.12    
!             OBSERVATIONAL AEROSOL DATA                                           AERPRM3A.13    
!                                                                                  AERPRM3A.14    
      PARAMETER(                                                                   AERPRM3A.15    
     &     IP_AEROSOL_PARAM_DRY=1                                                  AERPRM3A.16    
     &   , IP_AEROSOL_PARAM_MOIST=2                                                AERPRM3A.17    
     &   , IP_AEROSOL_UNPARAMETRIZED=3                                             AERPRM3A.18    
     &   )                                                                         AERPRM3A.19    
!                                                                                  AERPRM3A.20    
!     ------------------------------------------------------------------           AERPRM3A.21    
!     ------------------------------------------------------------------           AERCMP3A.2     
!     MODULE TO SET INDICES OF AEROSOL COMPONENTS.                                 AERCMP3A.3     
!                                                                                  AERCMP3A.4     
!                                                                                  AERCMP3A.5     
      INTEGER                                                                      AERCMP3A.6     
     &     NPD_AEROSOL_COMPONENT                                                   AERCMP3A.7     
!             MAXIMUM NUMBER OF AEROSOL COMPONENTS                                 AERCMP3A.8     
      INTEGER                                                                      AERCMP3A.9     
     &     IP_WATER_SOLUBLE                                                        AERCMP3A.10    
!             WATER SOLUBLE AEROSOL                                                AERCMP3A.11    
     &   , IP_DUST_LIKE                                                            AERCMP3A.12    
!             DUST-LIKE AEROSOL                                                    AERCMP3A.13    
     &   , IP_OCEANIC                                                              AERCMP3A.14    
!             OCEANIC AEROSOL                                                      AERCMP3A.15    
     &   , IP_SOOT                                                                 AERCMP3A.16    
!             SOOT AEROSOL                                                         AERCMP3A.17    
     &   , IP_ASH                                                                  AERCMP3A.18    
!             VOLCANIC ASH                                                         AERCMP3A.19    
     &   , IP_SULPHURIC                                                            AERCMP3A.20    
!             SULPHURIC ACID                                                       AERCMP3A.21    
     &   , IP_ACCUM_SULPHATE                                                       AERCMP3A.22    
!             ACCUMULATION MODE SULPHATE                                           AERCMP3A.23    
     &   , IP_AITKEN_SULPHATE                                                      AERCMP3A.24    
!             AITKEN MODE SULPHATE                                                 AERCMP3A.25    
!                                                                                  AERCMP3A.26    
      PARAMETER(                                                                   AERCMP3A.27    
     &     NPD_AEROSOL_COMPONENT=11                                                AERCMP3A.28    
     &   )                                                                         AERCMP3A.29    
      PARAMETER(                                                                   AERCMP3A.30    
     &     IP_WATER_SOLUBLE=1                                                      AERCMP3A.31    
     &   , IP_DUST_LIKE=2                                                          AERCMP3A.32    
     &   , IP_OCEANIC=3                                                            AERCMP3A.33    
     &   , IP_SOOT=4                                                               AERCMP3A.34    
     &   , IP_ASH=5                                                                AERCMP3A.35    
     &   , IP_SULPHURIC=6                                                          AERCMP3A.36    
     &   , IP_ACCUM_SULPHATE=10                                                    AERCMP3A.37    
     &   , IP_AITKEN_SULPHATE=11                                                   AERCMP3A.38    
     &   )                                                                         AERCMP3A.39    
!                                                                                  AERCMP3A.40    
!     ------------------------------------------------------------------           AERCMP3A.41    
!     ------------------------------------------------------------------           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    
!                                                                                  RAD_ALL.21328 
!                                                                                  RAD_ALL.21329 
!                                                                                  RAD_ALL.21330 
      INTEGER                                                                      RAD_ALL.21331 
     &     I                                                                       RAD_ALL.21332 
!             LOOP VARIABLE                                                        RAD_ALL.21333 
     &   , J                                                                       RAD_ALL.21334 
!             LOOP VARIABLE                                                        RAD_ALL.21335 
!                                                                                  RAD_ALL.21336 
      CHARACTER                                                                    RAD_ALL.21337 
     &     CH_IOS*5                                                                RAD_ALL.21338 
!             CHARACTER STRING FOR IOS ERROR                                       RAD_ALL.21339 
!                                                                                  RAD_ALL.21340 
!                                                                                  RAD_ALL.21341 
!     SUBROUTINES CALLED                                                           RAD_ALL.21342 
      EXTERNAL                                                                     RAD_ALL.21343 
     &     R2_COMPRESS_SPECTRUM                                                    RAD_ALL.21344 
!                                                                                  RAD_ALL.21345 
!                                                                                  RAD_ALL.21346 
!     EACH BLOCK IS INITIALIZED AS MISSING:                                        RAD_ALL.21347 
      DATA L_PRESENT/.FALSE., NPD_TYPE*.FALSE./                                    RAD_ALL.21348 
!                                                                                  RAD_ALL.21349 
!     INITIALIZE THE RANGE OF VALIDITY OF THE PARAMETRIZATIONS OF                  RAD_ALL.21350 
!     DROPLETS AND ICE CRYSTALS. OLD SPECTRAL FILES WILL NOT CONTAIN               RAD_ALL.21351 
!     SUCH DATA, SO THE LIMITS FOR DROPLETS ARE INITIALIZED TO THOSE               RAD_ALL.21352 
!     FORMERLY SET IN THE MICROPHYSICAL SCHEME (MRF/UMIST                          RAD_ALL.21353 
!     PARAMETRIZATION) TO ENSURE THAT THE RESULTS ARE BIT-REPRODUCIBLE.            RAD_ALL.21354 
!     VALUES FOR ICE COVER THE RANGE OF EFFECTIVE RADII USED IN                    RAD_ALL.21355 
!     GENERATING THE DATA FOR THE ORIGINAL PARAMETRIZATION OF ICE                  RAD_ALL.21356 
!     CRYSTALS.                                                                    RAD_ALL.21357 
!     AT SOME FUTURE RELEASE IT MAY BE DESIRABLE TO REMOVE DEFAULT                 RAD_ALL.21358 
!     SETTINGS.                                                                    RAD_ALL.21359 
      DATA DROP_PARM_MIN_DIM/NPD_DROP_TYPE*3.5E-07/                                RAD_ALL.21360 
      DATA DROP_PARM_MAX_DIM/NPD_DROP_TYPE*3.7E-05/                                RAD_ALL.21361 
      DATA ICE_PARM_MIN_DIM/NPD_ICE_TYPE*3.75E-07/                                 RAD_ALL.21362 
      DATA ICE_PARM_MAX_DIM/NPD_ICE_TYPE*8.0E-05/                                  RAD_ALL.21363 
!                                                                                  RAD_ALL.21364 
!                                                                                  RAD_ALL.21365 
!                                                                                  RAD_ALL.21366 
!     READ THE SHORTWAVE SPECTRUM AS A NAMELIST.                                   RAD_ALL.21367 
      CALL GET_FILE(57, SW_SPECTRAL_FILE, 80, IERR_GET_FILE)                       RAD_ALL.21368 
      IF (IERR_GET_FILE.NE.0) THEN                                                 RAD_ALL.21369 
!        CONVERT THE ERROR FLAG FROM GET_FILE TO A FLAG RECOGNISED                 RAD_ALL.21370 
!        BY THE RADIATION CODE.                                                    RAD_ALL.21371 
         IERR=I_ERR_IO                                                             RAD_ALL.21372 
         CMESSAGE='Error reading name of shortwave spectral file.'                 RAD_ALL.21373 
         RETURN                                                                    RAD_ALL.21374 
      ENDIF                                                                        RAD_ALL.21375 
      OPEN(UNIT=57, FILE=SW_SPECTRAL_FILE, IOSTAT=IOS)                             RAD_ALL.21376 
      IF (IOS.NE.0) THEN                                                           RAD_ALL.21377 
         IERR=I_ERR_IO                                                             RAD_ALL.21378 
      WRITE(CH_IOS, '(I5)') IOS                                                    RAD_ALL.21379 
         CMESSAGE='Error opening shortwave spectral file.'                         RAD_ALL.21380 
     &      //' IOSTAT='//CH_IOS                                                   RAD_ALL.21381 
         RETURN                                                                    RAD_ALL.21382 
      ENDIF                                                                        RAD_ALL.21383 
      READ(57, R2SWSP)                                                             RAD_ALL.21384 
      CLOSE(57)                                                                    RAD_ALL.21385 
!                                                                                  RAD_ALL.21386 
!     TEST FOR MINIMAL REQUISITE INFORMATION.                                      RAD_ALL.21387 
      IF ( .NOT.(L_PRESENT(0).AND.                                                 RAD_ALL.21388 
     &           L_PRESENT(2) ) ) THEN                                             RAD_ALL.21389 
         CMESSAGE='Shortwave spectrum is deficient.'                               RAD_ALL.21390 
         IERR=I_ERR_FATAL                                                          RAD_ALL.21391 
         RETURN                                                                    RAD_ALL.21392 
      ENDIF                                                                        RAD_ALL.21393 
!                                                                                  RAD_ALL.21394 
!                                                                                  RAD_ALL.21395 
!                                                                                  RAD_ALL.21396 
!     SET REDUCED DIMENSIONS, EITHER FROM THE SIZES OF THE FIXED ARRAYS            RAD_ALL.21397 
!     OR FROM THE ARRAYS READ IN.                                                  RAD_ALL.21398 
!                                                                                  RAD_ALL.21399 
      NPD_TYPE_SW=NPD_TYPE                                                         RAD_ALL.21400 
      NPD_BAND_SW=MAX(N_BAND, 1)                                                   RAD_ALL.21401 
      NPD_SPECIES_SW=MAX(N_ABSORB, 1)                                              RAD_ALL.21402 
      NPD_ALBEDO_PARM_SW=NPD_ALBEDO_PARM                                           RAD_ALL.21403 
      NPD_SCALE_FNC_SW=NPD_SCALE_FNC                                               RAD_ALL.21404 
      NPD_SCALE_VARIABLE_SW=NPD_SCALE_VARIABLE                                     RAD_ALL.21405 
      NPD_SURFACE_SW=NPD_SURFACE                                                   RAD_ALL.21406 
      NPD_CONTINUUM_SW=NPD_CONTINUUM                                               RAD_ALL.21407 
      NPD_CLOUD_PARAMETER_SW=NPD_CLOUD_PARAMETER                                   RAD_ALL.21408 
      NPD_THERMAL_COEFF_SW=1                                                       RAD_ALL.21409 
!                                                                                  RAD_ALL.21410 
!                                                                                  RAD_ALL.21411 
!     SEARCH THE SPECTRUM TO FIND MAXIMUM DIMENSIONS.                              RAD_ALL.21412 
!                                                                                  RAD_ALL.21413 
      NPD_EXCLUDE_SW=1                                                             RAD_ALL.21414 
      IF (L_PRESENT(14)) THEN                                                      RAD_ALL.21415 
         DO I=1, N_BAND                                                            RAD_ALL.21416 
            NPD_EXCLUDE_SW=MAX(NPD_EXCLUDE_SW, N_BAND_EXCLUDE(I))                  RAD_ALL.21417 
         ENDDO                                                                     RAD_ALL.21418 
      ENDIF                                                                        RAD_ALL.21419 
!                                                                                  RAD_ALL.21420 
      NPD_ESFT_TERM_SW=1                                                           RAD_ALL.21421 
      IF (L_PRESENT(5)) THEN                                                       RAD_ALL.21422 
         DO I=1, N_BAND                                                            RAD_ALL.21423 
            DO J=1, N_BAND_ABSORB(I)                                               RAD_ALL.21424 
               NPD_ESFT_TERM_SW=MAX(NPD_ESFT_TERM_SW                               RAD_ALL.21425 
     &            , I_BAND_ESFT(I, INDEX_ABSORB(J, I)))                            RAD_ALL.21426 
            ENDDO                                                                  RAD_ALL.21427 
         ENDDO                                                                     RAD_ALL.21428 
      ENDIF                                                                        RAD_ALL.21429 
!                                                                                  RAD_ALL.21430 
      NPD_DROP_TYPE_SW=1                                                           RAD_ALL.21431 
      IF (L_PRESENT(10)) THEN                                                      RAD_ALL.21432 
         DO I=1, NPD_DROP_TYPE                                                     RAD_ALL.21433 
            IF (L_DROP_TYPE(I)) THEN                                               RAD_ALL.21434 
               NPD_DROP_TYPE_SW=MAX(NPD_DROP_TYPE_SW, I)                           RAD_ALL.21435 
            ENDIF                                                                  RAD_ALL.21436 
         ENDDO                                                                     RAD_ALL.21437 
      ENDIF                                                                        RAD_ALL.21438 
!                                                                                  RAD_ALL.21439 
      NPD_ICE_TYPE_SW=1                                                            RAD_ALL.21440 
      IF (L_PRESENT(12)) THEN                                                      RAD_ALL.21441 
         DO I=1, NPD_ICE_TYPE                                                      RAD_ALL.21442 
            IF (L_ICE_TYPE(I)) THEN                                                RAD_ALL.21443 
               NPD_ICE_TYPE_SW=MAX(NPD_ICE_TYPE_SW, I)                             RAD_ALL.21444 
            ENDIF                                                                  RAD_ALL.21445 
         ENDDO                                                                     RAD_ALL.21446 
      ENDIF                                                                        RAD_ALL.21447 
!                                                                                  RAD_ALL.21448 
!                                                                                  RAD_ALL.21449 
!     Aerosols must be treated carefully to allow for various                      RAD_ALL.21450 
!     different combinations without requiring the spectral file                   RAD_ALL.21451 
!     to be too constrained. Only those required will be retained.                 RAD_ALL.21452 
!                                                                                  RAD_ALL.21453 
!     Basic initialization to safe values.                                         RAD_ALL.21454 
      NPD_HUMIDITIES_SW=1                                                          RAD_ALL.21455 
      N_AEROSOL_RETAIN=0                                                           RAD_ALL.21456 
!                                                                                  RAD_ALL.21457 
!     Check the spectral file for climatological aerosols                          RAD_ALL.21458 
      IF (L_CLIMAT_AEROSOL) THEN                                                   RAD_ALL.21459 
!                                                                                  RAD_ALL.21460 
         IF (L_PRESENT(11)) THEN                                                   RAD_ALL.21461 
!                                                                                  RAD_ALL.21462 
!           Search for the aerosols required for this scheme.                      RAD_ALL.21463 
            N_AEROSOL_FOUND=0                                                      RAD_ALL.21464 
            DO I=1, N_AEROSOL                                                      RAD_ALL.21465 
!                                                                                  RAD_ALL.21466 
               IF ( (TYPE_AEROSOL(I).EQ.IP_WATER_SOLUBLE).OR.                      RAD_ALL.21467 
     &              (TYPE_AEROSOL(I).EQ.IP_DUST_LIKE).OR.                          RAD_ALL.21468 
     &              (TYPE_AEROSOL(I).EQ.IP_OCEANIC).OR.                            RAD_ALL.21469 
     &              (TYPE_AEROSOL(I).EQ.IP_SOOT).OR.                               RAD_ALL.21470 
     &              (TYPE_AEROSOL(I).EQ.IP_SULPHURIC) ) THEN                       RAD_ALL.21471 
                  N_AEROSOL_RETAIN=N_AEROSOL_RETAIN+1                              RAD_ALL.21472 
                  INDEX_AEROSOL_RETAIN(N_AEROSOL_RETAIN)=I                         RAD_ALL.21473 
                  N_AEROSOL_FOUND=N_AEROSOL_FOUND+1                                RAD_ALL.21474 
               ENDIF                                                               RAD_ALL.21475 
                                                                                   RAD_ALL.21476 
            ENDDO                                                                  RAD_ALL.21477 
!                                                                                  RAD_ALL.21478 
            IF (N_AEROSOL_FOUND.NE.5) THEN                                         RAD_ALL.21479 
!                                                                                  RAD_ALL.21480 
               IERR=I_ERR_FATAL                                                    RAD_ALL.21481 
               CMESSAGE='The SW Spectral file lacks some '                         RAD_ALL.21482 
     &            //'climatological aerosols.'                                     RAD_ALL.21483 
               RETURN                                                              RAD_ALL.21484 
!                                                                                  RAD_ALL.21485 
            ENDIF                                                                  RAD_ALL.21486 
                                                                                   RAD_ALL.21487 
         ELSE                                                                      RAD_ALL.21488 
!                                                                                  RAD_ALL.21489 
            IERR=I_ERR_FATAL                                                       RAD_ALL.21490 
            CMESSAGE='SW Spectral file contains no aerosol data.'                  RAD_ALL.21491 
            RETURN                                                                 RAD_ALL.21492 
!                                                                                  RAD_ALL.21493 
         ENDIF                                                                     RAD_ALL.21494 
!                                                                                  RAD_ALL.21495 
      ENDIF                                                                        RAD_ALL.21496 
                                                                                   RAD_ALL.21497 
!                                                                                  RAD_ALL.21498 
!     Check the spectral file for sulphate aerosols. (These are                    RAD_ALL.21499 
!     required only for the direct effect).                                        RAD_ALL.21500 
!                                                                                  RAD_ALL.21501 
      IF (L_USE_SULPC_DIRECT) THEN                                                 RAD_ALL.21502 
!                                                                                  RAD_ALL.21503 
         IF (L_PRESENT(11)) THEN                                                   RAD_ALL.21504 
!                                                                                  RAD_ALL.21505 
!           Search for the aerosols required for this scheme.                      RAD_ALL.21506 
            N_AEROSOL_FOUND=0                                                      RAD_ALL.21507 
            DO I=1, N_AEROSOL                                                      RAD_ALL.21508 
!                                                                                  RAD_ALL.21509 
               IF ( (TYPE_AEROSOL(I).EQ.IP_ACCUM_SULPHATE).OR.                     RAD_ALL.21510 
     &              (TYPE_AEROSOL(I).EQ.IP_AITKEN_SULPHATE) ) THEN                 RAD_ALL.21511 
                  N_AEROSOL_RETAIN=N_AEROSOL_RETAIN+1                              RAD_ALL.21512 
                  INDEX_AEROSOL_RETAIN(N_AEROSOL_RETAIN)=I                         RAD_ALL.21513 
                  N_AEROSOL_FOUND=N_AEROSOL_FOUND+1                                RAD_ALL.21514 
               ENDIF                                                               RAD_ALL.21515 
                                                                                   RAD_ALL.21516 
            ENDDO                                                                  RAD_ALL.21517 
!                                                                                  RAD_ALL.21518 
            IF (N_AEROSOL_FOUND.NE.2) THEN                                         RAD_ALL.21519 
!                                                                                  RAD_ALL.21520 
               IERR=I_ERR_FATAL                                                    RAD_ALL.21521 
               CMESSAGE='The SW Spectral file lacks some '                         RAD_ALL.21522 
     &            //'sulphate aerosols.'                                           RAD_ALL.21523 
               RETURN                                                              RAD_ALL.21524 
!                                                                                  RAD_ALL.21525 
            ENDIF                                                                  RAD_ALL.21526 
                                                                                   RAD_ALL.21527 
         ELSE                                                                      RAD_ALL.21528 
!                                                                                  RAD_ALL.21529 
            IERR=I_ERR_FATAL                                                       RAD_ALL.21530 
            CMESSAGE='SW Spectral file contains no aerosol data.'                  RAD_ALL.21531 
            RETURN                                                                 RAD_ALL.21532 
!                                                                                  RAD_ALL.21533 
         ENDIF                                                                     RAD_ALL.21534 
!                                                                                  RAD_ALL.21535 
      ENDIF                                                                        RAD_ALL.21536 
!                                                                                  RAD_ALL.21537 
!     Set an appropriate reduced dimension.                                        RAD_ALL.21538 
      NPD_AEROSOL_SPECIES_SW=MAX(N_AEROSOL_RETAIN, 1)                              RAD_ALL.21539 
!                                                                                  RAD_ALL.21540 
!     Set the allowed number of humidities from the number of                      RAD_ALL.21541 
!     retained aerosols.                                                           RAD_ALL.21542 
!                                                                                  RAD_ALL.21543 
      IF (L_PRESENT(11)) THEN                                                      RAD_ALL.21544 
         DO I=1, N_AEROSOL_RETAIN                                                  RAD_ALL.21545 
            IF (I_AEROSOL_PARAMETRIZATION(INDEX_AEROSOL_RETAIN(I)).EQ.             RAD_ALL.21546 
     &         IP_AEROSOL_PARAM_MOIST) THEN                                        RAD_ALL.21547 
               NPD_HUMIDITIES_SW=MAX(NPD_HUMIDITIES_SW                             RAD_ALL.21548 
     &            , NHUMIDITY(INDEX_AEROSOL_RETAIN(I)))                            RAD_ALL.21549 
            ENDIF                                                                  RAD_ALL.21550 
         ENDDO                                                                     RAD_ALL.21551 
      ENDIF                                                                        RAD_ALL.21552 
!                                                                                  RAD_ALL.21553 
!                                                                                  RAD_ALL.21554 
!                                                                                  RAD_ALL.21555 
!                                                                                  RAD_ALL.21556 
!     TRANSFER THE LARGE NAMELIST TO THE REDUCED SPECTRUM.                         RAD_ALL.21557 
!                                                                                  RAD_ALL.21558 
!                                                                                  RAD_ALL.21559 
      CALL R2_COMPRESS_SPECTRUM(                                                   RAD_ALL.21560 
!                       Spectral Array in Namelist                                 RAD_ALL.21561 
     &     L_PRESENT                                                               RAD_ALL.21562 
     &   , N_BAND, WAVE_LENGTH_SHORT , WAVE_LENGTH_LONG                            RAD_ALL.21563 
     &   , N_BAND_EXCLUDE, INDEX_EXCLUDE                                           RAD_ALL.21564 
     &   , SOLAR_FLUX_BAND, RAYLEIGH_COEFFICIENT                                   RAD_ALL.21565 
     &   , N_ABSORB, N_BAND_ABSORB, INDEX_ABSORB, TYPE_ABSORB                      RAD_ALL.21566 
     &   , I_BAND_ESFT, K_ESFT, W_ESFT, I_SCALE_ESFT                               RAD_ALL.21567 
     &   , I_SCALE_FNC, SCALE_VECTOR, P_REFERENCE, T_REFERENCE                     RAD_ALL.21568 
     &   , N_DEG_FIT, THERMAL_COEFFICIENT, T_REF_PLANCK                            RAD_ALL.21569 
     &   , I_SPEC_SURFACE, L_SURFACE, SURFACE_ALBEDO                               RAD_ALL.21570 
     &   , N_DIR_ALBEDO_FIT, DIRECT_ALBEDO_PARM, EMISSIVITY_GROUND                 RAD_ALL.21571 
     &   , N_BAND_CONTINUUM, INDEX_CONTINUUM, INDEX_WATER                          RAD_ALL.21572 
     &   , K_CONTINUUM, I_SCALE_FNC_CONT, SCALE_CONTINUUM                          RAD_ALL.21573 
     &   , P_REF_CONTINUUM, T_REF_CONTINUUM                                        RAD_ALL.21574 
     &   , L_DROP_TYPE, I_DROP_PARAMETRIZATION, DROP_PARAMETER_LIST                RAD_ALL.21575 
     &   , DROP_PARM_MIN_DIM, DROP_PARM_MAX_DIM                                    RAD_ALL.21576 
     &   , L_ICE_TYPE, I_ICE_PARAMETRIZATION, ICE_PARAMETER_LIST                   RAD_ALL.21577 
     &   , ICE_PARM_MIN_DIM, ICE_PARM_MAX_DIM                                      RAD_ALL.21578 
     &   , N_AEROSOL, TYPE_AEROSOL                                                 RAD_ALL.21579 
     &   , N_AEROSOL_RETAIN, INDEX_AEROSOL_RETAIN                                  RAD_ALL.21580 
     &   , L_AEROSOL_SPECIES, AEROSOL_ABSORPTION                                   RAD_ALL.21581 
     &   , AEROSOL_SCATTERING, AEROSOL_ASYMMETRY                                   RAD_ALL.21582 
     &   , NHUMIDITY, HUMIDITIES, I_AEROSOL_PARAMETRIZATION                        RAD_ALL.21583 
     &   , L_DOPPLER_PRESENT, DOPPLER_CORRECTION                                   RAD_ALL.21584 
!                       Reduced Spectral Array                                     RAD_ALL.21585 
!     ------------------------------------------------------------------           SWSARG3A.2     
!     ARGUMENT LIST FOR THE REDUCED SW SPECTRAL FILE.                              SWSARG3A.3     
!     (NOTE: SWSPDC3A, SWSPCM3A AND SWSARG3A MUST BE CONSISTENT)                   SWSARG3A.4     
!                                                                                  SWSARG3A.5     
     &   , NPD_TYPE_SW, NPD_BAND_SW, NPD_EXCLUDE_SW                                SWSARG3A.6     
     &   , NPD_SPECIES_SW, NPD_ESFT_TERM_SW, NPD_SCALE_FNC_SW                      SWSARG3A.7     
     &   , NPD_SCALE_VARIABLE_SW, NPD_THERMAL_COEFF_SW                             SWSARG3A.8     
     &   , NPD_SURFACE_SW, NPD_ALBEDO_PARM_SW, NPD_CONTINUUM_SW                    SWSARG3A.9     
     &   , NPD_DROP_TYPE_SW, NPD_ICE_TYPE_SW, NPD_CLOUD_PARAMETER_SW               SWSARG3A.10    
     &   , NPD_AEROSOL_SPECIES_SW, NPD_HUMIDITIES_SW                               SWSARG3A.11    
     &   , L_PRESENT_SW, N_BAND_SW, WAVE_LENGTH_SHORT_SW                           SWSARG3A.12    
     &   , WAVE_LENGTH_LONG_SW, N_BAND_EXCLUDE_SW, INDEX_EXCLUDE_SW                SWSARG3A.13    
     &   , SOLAR_FLUX_BAND_SW, RAYLEIGH_COEFFICIENT_SW                             SWSARG3A.14    
     &   , N_ABSORB_SW, N_BAND_ABSORB_SW, INDEX_ABSORB_SW                          SWSARG3A.15    
     &   , TYPE_ABSORB_SW, I_BAND_ESFT_SW, I_SCALE_ESFT_SW                         SWSARG3A.16    
     &   , I_SCALE_FNC_SW, K_ESFT_SW, W_ESFT_SW                                    SWSARG3A.17    
     &   , SCALE_VECTOR_SW, P_REFERENCE_SW, T_REFERENCE_SW                         SWSARG3A.18    
     &   , N_DEG_FIT_SW, THERMAL_COEFFICIENT_SW, T_REF_PLANCK_SW                   SWSARG3A.19    
     &   , I_SPEC_SURFACE_SW, N_DIR_ALBEDO_FIT_SW, L_SURFACE_SW                    SWSARG3A.20    
     &   , SURFACE_ALBEDO_SW, DIRECT_ALBEDO_PARM_SW                                SWSARG3A.21    
     &   , EMISSIVITY_GROUND_SW, N_BAND_CONTINUUM_SW, INDEX_CONTINUUM_SW           SWSARG3A.22    
     &   , INDEX_WATER_SW, I_SCALE_FNC_CONT_SW, K_CONTINUUM_SW                     SWSARG3A.23    
     &   , SCALE_CONTINUUM_SW, P_REF_CONTINUUM_SW, T_REF_CONTINUUM_SW              SWSARG3A.24    
     &   , I_DROP_PARAMETRIZATION_SW, L_DROP_TYPE_SW                               SWSARG3A.25    
     &   , DROP_PARAMETER_LIST_SW                                                  SWSARG3A.26    
     &   , DROP_PARM_MIN_DIM_SW, DROP_PARM_MAX_DIM_SW                              SWSARG3A.27    
     &   , N_AEROSOL_SW, TYPE_AEROSOL_SW, I_AEROSOL_PARAMETRIZATION_SW             SWSARG3A.28    
     &   , NHUMIDITY_SW, HUMIDITIES_SW, L_AEROSOL_SPECIES_SW                       SWSARG3A.29    
     &   , AEROSOL_ABSORPTION_SW, AEROSOL_SCATTERING_SW                            SWSARG3A.30    
     &   , AEROSOL_ASYMMETRY_SW                                                    SWSARG3A.31    
     &   , I_ICE_PARAMETRIZATION_SW, L_ICE_TYPE_SW                                 SWSARG3A.32    
     &   , ICE_PARAMETER_LIST_SW                                                   SWSARG3A.33    
     &   , ICE_PARM_MIN_DIM_SW, ICE_PARM_MAX_DIM_SW                                SWSARG3A.34    
     &   , L_DOPPLER_PRESENT_SW, DOPPLER_CORRECTION_SW                             SWSARG3A.35    
!                                                                                  SWSARG3A.36    
!     ------------------------------------------------------------------           SWSARG3A.37    
     &   )                                                                         RAD_ALL.21587 
!                                                                                  RAD_ALL.21588 
!                                                                                  RAD_ALL.21589 
!                                                                                  RAD_ALL.21590 
      RETURN                                                                       RAD_ALL.21591 
      END 
