!+ Subroutine to read a longwave spectral namelist.                                RAD_ALL.21593 
!                                                                                  RAD_ALL.21594 
! Purpose:                                                                         RAD_ALL.21595 
!   To read a longwave namelist into a spectral array.                             RAD_ALL.21596 
!                                                                                  RAD_ALL.21597 
! Method:                                                                          RAD_ALL.21598 
!   The spectrum is read into the dynamically allocated array                      RAD_ALL.21599 
!   and then reduced to a more manageable size.                                    RAD_ALL.21600 
!                                                                                  RAD_ALL.21601 
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.21602 
!                                                                                  RAD_ALL.21603 
! History:                                                                         RAD_ALL.21604 
!       Version         Date                    Comment                            RAD_ALL.21605 
!       4.0             27-07-95                Original Code                      RAD_ALL.21606 
!                                               (J. M. Edwards)                    RAD_ALL.21607 
!                                                                                  RAD_ALL.21608 
!       4.4             02-09-97                Aerosol flags passed               RAD_ALL.21609 
!                                               in to the code to                  RAD_ALL.21610 
!                                               enable only those                  RAD_ALL.21611 
!                                               required to be                     RAD_ALL.21612 
!                                               selected. Spectral                 RAD_ALL.21613 
!                                               data are no longer                 RAD_ALL.21614 
!                                               compressed into a                  RAD_ALL.21615 
!                                               single array.                      RAD_ALL.21616 
!                                               IOSTAT error code                  RAD_ALL.21617 
!                                               returned as part of                RAD_ALL.21618 
!                                               CMESSAGE.                          RAD_ALL.21619 
!                                               (J. M. Edwards)                    RAD_ALL.21620 
!                                                                                  RAD_ALL.21621 
! Description of Code:                                                             RAD_ALL.21622 
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.21623 
!                                                                                  RAD_ALL.21624 
!- ---------------------------------------------------------------------           RAD_ALL.21625 
      SUBROUTINE R2_LW_SPECIN(IERR, CMESSAGE                                       RAD_ALL.21626 
     &   , L_CLIMAT_AEROSOL, L_USE_SULPC_DIRECT                                    RAD_ALL.21627 
     &   )                                                                         RAD_ALL.21628 
!                                                                                  RAD_ALL.21629 
!                                                                                  RAD_ALL.21630 
!     ------------------------------------------------------------------           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.21632 
!                                                                                  RAD_ALL.21633 
!     DUMMY ARGUMENTS                                                              RAD_ALL.21634 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.21635 
     &     L_CLIMAT_AEROSOL                                                        RAD_ALL.21636 
!             CLIMATOLOGICAL AEROSOLS ARE TO BE INCLUDED                           RAD_ALL.21637 
     &   , L_USE_SULPC_DIRECT                                                      RAD_ALL.21638 
!             THE DIRECT EFFECTS OF SULPHATE AEROSOLS ARE                          RAD_ALL.21639 
!             TO BE INCLUDED                                                       RAD_ALL.21640 
!                                                                                  RAD_ALL.21641 
      INTEGER   !, INTENT(OUT)                                                     RAD_ALL.21642 
     &     IERR                                                                    RAD_ALL.21643 
!             ERROR FLAG                                                           RAD_ALL.21644 
      CHARACTER*80      !, INTENT(OUT)                                             RAD_ALL.21645 
     &     CMESSAGE                                                                RAD_ALL.21646 
!                                                                                  RAD_ALL.21647 
!                                                                                  RAD_ALL.21648 
!                                                                                  RAD_ALL.21649 
!     LOCAL VARIABLES.                                                             RAD_ALL.21650 
!                                                                                  RAD_ALL.21651 
      CHARACTER*80                                                                 RAD_ALL.21652 
     &     LW_SPECTRAL_FILE                                                        RAD_ALL.21653 
!             NAME OF FILE CONTAINING THE SPECTRAL DATA                            RAD_ALL.21654 
      INTEGER                                                                      RAD_ALL.21655 
     &     IERR_GET_FILE                                                           RAD_ALL.21656 
!             ERROR FLAG RETURNED BY GET_FILE (NOT NECESSARILY                     RAD_ALL.21657 
!             CONSISTENT WITH THE FLAGS IN ERROR3A).                               RAD_ALL.21658 
c      &   , IOS                                                                   INT_IOSTAT.3     
      integer*4 ios                                                                INT_IOSTAT.4     
!             STATUS OF I/O                                                        RAD_ALL.21660 
!                                                                                  RAD_ALL.21661 
      INTEGER                                                                      RAD_ALL.21662 
     &     N_AEROSOL_RETAIN                                                        RAD_ALL.21663 
!             NUMBER OF AEROSOLS IN THE SPECTRAL FILE TO BE RETAINED               RAD_ALL.21664 
!             FOR THE RADIATIVE CALCULATION                                        RAD_ALL.21665 
     &   , INDEX_AEROSOL_RETAIN(NPD_AEROSOL_SPECIES)                               RAD_ALL.21666 
!             INDEXING NUMBERS OF THE RETAINED AEROSOLS                            RAD_ALL.21667 
     &   , N_AEROSOL_FOUND                                                         RAD_ALL.21668 
!             NUMBER OF AEROSOLS FOR THE CURRENT GROUP OF PROCESSES                RAD_ALL.21669 
!             FOUND IN THE SPECTRAL FILE                                           RAD_ALL.21670 
!                                                                                  RAD_ALL.21671 
!                                                                                  RAD_ALL.21672 
!     DECLARE THE ELEMENTS OF THE INITIAL SPECTRUM FOR DYNAMIC                     RAD_ALL.21673 
!     ALLOCATION AND SET UP AN APPROPRIATE NAMELIST.                               RAD_ALL.21674 
!                                                                                  RAD_ALL.21675 
!     ------------------------------------------------------------------           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   
!     ------------------------------------------------------------------           LWSP3A.2     
!     MODULE TO DECLARE ELEMENTS OF A SPECTRAL FILE AS A NAMELIST.                 LWSP3A.3     
!                                                                                  LWSP3A.4     
      NAMELIST/R2LWSP/                                                             LWSP3A.5     
!                       Blocks Present                                             LWSP3A.6     
     &     L_PRESENT                                                               LWSP3A.7     
!                       Block 0                                                    LWSP3A.8     
     &   , N_BAND, N_ABSORB, N_AEROSOL, TYPE_ABSORB, TYPE_AEROSOL                  LWSP3A.9     
!                       Block 1                                                    LWSP3A.10    
     &   , WAVE_LENGTH_SHORT, WAVE_LENGTH_LONG                                     LWSP3A.11    
!                       Block 2                                                    LWSP3A.12    
     &   , SOLAR_FLUX_BAND                                                         LWSP3A.13    
!                       Block 3                                                    LWSP3A.14    
     &   , RAYLEIGH_COEFFICIENT                                                    LWSP3A.15    
!                       Block 4                                                    LWSP3A.16    
     &   , N_BAND_ABSORB, INDEX_ABSORB                                             LWSP3A.17    
!                       Block 5                                                    LWSP3A.18    
     &   , I_BAND_ESFT, I_SCALE_ESFT, I_SCALE_FNC                                  LWSP3A.19    
     &   , P_REFERENCE, T_REFERENCE, K_ESFT, W_ESFT, SCALE_VECTOR                  LWSP3A.20    
!                       Block 6                                                    LWSP3A.21    
     &   , N_DEG_FIT, T_REF_PLANCK, THERMAL_COEFFICIENT                            LWSP3A.22    
!                       Block 7                                                    LWSP3A.23    
     &   , I_SPEC_SURFACE, N_DIR_ALBEDO_FIT, L_SURFACE                             LWSP3A.24    
     &   , SURFACE_ALBEDO, DIRECT_ALBEDO_PARM, EMISSIVITY_GROUND                   LWSP3A.25    
!                       Block 8                                                    LWSP3A.26    
     &   , N_BAND_CONTINUUM, INDEX_CONTINUUM, INDEX_WATER                          LWSP3A.27    
!                       Block 9                                                    LWSP3A.28    
     &   , I_SCALE_FNC_CONT, P_REF_CONTINUUM, T_REF_CONTINUUM                      LWSP3A.29    
     &   , K_CONTINUUM, SCALE_CONTINUUM                                            LWSP3A.30    
!                       Block 10                                                   LWSP3A.31    
     &   , I_DROP_PARAMETRIZATION, L_DROP_TYPE, DROP_PARAMETER_LIST                LWSP3A.32    
     &   , DROP_PARM_MIN_DIM, DROP_PARM_MAX_DIM                                    LWSP3A.33    
!                       Block 11                                                   LWSP3A.34    
     &   , I_AEROSOL_PARAMETRIZATION, NHUMIDITY, L_AEROSOL_SPECIES                 LWSP3A.35    
     &   , AEROSOL_ABSORPTION, AEROSOL_SCATTERING, AEROSOL_ASYMMETRY               LWSP3A.36    
     &   , HUMIDITIES                                                              LWSP3A.37    
!                       Block 12                                                   LWSP3A.38    
     &   , I_ICE_PARAMETRIZATION, L_ICE_TYPE, ICE_PARAMETER_LIST                   LWSP3A.39    
     &   , ICE_PARM_MIN_DIM, ICE_PARM_MAX_DIM                                      LWSP3A.40    
!                       Block 13                                                   LWSP3A.41    
     &   , L_DOPPLER_PRESENT, DOPPLER_CORRECTION                                   LWSP3A.42    
!                       Block 14                                                   LWSP3A.43    
     &   , N_BAND_EXCLUDE, INDEX_EXCLUDE                                           LWSP3A.44    
!                                                                                  LWSP3A.45    
!     ------------------------------------------------------------------           LWSP3A.46    
!                                                                                  RAD_ALL.21678 
!                                                                                  RAD_ALL.21679 
!     DECLARE THE REDUCED SW SPECTRAL FILE AND ITS HOLDING COMMON BLOCK.           RAD_ALL.21680 
!                                                                                  RAD_ALL.21681 
!     ------------------------------------------------------------------           LWSPDL3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       LWSPDL3A.3     
!                                                                                  LWSPDL3A.4     
!     MODULE CONTAINING DECLARATIONS FOR REDUCED LW-SPECTRAL FILE.                 LWSPDL3A.5     
!     NOTE: LWSPDC3A, LWSPCM3A AND LWSARG3A MUST BE CONSISTENT.                    LWSPDL3A.6     
!     NOTE: SINCE THE ARRAYS HERE WILL BE PASSED IN A COMMON BLOCK                 LWSPDL3A.7     
!     THEIR SIZES MUST BE FIXED, EVEN THOUGH VARIABLE SIZES ARE USED               LWSPDL3A.8     
!     LOWER IN THE CODE. THEY ARE ACCORDINGLY DEFINED AS 1-DIMENSIONAL             LWSPDL3A.9     
!     ARRAYS WITH FIXED MAXIMUM SIZES AT THIS LEVEL.                               LWSPDL3A.10    
!                                                                                  LWSPDL3A.11    
!     ------------------------------------------------------------------           LWSPDL3A.12    
!                                                                                  LWSPDL3A.13    
!                                                                                  LWSPDL3A.14    
!     DIMENSIONS FOR THE REDUCED LW SPECTRAL FILE                                  LWSPDL3A.15    
!                                                                                  LWSPDL3A.16    
      INTEGER                                                                      LWSPDL3A.17    
     &     NPD_TYPE_LW                                                             LWSPDL3A.18    
!             NUMBER OF TYPES OF DATA IN LW SPECTRUM                               LWSPDL3A.19    
     &   , NPD_BAND_LW                                                             LWSPDL3A.20    
!             NUMBER OF SPECTRAL BANDS IN LW SPECTRUM                              LWSPDL3A.21    
     &   , NPD_EXCLUDE_LW                                                          LWSPDL3A.22    
!             NUMBER OF EXCLUDED BANDS IN LW SPECTRUM                              LWSPDL3A.23    
     &   , NPD_SPECIES_LW                                                          LWSPDL3A.24    
!             NUMBER OF GASEOUS SPECIES IN LW SPECTRUM                             LWSPDL3A.25    
     &   , NPD_ESFT_TERM_LW                                                        LWSPDL3A.26    
!             NUMBER OF ESFT TERMS IN LW SPECTRUM                                  LWSPDL3A.27    
     &   , NPD_SCALE_FNC_LW                                                        LWSPDL3A.28    
!             NUMBER OF SCALING FUNCTIONS IN LW SPECTRUM                           LWSPDL3A.29    
     &   , NPD_SCALE_VARIABLE_LW                                                   LWSPDL3A.30    
!             NUMBER OF SCALING VARIABLES IN LW SPECTRUM                           LWSPDL3A.31    
     &   , NPD_SURFACE_LW                                                          LWSPDL3A.32    
!             NUMBER OF SURFACE TYPES IN LW SPECTRUM                               LWSPDL3A.33    
     &   , NPD_ALBEDO_PARM_LW                                                      LWSPDL3A.34    
!             NUMBER OF ALBEDO PARAMETERS IN LW SPECTRUM                           LWSPDL3A.35    
     &   , NPD_CONTINUUM_LW                                                        LWSPDL3A.36    
!             NUMBER OF CONTINUA IN LW SPECTRUM                                    LWSPDL3A.37    
     &   , NPD_DROP_TYPE_LW                                                        LWSPDL3A.38    
!             NUMBER OF DROP TYPES IN LW SPECTRUM                                  LWSPDL3A.39    
     &   , NPD_ICE_TYPE_LW                                                         LWSPDL3A.40    
!             NUMBER OF ICE CRYSTAL TYPES IN LW SPECTRUM                           LWSPDL3A.41    
     &   , NPD_AEROSOL_SPECIES_LW                                                  LWSPDL3A.42    
!             NUMBER OF AEROSOL SPECIES IN LW SPECTRUM                             LWSPDL3A.43    
     &   , NPD_CLOUD_PARAMETER_LW                                                  LWSPDL3A.44    
!             MAX NUMBER OF CLOUD PARAMETERS IN LW SPECTRUM                        LWSPDL3A.45    
     &   , NPD_HUMIDITIES_LW                                                       LWSPDL3A.46    
!             MAXIMUM NUMBER OF HUMIDITIES IN LW SPECTRUM                          LWSPDL3A.47    
     &   , NPD_THERMAL_COEFF_LW                                                    LWSPDL3A.48    
!             NUMBER OF THERMAL COEFFICIENTS IN LW SPECTRUM                        LWSPDL3A.49    
!                                                                                  LWSPDL3A.50    
!                                                                                  LWSPDL3A.51    
!                                                                                  LWSPDL3A.52    
!     GENERAL FIELDS:                                                              LWSPDL3A.53    
!                                                                                  LWSPDL3A.54    
      LOGICAL                                                                      LWSPDL3A.55    
     &     L_PRESENT_LW(0: NPD_TYPE)                                               LWSPDL3A.56    
!             FLAG FOR TYPES OF DATA PRESENT                                       LWSPDL3A.57    
!                                                                                  LWSPDL3A.58    
!                                                                                  LWSPDL3A.59    
!                                                                                  LWSPDL3A.60    
!     PROPERTIES OF THE SPECTRAL BANDS:                                            LWSPDL3A.61    
!                                                                                  LWSPDL3A.62    
      INTEGER                                                                      LWSPDL3A.63    
     &     N_BAND_LW                                                               LWSPDL3A.64    
!             NUMBER OF SPECTRAL BANDS                                             LWSPDL3A.65    
!                                                                                  LWSPDL3A.66    
      REAL                                                                         LWSPDL3A.67    
     &     WAVE_LENGTH_SHORT_LW(NPD_BAND)                                          LWSPDL3A.68    
!             SHORTER WAVELENGTH LIMITS                                            LWSPDL3A.69    
     &   , WAVE_LENGTH_LONG_LW(NPD_BAND)                                           LWSPDL3A.70    
!             LONGER WAVELENGTH LIMITS                                             LWSPDL3A.71    
!                                                                                  LWSPDL3A.72    
!                                                                                  LWSPDL3A.73    
!                                                                                  LWSPDL3A.74    
!     EXCLUSION OF SPECIFIC BANDS FROM PARTS OF THE SPECTRUM:                      LWSPDL3A.75    
!                                                                                  LWSPDL3A.76    
      INTEGER                                                                      LWSPDL3A.77    
     &     N_BAND_EXCLUDE_LW(NPD_BAND)                                             LWSPDL3A.78    
!             NUMBER OF EXCLUDED BANDS WITHIN EACH SPECTRAL BAND                   LWSPDL3A.79    
     &   , INDEX_EXCLUDE_LW(NPD_EXCLUDE, NPD_BAND)                                 LWSPDL3A.80    
!             INDICES OF EXCLUDED BANDS                                            LWSPDL3A.81    
!                                                                                  LWSPDL3A.82    
!                                                                                  LWSPDL3A.83    
!                                                                                  LWSPDL3A.84    
!     FIELDS FOR THE SOLAR FLUX:                                                   LWSPDL3A.85    
!                                                                                  LWSPDL3A.86    
      REAL                                                                         LWSPDL3A.87    
     &     SOLAR_FLUX_BAND_LW(NPD_BAND)                                            LWSPDL3A.88    
!             FRACTION OF THE INCIDENT SOLAR FLUX IN EACH BAND                     LWSPDL3A.89    
!                                                                                  LWSPDL3A.90    
!                                                                                  LWSPDL3A.91    
!                                                                                  LWSPDL3A.92    
!     FIELDS FOR RAYLEIGH SCATTERING:                                              LWSPDL3A.93    
!                                                                                  LWSPDL3A.94    
      REAL                                                                         LWSPDL3A.95    
     &     RAYLEIGH_COEFFICIENT_LW(NPD_BAND)                                       LWSPDL3A.96    
!             RAYLEIGH COEFFICIENTS                                                LWSPDL3A.97    
!                                                                                  LWSPDL3A.98    
!                                                                                  LWSPDL3A.99    
!                                                                                  LWSPDL3A.100   
!     FIELDS FOR GASEOUS ABSORPTION:                                               LWSPDL3A.101   
!                                                                                  LWSPDL3A.102   
      INTEGER                                                                      LWSPDL3A.103   
     &     N_ABSORB_LW                                                             LWSPDL3A.104   
!             NUMBER OF ABSORBERS                                                  LWSPDL3A.105   
     &   , N_BAND_ABSORB_LW(NPD_BAND)                                              LWSPDL3A.106   
!             NUMBER OF ABSORBERS IN EACH BAND                                     LWSPDL3A.107   
     &   , INDEX_ABSORB_LW(NPD_SPECIES, NPD_BAND)                                  LWSPDL3A.108   
!             LIST OF ABSORBERS IN EACH BAND                                       LWSPDL3A.109   
     &   , TYPE_ABSORB_LW(NPD_SPECIES)                                             LWSPDL3A.110   
!             TYPES OF EACH GAS IN THE SPECTRAL FILE                               LWSPDL3A.111   
     &   , I_BAND_ESFT_LW(NPD_BAND, NPD_SPECIES)                                   LWSPDL3A.112   
!             NUMBER OF ESFT TERMS IN EACH BAND FOR EACH GAS                       LWSPDL3A.113   
     &   , I_SCALE_ESFT_LW(NPD_BAND, NPD_SPECIES)                                  LWSPDL3A.114   
!             TYPE OF ESFT SCALING                                                 LWSPDL3A.115   
     &   , I_SCALE_FNC_LW(NPD_BAND, NPD_SPECIES)                                   LWSPDL3A.116   
!             TYPE OF SCALING FUNCTION                                             LWSPDL3A.117   
!                                                                                  LWSPDL3A.118   
      REAL                                                                         LWSPDL3A.119   
     &     K_ESFT_LW(NPD_ESFT_TERM, NPD_BAND, NPD_SPECIES)                         LWSPDL3A.120   
!             ESFT EXPONENTS                                                       LWSPDL3A.121   
     &   , W_ESFT_LW(NPD_ESFT_TERM, NPD_BAND, NPD_SPECIES)                         LWSPDL3A.122   
!             ESFT WEIGHTS                                                         LWSPDL3A.123   
     &   , SCALE_VECTOR_LW(NPD_SCALE_VARIABLE, NPD_ESFT_TERM                       LWSPDL3A.124   
     &        , NPD_BAND, NPD_SPECIES)                                             LWSPDL3A.125   
!             SCALING PARAMETERS FOR EACH ABSORBER AND TERM                        LWSPDL3A.126   
     &   , P_REFERENCE_LW(NPD_SPECIES, NPD_BAND)                                   LWSPDL3A.127   
!             REFERENCE PRESSURE FOR SCALING FUNCTION                              LWSPDL3A.128   
     &   , T_REFERENCE_LW(NPD_SPECIES, NPD_BAND)                                   LWSPDL3A.129   
!             REFERENCE TEMPERATURE FOR SCALING FUNCTION                           LWSPDL3A.130   
!                                                                                  LWSPDL3A.131   
!                                                                                  LWSPDL3A.132   
!                                                                                  LWSPDL3A.133   
!     REPRESENTATION OF THE PLANCKIAN:                                             LWSPDL3A.134   
!                                                                                  LWSPDL3A.135   
      INTEGER                                                                      LWSPDL3A.136   
     &     N_DEG_FIT_LW                                                            LWSPDL3A.137   
!             DEGREE OF THERMAL POLYNOMIAL                                         LWSPDL3A.138   
!                                                                                  LWSPDL3A.139   
      REAL                                                                         LWSPDL3A.140   
     &     THERMAL_COEFFICIENT_LW(0: NPD_THERMAL_COEFF-1                           LWSPDL3A.141   
     &        , NPD_BAND)                                                          LWSPDL3A.142   
!             COEFFICIENTS IN POLYNOMIAL FIT TO SOURCE FUNCTION                    LWSPDL3A.143   
     &   , T_REF_PLANCK_LW                                                         LWSPDL3A.144   
!             PLANCKIAN REFERENCE TEMPERATURE                                      LWSPDL3A.145   
!                                                                                  LWSPDL3A.146   
!                                                                                  LWSPDL3A.147   
!                                                                                  LWSPDL3A.148   
!     SURFACE PROPERTIES:                                                          LWSPDL3A.149   
!                                                                                  LWSPDL3A.150   
      INTEGER                                                                      LWSPDL3A.151   
     &     I_SPEC_SURFACE_LW(NPD_SURFACE)                                          LWSPDL3A.152   
!             METHOD OF SPECIFYING PROPERTIES OF SURFACE                           LWSPDL3A.153   
     &   , N_DIR_ALBEDO_FIT_LW(NPD_SURFACE)                                        LWSPDL3A.154   
!             NUMBER OF PARAMETERS FITTING THE DIRECT ALBEDO                       LWSPDL3A.155   
!                                                                                  LWSPDL3A.156   
      LOGICAL                                                                      LWSPDL3A.157   
     &     L_SURFACE_LW(NPD_SURFACE)                                               LWSPDL3A.158   
!             SURFACE TYPES INCLUDED                                               LWSPDL3A.159   
!                                                                                  LWSPDL3A.160   
      REAL                                                                         LWSPDL3A.161   
     &     SURFACE_ALBEDO_LW(NPD_BAND, NPD_SURFACE)                                LWSPDL3A.162   
!             SURFACE ALBEDOS                                                      LWSPDL3A.163   
     &   , DIRECT_ALBEDO_PARM_LW(0: NPD_ALBEDO_PARM                                LWSPDL3A.164   
     &      , NPD_BAND, NPD_SURFACE)                                               LWSPDL3A.165   
!             COEFFICIENTS FOR FITTING DIRECT ALBEDO                               LWSPDL3A.166   
     &   , EMISSIVITY_GROUND_LW(NPD_BAND, NPD_SURFACE)                             LWSPDL3A.167   
!             SURFACE EMISSIVITIES                                                 LWSPDL3A.168   
!                                                                                  LWSPDL3A.169   
!                                                                                  LWSPDL3A.170   
!                                                                                  LWSPDL3A.171   
!     FIELDS FOR CONTINUA:                                                         LWSPDL3A.172   
!                                                                                  LWSPDL3A.173   
      INTEGER                                                                      LWSPDL3A.174   
     &     N_BAND_CONTINUUM_LW(NPD_BAND)                                           LWSPDL3A.175   
!             NUMBER OF CONTINUA IN EACH BAND                                      LWSPDL3A.176   
     &   , INDEX_CONTINUUM_LW(NPD_BAND, NPD_CONTINUUM)                             LWSPDL3A.177   
!             LIST OF CONTINUA IN EACH BAND                                        LWSPDL3A.178   
     &   , INDEX_WATER_LW                                                          LWSPDL3A.179   
!             INDEX OF WATER VAPOUR                                                LWSPDL3A.180   
     &   , I_SCALE_FNC_CONT_LW(NPD_BAND, NPD_CONTINUUM)                            LWSPDL3A.181   
!             TYPE OF SCALING FUNCTION FOR CONTINUUM                               LWSPDL3A.182   
!                                                                                  LWSPDL3A.183   
      REAL                                                                         LWSPDL3A.184   
     &     K_CONTINUUM_LW(NPD_BAND, NPD_CONTINUUM)                                 LWSPDL3A.185   
!             GREY EXTINCTION COEFFICIENTS FOR CONTINUUM                           LWSPDL3A.186   
     &   , SCALE_CONTINUUM_LW(NPD_SCALE_VARIABLE                                   LWSPDL3A.187   
     &      , NPD_BAND, NPD_CONTINUUM)                                             LWSPDL3A.188   
!             SCALING PARAMETERS FOR CONTINUUM                                     LWSPDL3A.189   
     &   , P_REF_CONTINUUM_LW(NPD_CONTINUUM, NPD_BAND)                             LWSPDL3A.190   
!             REFERENCE PRESSURE FOR SCALING OF CONTINUUM                          LWSPDL3A.191   
     &   , T_REF_CONTINUUM_LW(NPD_CONTINUUM, NPD_BAND)                             LWSPDL3A.192   
!             REFERENCE TEMPERATURE FOR SCALING OF CONTINUUM                       LWSPDL3A.193   
!                                                                                  LWSPDL3A.194   
!                                                                                  LWSPDL3A.195   
!                                                                                  LWSPDL3A.196   
!     FIELDS FOR WATER DROPLETS:                                                   LWSPDL3A.197   
!                                                                                  LWSPDL3A.198   
      INTEGER                                                                      LWSPDL3A.199   
     &     I_DROP_PARAMETRIZATION_LW(NPD_DROP_TYPE)                                LWSPDL3A.200   
!             PARAMETRIZATION TYPE OF DROPLETS                                     LWSPDL3A.201   
!                                                                                  LWSPDL3A.202   
      LOGICAL                                                                      LWSPDL3A.203   
     &     L_DROP_TYPE_LW(NPD_DROP_TYPE)                                           LWSPDL3A.204   
!             TYPES OF DROPLET PRESENT                                             LWSPDL3A.205   
!                                                                                  LWSPDL3A.206   
      REAL                                                                         LWSPDL3A.207   
     &     DROP_PARAMETER_LIST_LW(NPD_CLOUD_PARAMETER                              LWSPDL3A.208   
     &        , NPD_BAND, NPD_DROP_TYPE)                                           LWSPDL3A.209   
!             PARAMETERS USED TO FIT OPTICAL PROPERTIES OF CLOUDS                  LWSPDL3A.210   
     &   , DROP_PARM_MIN_DIM_LW(NPD_DROP_TYPE)                                     LWSPDL3A.211   
!             MINIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 LWSPDL3A.212   
     &   , DROP_PARM_MAX_DIM_LW(NPD_DROP_TYPE)                                     LWSPDL3A.213   
!             MAXIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 LWSPDL3A.214   
!                                                                                  LWSPDL3A.215   
!                                                                                  LWSPDL3A.216   
!                                                                                  LWSPDL3A.217   
!     FIELDS FOR AEROSOLS:                                                         LWSPDL3A.218   
!                                                                                  LWSPDL3A.219   
      INTEGER                                                                      LWSPDL3A.220   
     &     N_AEROSOL_LW                                                            LWSPDL3A.221   
!             NUMBER OF SPECIES OF AEROSOL                                         LWSPDL3A.222   
     &   , TYPE_AEROSOL_LW(NPD_AEROSOL_SPECIES)                                    LWSPDL3A.223   
!             TYPES OF AEROSOLS                                                    LWSPDL3A.224   
     &   , I_AEROSOL_PARAMETRIZATION_LW(NPD_AEROSOL_SPECIES)                       LWSPDL3A.225   
!             PARAMETRIZATION OF AEROSOLS                                          LWSPDL3A.226   
     &   , NHUMIDITY_LW(NPD_AEROSOL_SPECIES)                                       LWSPDL3A.227   
!             NUMBERS OF HUMIDITIES                                                LWSPDL3A.228   
!                                                                                  LWSPDL3A.229   
      LOGICAL                                                                      LWSPDL3A.230   
     &     L_AEROSOL_SPECIES_LW(NPD_AEROSOL_SPECIES)                               LWSPDL3A.231   
!             AEROSOL SPECIES INCLUDED                                             LWSPDL3A.232   
!                                                                                  LWSPDL3A.233   
      REAL                                                                         LWSPDL3A.234   
     &     AEROSOL_ABSORPTION_LW(NPD_HUMIDITIES                                    LWSPDL3A.235   
     &        , NPD_AEROSOL_SPECIES, NPD_BAND)                                     LWSPDL3A.236   
!             ABSORPTION BY AEROSOLS                                               LWSPDL3A.237   
     &   , AEROSOL_SCATTERING_LW(NPD_HUMIDITIES                                    LWSPDL3A.238   
     &        , NPD_AEROSOL_SPECIES, NPD_BAND)                                     LWSPDL3A.239   
!             SCATTERING BY AEROSOLS                                               LWSPDL3A.240   
     &   , AEROSOL_ASYMMETRY_LW(NPD_HUMIDITIES                                     LWSPDL3A.241   
     &        , NPD_AEROSOL_SPECIES, NPD_BAND)                                     LWSPDL3A.242   
!             ASYMMETRY OF AEROSOLS                                                LWSPDL3A.243   
     &   , HUMIDITIES_LW(NPD_HUMIDITIES, NPD_AEROSOL_SPECIES)                      LWSPDL3A.244   
!             HUMIDITIES FOR COMPONENTS                                            LWSPDL3A.245   
!                                                                                  LWSPDL3A.246   
!                                                                                  LWSPDL3A.247   
!                                                                                  LWSPDL3A.248   
!     FIELDS FOR ICE CRYSTALS:                                                     LWSPDL3A.249   
!                                                                                  LWSPDL3A.250   
      INTEGER                                                                      LWSPDL3A.251   
     &     I_ICE_PARAMETRIZATION_LW(NPD_ICE_TYPE)                                  LWSPDL3A.252   
!             TYPES OF PARAMETRIZATION OF ICE CRYSTALS                             LWSPDL3A.253   
!                                                                                  LWSPDL3A.254   
      LOGICAL                                                                      LWSPDL3A.255   
     &     L_ICE_TYPE_LW(NPD_ICE_TYPE)                                             LWSPDL3A.256   
!             TYPES OF ICE CRYSTAL PRESENT                                         LWSPDL3A.257   
!                                                                                  LWSPDL3A.258   
      REAL                                                                         LWSPDL3A.259   
     &     ICE_PARAMETER_LIST_LW(NPD_CLOUD_PARAMETER                               LWSPDL3A.260   
     &        , NPD_BAND, NPD_ICE_TYPE)                                            LWSPDL3A.261   
!             PARAMETERS USED TO FIT SINGLE SCATTERING OF ICE CRYSTALS             LWSPDL3A.262   
     &   , ICE_PARM_MIN_DIM_LW(NPD_ICE_TYPE)                                       LWSPDL3A.263   
!             MINIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 LWSPDL3A.264   
     &   , ICE_PARM_MAX_DIM_LW(NPD_ICE_TYPE)                                       LWSPDL3A.265   
!             MAXIMUM DIMENSION PERMISSIBLE IN THE PARAMETRIZATION                 LWSPDL3A.266   
!                                                                                  LWSPDL3A.267   
!                                                                                  LWSPDL3A.268   
!                                                                                  LWSPDL3A.269   
!     FIELDS FOR DOPPLER BROADENING:                                               LWSPDL3A.270   
!                                                                                  LWSPDL3A.271   
      LOGICAL                                                                      LWSPDL3A.272   
     &     L_DOPPLER_PRESENT_LW(NPD_SPECIES)                                       LWSPDL3A.273   
!             FLAG FOR DOPPLER BROADENING FOR EACH SPECIES                         LWSPDL3A.274   
!                                                                                  LWSPDL3A.275   
      REAL                                                                         LWSPDL3A.276   
     &     DOPPLER_CORRECTION_LW(NPD_SPECIES)                                      LWSPDL3A.277   
!             OFFSET TO PRESSURE TO REPRESENT DOPPLER BROADENING                   LWSPDL3A.278   
!                                                                                  LWSPDL3A.279   
!                                                                                  LWSPDL3A.280   
!                                                                                  LWSPDL3A.281   
!    ------------------------------------------------------------------            LWSPDL3A.282   
!     ------------------------------------------------------------------           LWSPCM3A.2     
!     MODULE DECLARING COMMON BLOCK CONTAINING THE REDUCED LW SPECTRAL             LWSPCM3A.3     
!     FILE.                                                                        LWSPCM3A.4     
!     (NOTE: LWSPDC3A, LWSPCM3A AND LWSARG3A MUST BE CONSISTENT)                   LWSPCM3A.5     
!                                                                                  LWSPCM3A.6     
!                                                                                  LWSPCM3A.7     
      COMMON/R2LWSPCM/                                                             LWSPCM3A.8     
!                                                                                  LWSPCM3A.9     
!     DIMENSIONS OF ARRAYS:                                                        LWSPCM3A.10    
     &     NPD_TYPE_LW, NPD_BAND_LW, NPD_EXCLUDE_LW                                LWSPCM3A.11    
     &   , NPD_SPECIES_LW, NPD_ESFT_TERM_LW, NPD_SCALE_FNC_LW                      LWSPCM3A.12    
     &   , NPD_SCALE_VARIABLE_LW                                                   LWSPCM3A.13    
     &   , NPD_THERMAL_COEFF_LW                                                    LWSPCM3A.14    
     &   , NPD_SURFACE_LW, NPD_ALBEDO_PARM_LW                                      LWSPCM3A.15    
     &   , NPD_CONTINUUM_LW                                                        LWSPCM3A.16    
     &   , NPD_DROP_TYPE_LW, NPD_ICE_TYPE_LW, NPD_CLOUD_PARAMETER_LW               LWSPCM3A.17    
     &   , NPD_AEROSOL_SPECIES_LW, NPD_HUMIDITIES_LW                               LWSPCM3A.18    
!                                                                                  LWSPCM3A.19    
!     GENERAL ARRAYS:                                                              LWSPCM3A.20    
     &   , L_PRESENT_LW                                                            LWSPCM3A.21    
!                                                                                  LWSPCM3A.22    
!     PROPERTIES OF BANDS:                                                         LWSPCM3A.23    
     &   , N_BAND_LW, WAVE_LENGTH_SHORT_LW, WAVE_LENGTH_LONG_LW                    LWSPCM3A.24    
!                                                                                  LWSPCM3A.25    
!     EXCLUSIONS FROM BANDS:                                                       LWSPCM3A.26    
     &   , N_BAND_EXCLUDE_LW, INDEX_EXCLUDE_LW                                     LWSPCM3A.27    
!                                                                                  LWSPCM3A.28    
!     SOLAR FIELDS:                                                                LWSPCM3A.29    
     &   , SOLAR_FLUX_BAND_LW, RAYLEIGH_COEFFICIENT_LW                             LWSPCM3A.30    
!                                                                                  LWSPCM3A.31    
!     GASEOUS ABSORPTION:                                                          LWSPCM3A.32    
     &   , N_ABSORB_LW, N_BAND_ABSORB_LW, INDEX_ABSORB_LW                          LWSPCM3A.33    
     &   , TYPE_ABSORB_LW                                                          LWSPCM3A.34    
     &   , I_BAND_ESFT_LW, I_SCALE_ESFT_LW, I_SCALE_FNC_LW                         LWSPCM3A.35    
     &   , K_ESFT_LW, W_ESFT_LW                                                    LWSPCM3A.36    
     &   , SCALE_VECTOR_LW, P_REFERENCE_LW, T_REFERENCE_LW                         LWSPCM3A.37    
!                                                                                  LWSPCM3A.38    
!     THERMAL SOURCE FUNCTION:                                                     LWSPCM3A.39    
     &   , N_DEG_FIT_LW, THERMAL_COEFFICIENT_LW, T_REF_PLANCK_LW                   LWSPCM3A.40    
!                                                                                  LWSPCM3A.41    
!     SURFACE PROPERTIES:                                                          LWSPCM3A.42    
     &   , I_SPEC_SURFACE_LW, N_DIR_ALBEDO_FIT_LW, L_SURFACE_LW                    LWSPCM3A.43    
     &   , SURFACE_ALBEDO_LW, DIRECT_ALBEDO_PARM_LW                                LWSPCM3A.44    
     &   , EMISSIVITY_GROUND_LW                                                    LWSPCM3A.45    
!                                                                                  LWSPCM3A.46    
!     CONTINUA:                                                                    LWSPCM3A.47    
     &   , N_BAND_CONTINUUM_LW, INDEX_CONTINUUM_LW, INDEX_WATER_LW                 LWSPCM3A.48    
     &   , I_SCALE_FNC_CONT_LW, K_CONTINUUM_LW                                     LWSPCM3A.49    
     &   , SCALE_CONTINUUM_LW, P_REF_CONTINUUM_LW, T_REF_CONTINUUM_LW              LWSPCM3A.50    
!                                                                                  LWSPCM3A.51    
!     WATER DROPLETS:                                                              LWSPCM3A.52    
     &   , I_DROP_PARAMETRIZATION_LW, L_DROP_TYPE_LW                               LWSPCM3A.53    
     &   , DROP_PARAMETER_LIST_LW                                                  LWSPCM3A.54    
     &   , DROP_PARM_MIN_DIM_LW, DROP_PARM_MAX_DIM_LW                              LWSPCM3A.55    
!                                                                                  LWSPCM3A.56    
!     AEROSOLS:                                                                    LWSPCM3A.57    
     &   , N_AEROSOL_LW, TYPE_AEROSOL_LW, I_AEROSOL_PARAMETRIZATION_LW             LWSPCM3A.58    
     &   , NHUMIDITY_LW, HUMIDITIES_LW, L_AEROSOL_SPECIES_LW                       LWSPCM3A.59    
     &   , AEROSOL_ABSORPTION_LW, AEROSOL_SCATTERING_LW                            LWSPCM3A.60    
     &   , AEROSOL_ASYMMETRY_LW                                                    LWSPCM3A.61    
!                                                                                  LWSPCM3A.62    
!     ICE CRYSTALS:                                                                LWSPCM3A.63    
     &   , I_ICE_PARAMETRIZATION_LW, L_ICE_TYPE_LW                                 LWSPCM3A.64    
     &   , ICE_PARAMETER_LIST_LW                                                   LWSPCM3A.65    
     &   , ICE_PARM_MIN_DIM_LW, ICE_PARM_MAX_DIM_LW                                LWSPCM3A.66    
!                                                                                  LWSPCM3A.67    
!     DOPPLER BROADENING:                                                          LWSPCM3A.68    
     &   , L_DOPPLER_PRESENT_LW, DOPPLER_CORRECTION_LW                             LWSPCM3A.69    
!                                                                                  LWSPCM3A.70    
!     ------------------------------------------------------------------           LWSPCM3A.71    
!                                                                                  RAD_ALL.21684 
!                                                                                  RAD_ALL.21685 
!     OTHER RADIATIVE VARIABLES FOR REDUCING THE SPECTRUM                          RAD_ALL.21686 
!                                                                                  RAD_ALL.21687 
!     ------------------------------------------------------------------           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.21691 
!                                                                                  RAD_ALL.21692 
!                                                                                  RAD_ALL.21693 
      INTEGER                                                                      RAD_ALL.21694 
     &     I                                                                       RAD_ALL.21695 
!             LOOP VARIABLE                                                        RAD_ALL.21696 
     &   , J                                                                       RAD_ALL.21697 
!             LOOP VARIABLE                                                        RAD_ALL.21698 
!                                                                                  RAD_ALL.21699 
      CHARACTER                                                                    RAD_ALL.21700 
     &     CH_IOS*5                                                                RAD_ALL.21701 
!             CHARACTER STRING FOR IOSTAT ERROR                                    RAD_ALL.21702 
!                                                                                  RAD_ALL.21703 
!     SUBROUTINES CALLED                                                           RAD_ALL.21704 
      EXTERNAL                                                                     RAD_ALL.21705 
     &     R2_COMPRESS_SPECTRUM                                                    RAD_ALL.21706 
!                                                                                  RAD_ALL.21707 
!                                                                                  RAD_ALL.21708 
!     EACH BLOCK IS INITIALIZED AS MISSING:                                        RAD_ALL.21709 
      DATA L_PRESENT/.FALSE., NPD_TYPE*.FALSE./                                    RAD_ALL.21710 
!                                                                                  RAD_ALL.21711 
!     INITIALIZE THE RANGE OF VALIDITY OF THE PARAMETRIZATIONS OF                  RAD_ALL.21712 
!     DROPLETS AND ICE CRYSTALS. OLD SPECTRAL FILES WILL NOT CONTAIN               RAD_ALL.21713 
!     SUCH DATA, SO THE LIMITS FOR DROPLETS ARE INITIALIZED TO THOSE               RAD_ALL.21714 
!     FORMERLY SET IN THE MICROPHYSICAL SCHEME (MRF/UMIST                          RAD_ALL.21715 
!     PARAMETRIZATION) TO ENSURE THAT THE RESULTS ARE BIT-REPRODUCIBLE.            RAD_ALL.21716 
!     VALUES FOR ICE COVER THE RANGE OF EFFECTIVE RADII USED IN                    RAD_ALL.21717 
!     GENERATING THE DATA FOR THE ORIGINAL PARAMETRIZATION OF ICE                  RAD_ALL.21718 
!     CRYSTALS.                                                                    RAD_ALL.21719 
!     AT SOME FUTURE RELEASE IT MAY BE DESIRABLE TO REMOVE DEFAULT                 RAD_ALL.21720 
!     SETTINGS.                                                                    RAD_ALL.21721 
      DATA DROP_PARM_MIN_DIM/NPD_DROP_TYPE*3.5E-07/                                RAD_ALL.21722 
      DATA DROP_PARM_MAX_DIM/NPD_DROP_TYPE*3.7E-05/                                RAD_ALL.21723 
      DATA ICE_PARM_MIN_DIM/NPD_ICE_TYPE*3.75E-07/                                 RAD_ALL.21724 
      DATA ICE_PARM_MAX_DIM/NPD_ICE_TYPE*8.0E-05/                                  RAD_ALL.21725 
!                                                                                  RAD_ALL.21726 
!                                                                                  RAD_ALL.21727 
!                                                                                  RAD_ALL.21728 
!     READ THE LONGWAVE SPECTRUM AS A NAMELIST.                                    RAD_ALL.21729 
      CALL GET_FILE(80, LW_SPECTRAL_FILE, 80, IERR_GET_FILE)                       RAD_ALL.21730 
      IF (IERR_GET_FILE.NE.0) THEN                                                 RAD_ALL.21731 
!        CONVERT THE ERROR FLAG FROM GET_FILE TO A FLAG RECOGNISED                 RAD_ALL.21732 
!        BY THE RADIATION CODE.                                                    RAD_ALL.21733 
         IERR=I_ERR_IO                                                             RAD_ALL.21734 
         CMESSAGE='Error reading name of longwave spectral file.'                  RAD_ALL.21735 
         RETURN                                                                    RAD_ALL.21736 
      ENDIF                                                                        RAD_ALL.21737 
      OPEN(UNIT=80, FILE=LW_SPECTRAL_FILE, IOSTAT=IOS)                             RAD_ALL.21738 
      IF (IOS.NE.0) THEN                                                           RAD_ALL.21739 
         IERR=I_ERR_IO                                                             RAD_ALL.21740 
      WRITE(CH_IOS, '(I5)') IOS                                                    RAD_ALL.21741 
         CMESSAGE='Error opening longwave spectral file.'                          RAD_ALL.21742 
     &      //' IOSTAT='//CH_IOS                                                   RAD_ALL.21743 
         RETURN                                                                    RAD_ALL.21744 
      ENDIF                                                                        RAD_ALL.21745 
      READ(80, R2LWSP)                                                             RAD_ALL.21746 
      CLOSE(80)                                                                    RAD_ALL.21747 
!                                                                                  RAD_ALL.21748 
!     TEST FOR MINIMAL REQUISITE INFORMATION.                                      RAD_ALL.21749 
      IF ( .NOT.(L_PRESENT(0).AND.                                                 RAD_ALL.21750 
     &           L_PRESENT(6) ) ) THEN                                             RAD_ALL.21751 
         CMESSAGE='Longwave spectrum is deficient.'                                RAD_ALL.21752 
         IERR=I_ERR_FATAL                                                          RAD_ALL.21753 
         RETURN                                                                    RAD_ALL.21754 
      ENDIF                                                                        RAD_ALL.21755 
!                                                                                  RAD_ALL.21756 
!                                                                                  RAD_ALL.21757 
!                                                                                  RAD_ALL.21758 
!     SET REDUCED DIMENSIONS, EITHER FROM THE SIZES OF THE FIXED ARRAYS            RAD_ALL.21759 
!     OR FROM THE ARRAYS READ IN.                                                  RAD_ALL.21760 
!                                                                                  RAD_ALL.21761 
      NPD_TYPE_LW=NPD_TYPE                                                         RAD_ALL.21762 
      NPD_BAND_LW=MAX(N_BAND, 1)                                                   RAD_ALL.21763 
      NPD_SPECIES_LW=MAX(N_ABSORB, 1)                                              RAD_ALL.21764 
      NPD_ALBEDO_PARM_LW=NPD_ALBEDO_PARM                                           RAD_ALL.21765 
      NPD_SCALE_FNC_LW=NPD_SCALE_FNC                                               RAD_ALL.21766 
      NPD_SCALE_VARIABLE_LW=NPD_SCALE_VARIABLE                                     RAD_ALL.21767 
      NPD_SURFACE_LW=NPD_SURFACE                                                   RAD_ALL.21768 
      NPD_CONTINUUM_LW=NPD_CONTINUUM                                               RAD_ALL.21769 
      NPD_THERMAL_COEFF_LW=N_DEG_FIT+1                                             RAD_ALL.21770 
      NPD_CLOUD_PARAMETER_LW=NPD_CLOUD_PARAMETER                                   RAD_ALL.21771 
!                                                                                  RAD_ALL.21772 
!                                                                                  RAD_ALL.21773 
!     SEARCH THE SPECTRUM TO FIND MAXIMUM DIMENSIONS.                              RAD_ALL.21774 
!                                                                                  RAD_ALL.21775 
      NPD_EXCLUDE_LW=1                                                             RAD_ALL.21776 
      IF (L_PRESENT(14)) THEN                                                      RAD_ALL.21777 
         DO I=1, N_BAND                                                            RAD_ALL.21778 
            NPD_EXCLUDE_LW=MAX(NPD_EXCLUDE_LW, N_BAND_EXCLUDE(I))                  RAD_ALL.21779 
         ENDDO                                                                     RAD_ALL.21780 
      ENDIF                                                                        RAD_ALL.21781 
!                                                                                  RAD_ALL.21782 
      NPD_ESFT_TERM_LW=1                                                           RAD_ALL.21783 
      IF (L_PRESENT(5)) THEN                                                       RAD_ALL.21784 
         DO I=1, N_BAND                                                            RAD_ALL.21785 
            DO J=1, N_BAND_ABSORB(I)                                               RAD_ALL.21786 
               NPD_ESFT_TERM_LW=MAX(NPD_ESFT_TERM_LW                               RAD_ALL.21787 
     &            , I_BAND_ESFT(I, INDEX_ABSORB(J, I)))                            RAD_ALL.21788 
            ENDDO                                                                  RAD_ALL.21789 
         ENDDO                                                                     RAD_ALL.21790 
      ENDIF                                                                        RAD_ALL.21791 
!                                                                                  RAD_ALL.21792 
      NPD_DROP_TYPE_LW=1                                                           RAD_ALL.21793 
      IF (L_PRESENT(10)) THEN                                                      RAD_ALL.21794 
         DO I=1, NPD_DROP_TYPE_LW                                                  RAD_ALL.21795 
            IF (L_DROP_TYPE(I)) THEN                                               RAD_ALL.21796 
               NPD_DROP_TYPE_LW=MAX(NPD_DROP_TYPE_LW, I)                           RAD_ALL.21797 
            ENDIF                                                                  RAD_ALL.21798 
         ENDDO                                                                     RAD_ALL.21799 
      ENDIF                                                                        RAD_ALL.21800 
!                                                                                  RAD_ALL.21801 
      NPD_ICE_TYPE_LW=1                                                            RAD_ALL.21802 
      IF (L_PRESENT(12)) THEN                                                      RAD_ALL.21803 
         DO I=1, NPD_ICE_TYPE                                                      RAD_ALL.21804 
            IF (L_ICE_TYPE(I)) THEN                                                RAD_ALL.21805 
               NPD_ICE_TYPE_LW=MAX(NPD_ICE_TYPE_LW, I)                             RAD_ALL.21806 
            ENDIF                                                                  RAD_ALL.21807 
         ENDDO                                                                     RAD_ALL.21808 
      ENDIF                                                                        RAD_ALL.21809 
!                                                                                  RAD_ALL.21810 
!                                                                                  RAD_ALL.21811 
!                                                                                  RAD_ALL.21812 
!     Aerosols must be treated carefully to allow for various                      RAD_ALL.21813 
!     different combinations without requiring the spectral file                   RAD_ALL.21814 
!     to be too constrained. Only those required will be retained.                 RAD_ALL.21815 
!                                                                                  RAD_ALL.21816 
!     Basic initialization to safe values.                                         RAD_ALL.21817 
      NPD_HUMIDITIES_LW=1                                                          RAD_ALL.21818 
      N_AEROSOL_RETAIN=0                                                           RAD_ALL.21819 
!                                                                                  RAD_ALL.21820 
!     Check the spectral file for climatological aerosols                          RAD_ALL.21821 
      IF (L_CLIMAT_AEROSOL) THEN                                                   RAD_ALL.21822 
!                                                                                  RAD_ALL.21823 
         IF (L_PRESENT(11)) THEN                                                   RAD_ALL.21824 
!                                                                                  RAD_ALL.21825 
!           Search for the aerosols required for this scheme.                      RAD_ALL.21826 
            N_AEROSOL_FOUND=0                                                      RAD_ALL.21827 
            DO I=1, N_AEROSOL                                                      RAD_ALL.21828 
!                                                                                  RAD_ALL.21829 
               IF ( (TYPE_AEROSOL(I).EQ.IP_WATER_SOLUBLE).OR.                      RAD_ALL.21830 
     &              (TYPE_AEROSOL(I).EQ.IP_DUST_LIKE).OR.                          RAD_ALL.21831 
     &              (TYPE_AEROSOL(I).EQ.IP_OCEANIC).OR.                            RAD_ALL.21832 
     &              (TYPE_AEROSOL(I).EQ.IP_SOOT).OR.                               RAD_ALL.21833 
     &              (TYPE_AEROSOL(I).EQ.IP_SULPHURIC) ) THEN                       RAD_ALL.21834 
                  N_AEROSOL_RETAIN=N_AEROSOL_RETAIN+1                              RAD_ALL.21835 
                  INDEX_AEROSOL_RETAIN(N_AEROSOL_RETAIN)=I                         RAD_ALL.21836 
                  N_AEROSOL_FOUND=N_AEROSOL_FOUND+1                                RAD_ALL.21837 
               ENDIF                                                               RAD_ALL.21838 
                                                                                   RAD_ALL.21839 
            ENDDO                                                                  RAD_ALL.21840 
!                                                                                  RAD_ALL.21841 
            IF (N_AEROSOL_FOUND.NE.5) THEN                                         RAD_ALL.21842 
!                                                                                  RAD_ALL.21843 
               IERR=I_ERR_FATAL                                                    RAD_ALL.21844 
               CMESSAGE='The LW Spectral file lacks some '                         RAD_ALL.21845 
     &            //'climatological aerosols.'                                     RAD_ALL.21846 
               RETURN                                                              RAD_ALL.21847 
!                                                                                  RAD_ALL.21848 
            ENDIF                                                                  RAD_ALL.21849 
                                                                                   RAD_ALL.21850 
         ELSE                                                                      RAD_ALL.21851 
!                                                                                  RAD_ALL.21852 
            IERR=I_ERR_FATAL                                                       RAD_ALL.21853 
            CMESSAGE='LW Spectral file contains no aerosol data.'                  RAD_ALL.21854 
            RETURN                                                                 RAD_ALL.21855 
!                                                                                  RAD_ALL.21856 
         ENDIF                                                                     RAD_ALL.21857 
!                                                                                  RAD_ALL.21858 
      ENDIF                                                                        RAD_ALL.21859 
                                                                                   RAD_ALL.21860 
!                                                                                  RAD_ALL.21861 
!     Check the spectral file for sulphate aerosols. (These are                    RAD_ALL.21862 
!     required only for the direct effect).                                        RAD_ALL.21863 
!                                                                                  RAD_ALL.21864 
      IF (L_USE_SULPC_DIRECT) THEN                                                 RAD_ALL.21865 
!                                                                                  RAD_ALL.21866 
         IF (L_PRESENT(11)) THEN                                                   RAD_ALL.21867 
!                                                                                  RAD_ALL.21868 
!           Search for the aerosols required for this scheme.                      RAD_ALL.21869 
            N_AEROSOL_FOUND=0                                                      RAD_ALL.21870 
            DO I=1, N_AEROSOL                                                      RAD_ALL.21871 
!                                                                                  RAD_ALL.21872 
               IF ( (TYPE_AEROSOL(I).EQ.IP_ACCUM_SULPHATE).OR.                     RAD_ALL.21873 
     &              (TYPE_AEROSOL(I).EQ.IP_AITKEN_SULPHATE) ) THEN                 RAD_ALL.21874 
                  N_AEROSOL_RETAIN=N_AEROSOL_RETAIN+1                              RAD_ALL.21875 
                  INDEX_AEROSOL_RETAIN(N_AEROSOL_RETAIN)=I                         RAD_ALL.21876 
                  N_AEROSOL_FOUND=N_AEROSOL_FOUND+1                                RAD_ALL.21877 
               ENDIF                                                               RAD_ALL.21878 
                                                                                   RAD_ALL.21879 
            ENDDO                                                                  RAD_ALL.21880 
!                                                                                  RAD_ALL.21881 
            IF (N_AEROSOL_FOUND.NE.2) THEN                                         RAD_ALL.21882 
!                                                                                  RAD_ALL.21883 
               IERR=I_ERR_FATAL                                                    RAD_ALL.21884 
               CMESSAGE='The LW Spectral file lacks some '                         RAD_ALL.21885 
     &            //'sulphate aerosols.'                                           RAD_ALL.21886 
               RETURN                                                              RAD_ALL.21887 
!                                                                                  RAD_ALL.21888 
            ENDIF                                                                  RAD_ALL.21889 
                                                                                   RAD_ALL.21890 
         ELSE                                                                      RAD_ALL.21891 
!                                                                                  RAD_ALL.21892 
            IERR=I_ERR_FATAL                                                       RAD_ALL.21893 
            CMESSAGE='LW Spectral file contains no aerosol data.'                  RAD_ALL.21894 
            RETURN                                                                 RAD_ALL.21895 
!                                                                                  RAD_ALL.21896 
         ENDIF                                                                     RAD_ALL.21897 
!                                                                                  RAD_ALL.21898 
      ENDIF                                                                        RAD_ALL.21899 
!                                                                                  RAD_ALL.21900 
!     Set an appropriate reduced dimension.                                        RAD_ALL.21901 
      NPD_AEROSOL_SPECIES_LW=MAX(N_AEROSOL_RETAIN, 1)                              RAD_ALL.21902 
!                                                                                  RAD_ALL.21903 
!     Set the allowed number of humidities from the number of                      RAD_ALL.21904 
!     retained aerosols.                                                           RAD_ALL.21905 
!                                                                                  RAD_ALL.21906 
      IF (L_PRESENT(11)) THEN                                                      RAD_ALL.21907 
         DO I=1, N_AEROSOL_RETAIN                                                  RAD_ALL.21908 
            IF (I_AEROSOL_PARAMETRIZATION(INDEX_AEROSOL_RETAIN(I)).EQ.             RAD_ALL.21909 
     &         IP_AEROSOL_PARAM_MOIST) THEN                                        RAD_ALL.21910 
               NPD_HUMIDITIES_LW=MAX(NPD_HUMIDITIES_LW                             RAD_ALL.21911 
     &            , NHUMIDITY(INDEX_AEROSOL_RETAIN(I)))                            RAD_ALL.21912 
            ENDIF                                                                  RAD_ALL.21913 
         ENDDO                                                                     RAD_ALL.21914 
      ENDIF                                                                        RAD_ALL.21915 
!                                                                                  RAD_ALL.21916 
!                                                                                  RAD_ALL.21917 
!                                                                                  RAD_ALL.21918 
!                                                                                  RAD_ALL.21919 
!     TRANSFER THE LARGE NAMELIST TO THE REDUCED SPECTRUM.                         RAD_ALL.21920 
!                                                                                  RAD_ALL.21921 
!                                                                                  RAD_ALL.21922 
      CALL R2_COMPRESS_SPECTRUM(                                                   RAD_ALL.21923 
!                       Spectral Array in Namelist                                 RAD_ALL.21924 
     &     L_PRESENT                                                               RAD_ALL.21925 
     &   , N_BAND, WAVE_LENGTH_SHORT , WAVE_LENGTH_LONG                            RAD_ALL.21926 
     &   , N_BAND_EXCLUDE, INDEX_EXCLUDE                                           RAD_ALL.21927 
     &   , SOLAR_FLUX_BAND, RAYLEIGH_COEFFICIENT                                   RAD_ALL.21928 
     &   , N_ABSORB, N_BAND_ABSORB, INDEX_ABSORB, TYPE_ABSORB                      RAD_ALL.21929 
     &   , I_BAND_ESFT, K_ESFT, W_ESFT, I_SCALE_ESFT                               RAD_ALL.21930 
     &   , I_SCALE_FNC, SCALE_VECTOR, P_REFERENCE, T_REFERENCE                     RAD_ALL.21931 
     &   , N_DEG_FIT, THERMAL_COEFFICIENT, T_REF_PLANCK                            RAD_ALL.21932 
     &   , I_SPEC_SURFACE, L_SURFACE, SURFACE_ALBEDO                               RAD_ALL.21933 
     &   , N_DIR_ALBEDO_FIT, DIRECT_ALBEDO_PARM, EMISSIVITY_GROUND                 RAD_ALL.21934 
     &   , N_BAND_CONTINUUM, INDEX_CONTINUUM, INDEX_WATER                          RAD_ALL.21935 
     &   , K_CONTINUUM, I_SCALE_FNC_CONT, SCALE_CONTINUUM                          RAD_ALL.21936 
     &   , P_REF_CONTINUUM, T_REF_CONTINUUM                                        RAD_ALL.21937 
     &   , L_DROP_TYPE, I_DROP_PARAMETRIZATION, DROP_PARAMETER_LIST                RAD_ALL.21938 
     &   , DROP_PARM_MIN_DIM, DROP_PARM_MAX_DIM                                    RAD_ALL.21939 
     &   , L_ICE_TYPE, I_ICE_PARAMETRIZATION, ICE_PARAMETER_LIST                   RAD_ALL.21940 
     &   , ICE_PARM_MIN_DIM, ICE_PARM_MAX_DIM                                      RAD_ALL.21941 
     &   , N_AEROSOL, TYPE_AEROSOL                                                 RAD_ALL.21942 
     &   , N_AEROSOL_RETAIN, INDEX_AEROSOL_RETAIN                                  RAD_ALL.21943 
     &   , L_AEROSOL_SPECIES, AEROSOL_ABSORPTION                                   RAD_ALL.21944 
     &   , AEROSOL_SCATTERING, AEROSOL_ASYMMETRY                                   RAD_ALL.21945 
     &   , NHUMIDITY, HUMIDITIES, I_AEROSOL_PARAMETRIZATION                        RAD_ALL.21946 
     &   , L_DOPPLER_PRESENT, DOPPLER_CORRECTION                                   RAD_ALL.21947 
!                       Reduced Spectral Array                                     RAD_ALL.21948 
!     ------------------------------------------------------------------           LWSARG3A.2     
!     ARGUMENT LIST OF LW SPECTRAL DATA.                                           LWSARG3A.3     
!     (NOTE: LWSPDC3A, LWSPCM3A AND LWSARG3A MUST BE CONSISTENT)                   LWSARG3A.4     
!                                                                                  LWSARG3A.5     
     &   , NPD_TYPE_LW, NPD_BAND_LW, NPD_EXCLUDE_LW                                LWSARG3A.6     
     &   , NPD_SPECIES_LW, NPD_ESFT_TERM_LW, NPD_SCALE_FNC_LW                      LWSARG3A.7     
     &   , NPD_SCALE_VARIABLE_LW                                                   LWSARG3A.8     
     &   , NPD_THERMAL_COEFF_LW                                                    LWSARG3A.9     
     &   , NPD_SURFACE_LW, NPD_ALBEDO_PARM_LW                                      LWSARG3A.10    
     &   , NPD_CONTINUUM_LW                                                        LWSARG3A.11    
     &   , NPD_DROP_TYPE_LW, NPD_ICE_TYPE_LW, NPD_CLOUD_PARAMETER_LW               LWSARG3A.12    
     &   , NPD_AEROSOL_SPECIES_LW, NPD_HUMIDITIES_LW                               LWSARG3A.13    
     &   , L_PRESENT_LW                                                            LWSARG3A.14    
     &   , N_BAND_LW, WAVE_LENGTH_SHORT_LW, WAVE_LENGTH_LONG_LW                    LWSARG3A.15    
     &   , N_BAND_EXCLUDE_LW, INDEX_EXCLUDE_LW                                     LWSARG3A.16    
     &   , SOLAR_FLUX_BAND_LW, RAYLEIGH_COEFFICIENT_LW                             LWSARG3A.17    
     &   , N_ABSORB_LW, N_BAND_ABSORB_LW, INDEX_ABSORB_LW                          LWSARG3A.18    
     &   , TYPE_ABSORB_LW                                                          LWSARG3A.19    
     &   , I_BAND_ESFT_LW, I_SCALE_ESFT_LW, I_SCALE_FNC_LW                         LWSARG3A.20    
     &   , K_ESFT_LW, W_ESFT_LW                                                    LWSARG3A.21    
     &   , SCALE_VECTOR_LW, P_REFERENCE_LW, T_REFERENCE_LW                         LWSARG3A.22    
     &   , N_DEG_FIT_LW, THERMAL_COEFFICIENT_LW, T_REF_PLANCK_LW                   LWSARG3A.23    
     &   , I_SPEC_SURFACE_LW, N_DIR_ALBEDO_FIT_LW, L_SURFACE_LW                    LWSARG3A.24    
     &   , SURFACE_ALBEDO_LW, DIRECT_ALBEDO_PARM_LW                                LWSARG3A.25    
     &   , EMISSIVITY_GROUND_LW                                                    LWSARG3A.26    
     &   , N_BAND_CONTINUUM_LW, INDEX_CONTINUUM_LW, INDEX_WATER_LW                 LWSARG3A.27    
     &   , I_SCALE_FNC_CONT_LW, K_CONTINUUM_LW                                     LWSARG3A.28    
     &   , SCALE_CONTINUUM_LW, P_REF_CONTINUUM_LW, T_REF_CONTINUUM_LW              LWSARG3A.29    
     &   , I_DROP_PARAMETRIZATION_LW, L_DROP_TYPE_LW                               LWSARG3A.30    
     &   , DROP_PARAMETER_LIST_LW                                                  LWSARG3A.31    
     &   , DROP_PARM_MIN_DIM_LW, DROP_PARM_MAX_DIM_LW                              LWSARG3A.32    
     &   , N_AEROSOL_LW, TYPE_AEROSOL_LW                                           LWSARG3A.33    
     &   , I_AEROSOL_PARAMETRIZATION_LW                                            LWSARG3A.34    
     &   , NHUMIDITY_LW, HUMIDITIES_LW, L_AEROSOL_SPECIES_LW                       LWSARG3A.35    
     &   , AEROSOL_ABSORPTION_LW, AEROSOL_SCATTERING_LW                            LWSARG3A.36    
     &   , AEROSOL_ASYMMETRY_LW                                                    LWSARG3A.37    
     &   , I_ICE_PARAMETRIZATION_LW, L_ICE_TYPE_LW                                 LWSARG3A.38    
     &   , ICE_PARAMETER_LIST_LW                                                   LWSARG3A.39    
     &   , ICE_PARM_MIN_DIM_LW, ICE_PARM_MAX_DIM_LW                                LWSARG3A.40    
     &   , L_DOPPLER_PRESENT_LW, DOPPLER_CORRECTION_LW                             LWSARG3A.41    
!                                                                                  LWSARG3A.42    
!     ------------------------------------------------------------------           LWSARG3A.43    
     &   )                                                                         RAD_ALL.21950 
!                                                                                  RAD_ALL.21951 
!                                                                                  RAD_ALL.21952 
!                                                                                  RAD_ALL.21953 
      RETURN                                                                       RAD_ALL.21954 
      END  
