C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.14534 
C                                                                                  RAD_ALL.14535 
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.14536 
C restrictions as set forth in the contract.                                       RAD_ALL.14537 
C                                                                                  RAD_ALL.14538 
C                Meteorological Office                                             RAD_ALL.14539 
C                London Road                                                       RAD_ALL.14540 
C                BRACKNELL                                                         RAD_ALL.14541 
C                Berkshire UK                                                      RAD_ALL.14542 
C                RG12 2SZ                                                          RAD_ALL.14543 
C                                                                                  RAD_ALL.14544 
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.14545 
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.14546 
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.14547 
C Modelling at the above address.                                                  RAD_ALL.14548 
C ******************************COPYRIGHT******************************            RAD_ALL.14549 
C                                                                                  RAD_ALL.14550 
!+ Subroutine to calculate the fluxes within the band with one gas.                RAD_ALL.14551 
!                                                                                  RAD_ALL.14552 
! Method:                                                                          RAD_ALL.14553 
!       Monochromatic calculations are performed for each ESFT term                RAD_ALL.14554 
!       and the results are summed.                                                RAD_ALL.14555 
!                                                                                  RAD_ALL.14556 
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.14557 
!                                                                                  RAD_ALL.14558 
! History:                                                                         RAD_ALL.14559 
!       Version         Date                    Comment                            RAD_ALL.14560 
!       4.0             27-07-95                Original Code                      RAD_ALL.14561 
!                                               (J. M. Edwards)                    RAD_ALL.14562 
!       4.2             08-08-96                Code for vertically                RAD_ALL.14563 
!                                               coherent convective                RAD_ALL.14564 
!                                               cloud added.                       RAD_ALL.14565 
!                                               (J. M. Edwards)                    RAD_ALL.14566 
!                                                                                  RAD_ALL.14567 
! Description of Code:                                                             RAD_ALL.14568 
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.14569 
!                                                                                  RAD_ALL.14570 
!- ---------------------------------------------------------------------           RAD_ALL.14571 
      SUBROUTINE SOLVE_BAND_ONE_GAS(IERR                                           RAD_ALL.14572 
!                       Atmospheric Column                                         RAD_ALL.14573 
     &   , N_PROFILE, N_LAYER, L_LAYER, I_TOP, P, T, D_MASS                        RAD_ALL.14574 
!                       Angular Integration                                        RAD_ALL.14575 
     &   , I_ANGULAR_INTEGRATION, I_2STREAM, L_2_STREAM_CORRECT                    RAD_ALL.14576 
     &   , L_RESCALE, N_ORDER_GAUSS                                                RAD_ALL.14577 
!                       Treatment of Scattering                                    RAD_ALL.14578 
     &   , I_SCATTER_METHOD_BAND                                                   RAD_ALL.14579 
!                       Options for Solver                                         RAD_ALL.14580 
     &   , I_SOLVER, L_NET, I_EXTRAPOLATE_MIX_NET, N_AUGMENT                       RAD_ALL.14581 
!                       Gaseous Properties                                         RAD_ALL.14582 
     &   , I_BAND, I_GAS                                                           RAD_ALL.14583 
     &   , I_BAND_ESFT, I_SCALE_ESFT, I_SCALE_FNC                                  RAD_ALL.14584 
     &   , K_ESFT, W_ESFT, SCALE_VECTOR                                            RAD_ALL.14585 
     &   , P_REFERENCE, T_REFERENCE                                                RAD_ALL.14586 
     &   , GAS_MIX_RATIO, GAS_FRAC_RESCALED                                        RAD_ALL.14587 
     &   , L_DOPPLER, DOPPLER_CORRECTION                                           RAD_ALL.14588 
!                       Spectral Region                                            RAD_ALL.14589 
     &   , ISOLIR                                                                  RAD_ALL.14590 
!                       Solar Properties                                           RAD_ALL.14591 
     &   , SEC_0, SOLAR_FLUX                                                       RAD_ALL.14592 
!                       Infra-red Properties                                       RAD_ALL.14593 
     &   , PLANCK_SOURCE_TOP, PLANCK_SOURCE_BOTTOM                                 RAD_ALL.14594 
     &   , DIFF_PLANCK_BAND                                                        RAD_ALL.14595 
     &   , L_IR_SOURCE_QUAD, DIFF_PLANCK_BAND_2                                    RAD_ALL.14596 
!                       Surface Properties                                         RAD_ALL.14597 
     &   , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR, THERMAL_GROUND_BAND            RAD_ALL.14598 
!                       Clear-sky Optical Properties                               RAD_ALL.14599 
     &   , K_GREY_TOT_FREE, K_EXT_SCAT_FREE, ASYMMETRY_FREE                        RAD_ALL.14600 
     &   , FORWARD_SCATTER_FREE                                                    RAD_ALL.14601 
!                       Cloudy Properties                                          RAD_ALL.14602 
     &   , L_CLOUD, I_CLOUD                                                        RAD_ALL.14603 
!                       Cloud Geometry                                             RAD_ALL.14604 
     &   , N_CLOUD_TOP                                                             RAD_ALL.14605 
     &   , N_CLOUD_TYPE, FRAC_CLOUD                                                RAD_ALL.14606 
     &   , I_REGION_CLOUD, FRAC_REGION                                             RAD_ALL.14607 
     &   , W_FREE, N_FREE_PROFILE, I_FREE_PROFILE                                  RAD_ALL.14608 
     &   , W_CLOUD, N_CLOUD_PROFILE, I_CLOUD_PROFILE                               RAD_ALL.14609 
     &   , CLOUD_OVERLAP                                                           RAD_ALL.14610 
     &   , N_COLUMN, L_COLUMN, AREA_COLUMN                                         RAD_ALL.14611 
!                       Cloudy Optical Properties                                  RAD_ALL.14612 
     &   , K_GREY_TOT_CLOUD, K_EXT_SCAT_CLOUD                                      RAD_ALL.14613 
     &   , ASYMMETRY_CLOUD, FORWARD_SCATTER_CLOUD                                  RAD_ALL.14614 
!                       Calculated Fluxes                                          RAD_ALL.14615 
     &   , FLUX_DIRECT_BAND, FLUX_TOTAL_BAND                                       RAD_ALL.14616 
!                       Flags for Clear-sky Fluxes                                 RAD_ALL.14617 
     &   , L_CLEAR, I_SOLVER_CLEAR                                                 RAD_ALL.14618 
!                       Clear-sky Fluxes                                           RAD_ALL.14619 
     &   , FLUX_DIRECT_CLEAR_BAND, FLUX_TOTAL_CLEAR_BAND                           RAD_ALL.14620 
!                       Planckian Function                                         RAD_ALL.14621 
     &   , PLANCK_SOURCE_BAND                                                      RAD_ALL.14622 
!                       Dimensions of Arrays                                       RAD_ALL.14623 
     &   , NPD_PROFILE, NPD_LAYER, NPD_COLUMN                                      RAD_ALL.14624 
     &   , NPD_BAND, NPD_SPECIES                                                   RAD_ALL.14625 
     &   , NPD_ESFT_TERM, NPD_SCALE_VARIABLE, NPD_SCALE_FNC                        RAD_ALL.14626 
     &   )                                                                         RAD_ALL.14627 
!                                                                                  RAD_ALL.14628 
!                                                                                  RAD_ALL.14629 
!                                                                                  RAD_ALL.14630 
      IMPLICIT NONE                                                                RAD_ALL.14631 
!                                                                                  RAD_ALL.14632 
!                                                                                  RAD_ALL.14633 
!     SIZES OF DUMMY ARRAYS.                                                       RAD_ALL.14634 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14635 
     &     NPD_PROFILE                                                             RAD_ALL.14636 
!             MAXIMUM NUMBER OF PROFILES                                           RAD_ALL.14637 
     &   , NPD_LAYER                                                               RAD_ALL.14638 
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.14639 
     &   , NPD_COLUMN                                                              RAD_ALL.14640 
!             NUMBER OF COLUMNS PER POINT                                          RAD_ALL.14641 
     &   , NPD_BAND                                                                RAD_ALL.14642 
!             MAXIMUM NUMBER OF BANDS                                              RAD_ALL.14643 
     &   , NPD_SPECIES                                                             RAD_ALL.14644 
!             MAXIMUM NUMBER OF SPECIES                                            RAD_ALL.14645 
     &   , NPD_ESFT_TERM                                                           RAD_ALL.14646 
!             MAXIMUM NUMBER OF ESFT VARIABLES                                     RAD_ALL.14647 
     &   , NPD_SCALE_VARIABLE                                                      RAD_ALL.14648 
!             MAXIMUM NUMBER OF SCALING VARIABLES                                  RAD_ALL.14649 
     &   , NPD_SCALE_FNC                                                           RAD_ALL.14650 
!             MAXIMUM NUMBER OF SCALING FUNCTIONS                                  RAD_ALL.14651 
!                                                                                  RAD_ALL.14652 
!     INCLUDE COMDECKS.                                                            RAD_ALL.14653 
!     ------------------------------------------------------------------           DIMFIX3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       DIMFIX3A.3     
!                                                                                  DIMFIX3A.4     
!     MODULE TO SET INTERNAL DIMENSIONS TIED TO ALGORITHMS,                        DIMFIX3A.5     
!     MOSTLY FOR CLOUDS.                                                           DIMFIX3A.6     
!                                                                                  DIMFIX3A.7     
      INTEGER                                                                      DIMFIX3A.8     
     &     NPD_CLOUD_COMPONENT                                                     DIMFIX3A.9     
!             NUMBER OF COMPONENTS OF CLOUDS                                       DIMFIX3A.10    
     &   , NPD_CLOUD_TYPE                                                          DIMFIX3A.11    
!             NUMBER OF PERMITTED TYPES OF CLOUDS.                                 DIMFIX3A.12    
     &   , NPD_CLOUD_REPRESENTATION                                                DIMFIX3A.13    
!             NUMBER OF PERMITTED REPRESENTATIONS OF CLOUDS.                       DIMFIX3A.14    
     &   , NPD_OVERLAP_COEFF                                                       DIMFIX3A.15    
!             NUMBER OF OVERLAP COEFFICIENTS FOR CLOUDS                            DIMFIX3A.16    
     &   , NPD_SOURCE_COEFF                                                        DIMFIX3A.17    
!             NUMBER OF COEFFICIENTS FOR TWO-STREAM SOURCES                        DIMFIX3A.18    
     &   , NPD_REGION                                                              DIMFIX3A.19    
!             NUMBER OF REGIONS IN A LAYER                                         DIMFIX3A.20    
!                                                                                  DIMFIX3A.21    
      PARAMETER(                                                                   DIMFIX3A.22    
     &     NPD_CLOUD_COMPONENT=4                                                   DIMFIX3A.23    
     &   , NPD_CLOUD_TYPE=4                                                        DIMFIX3A.24    
     &   , NPD_CLOUD_REPRESENTATION=4                                              DIMFIX3A.25    
     &   , NPD_OVERLAP_COEFF=18                                                    DIMFIX3A.26    
     &   , NPD_SOURCE_COEFF=2                                                      DIMFIX3A.27    
     &   , NPD_REGION=3                                                            DIMFIX3A.28    
     &   )                                                                         DIMFIX3A.29    
!                                                                                  DIMFIX3A.30    
!     ------------------------------------------------------------------           DIMFIX3A.31    
!     ------------------------------------------------------------------           ESFTSC3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       ESFTSC3A.3     
!                                                                                  ESFTSC3A.4     
!     MODULE SETTING TYPES OF ESFT SCALING                                         ESFTSC3A.5     
!                                                                                  ESFTSC3A.6     
      INTEGER                                                                      ESFTSC3A.7     
     &     IP_SCALE_NULL                                                           ESFTSC3A.8     
!             NO SCALING AT ALL                                                    ESFTSC3A.9     
     &   , IP_SCALE_BAND                                                           ESFTSC3A.10    
!             SAME SCALING THROUGHOUT BAND                                         ESFTSC3A.11    
     &   , IP_SCALE_TERM                                                           ESFTSC3A.12    
!             DIFFERENT SCALING FOR EACH ESFT                                      ESFTSC3A.13    
!                                                                                  ESFTSC3A.14    
      PARAMETER(                                                                   ESFTSC3A.15    
     &     IP_SCALE_NULL=0                                                         ESFTSC3A.16    
     &   , IP_SCALE_BAND=1                                                         ESFTSC3A.17    
     &   , IP_SCALE_TERM=2                                                         ESFTSC3A.18    
     &   )                                                                         ESFTSC3A.19    
!                                                                                  ESFTSC3A.20    
!     ------------------------------------------------------------------           ESFTSC3A.21    
!     ------------------------------------------------------------------           SPCRG3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       SPCRG3A.3     
!                                                                                  SPCRG3A.4     
!     MODULE TO SET FLAGS FOR DIFFERENT PORTIONS                                   SPCRG3A.5     
!     OF THE SPECTRUM.                                                             SPCRG3A.6     
!                                                                                  SPCRG3A.7     
      INTEGER                                                                      SPCRG3A.8     
     &     IP_SOLAR                                                                SPCRG3A.9     
!             SOLAR REGION                                                         SPCRG3A.10    
     &   , IP_INFRA_RED                                                            SPCRG3A.11    
!             INFRA-RED REGION                                                     SPCRG3A.12    
!                                                                                  SPCRG3A.13    
      PARAMETER(                                                                   SPCRG3A.14    
     &     IP_SOLAR=1                                                              SPCRG3A.15    
     &   , IP_INFRA_RED=2                                                          SPCRG3A.16    
     &   )                                                                         SPCRG3A.17    
!                                                                                  SPCRG3A.18    
!     ------------------------------------------------------------------           SPCRG3A.19    
!     ------------------------------------------------------------------           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.14658 
!                                                                                  RAD_ALL.14659 
!                                                                                  RAD_ALL.14660 
!     DUMMY ARGUMENTS.                                                             RAD_ALL.14661 
      INTEGER   !, INTENT(OUT)                                                     RAD_ALL.14662 
     &     IERR                                                                    RAD_ALL.14663 
!             ERROR FLAG                                                           RAD_ALL.14664 
!                                                                                  RAD_ALL.14665 
!                       Atmospheric Column                                         RAD_ALL.14666 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14667 
     &     N_PROFILE                                                               RAD_ALL.14668 
!             NUMBER OF PROFILES                                                   RAD_ALL.14669 
     &   , N_LAYER                                                                 RAD_ALL.14670 
!             NUMBER OF LAYERS                                                     RAD_ALL.14671 
     &   , I_TOP                                                                   RAD_ALL.14672 
!             TOP OF VERTICAL GRID                                                 RAD_ALL.14673 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.14674 
     &     L_LAYER                                                                 RAD_ALL.14675 
!             PROPERTIES GIVEN IN LAYERS                                           RAD_ALL.14676 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14677 
     &     P(NPD_PROFILE, 0: NPD_LAYER)                                            RAD_ALL.14678 
!             PRESSURE                                                             RAD_ALL.14679 
     &   , T(NPD_PROFILE, 0: NPD_LAYER)                                            RAD_ALL.14680 
!             TEMPERATURE                                                          RAD_ALL.14681 
     &   , D_MASS(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.14682 
!             MASS THICKNESS OF EACH LAYER                                         RAD_ALL.14683 
!                                                                                  RAD_ALL.14684 
!                       Angular Integration                                        RAD_ALL.14685 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14686 
     &     I_ANGULAR_INTEGRATION                                                   RAD_ALL.14687 
!             ANGULAR INTEGRATION SCHEME                                           RAD_ALL.14688 
     &   , I_2STREAM                                                               RAD_ALL.14689 
!             TWO-STREAM SCHEME                                                    RAD_ALL.14690 
     &   , N_ORDER_GAUSS                                                           RAD_ALL.14691 
!             ORDER OF GAUSSIAN INTEGRATION                                        RAD_ALL.14692 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.14693 
     &     L_2_STREAM_CORRECT                                                      RAD_ALL.14694 
!             USE AN EDGE CORRECTION                                               RAD_ALL.14695 
     &   , L_RESCALE                                                               RAD_ALL.14696 
!             RESCALE OPTICAL PROPERTIES                                           RAD_ALL.14697 
!                                                                                  RAD_ALL.14698 
!                       Treatment of Scattering                                    RAD_ALL.14699 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14700 
     &     I_SCATTER_METHOD_BAND                                                   RAD_ALL.14701 
!             METHOD OF TREATING SCATTERING                                        RAD_ALL.14702 
!                                                                                  RAD_ALL.14703 
!                       Options for Solver                                         RAD_ALL.14704 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14705 
     &     I_SOLVER                                                                RAD_ALL.14706 
!             SOLVER USED                                                          RAD_ALL.14707 
     &   , I_EXTRAPOLATE_MIX_NET                                                   RAD_ALL.14708 
!             METHOD FOR EXTRAPOLATING WITH A MIXED SOLVER                         RAD_ALL.14709 
     &   , N_AUGMENT                                                               RAD_ALL.14710 
!             LENGTH OF LONG FLUX VECTOR                                           RAD_ALL.14711 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.14712 
     &     L_NET                                                                   RAD_ALL.14713 
!             SOLVE FOR NET FLUXES                                                 RAD_ALL.14714 
!                                                                                  RAD_ALL.14715 
!                       Gaseous Properties                                         RAD_ALL.14716 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14717 
     &     I_BAND                                                                  RAD_ALL.14718 
!             BAND BEING CONSIDERED                                                RAD_ALL.14719 
     &   , I_GAS                                                                   RAD_ALL.14720 
!             GAS BEING CONSIDERED                                                 RAD_ALL.14721 
     &   , I_BAND_ESFT(NPD_BAND, NPD_SPECIES)                                      RAD_ALL.14722 
!             NUMBER OF TERMS IN BAND                                              RAD_ALL.14723 
     &   , I_SCALE_ESFT(NPD_BAND, NPD_SPECIES)                                     RAD_ALL.14724 
!             TYPE OF ESFT SCALING                                                 RAD_ALL.14725 
     &   , I_SCALE_FNC(NPD_BAND, NPD_SPECIES)                                      RAD_ALL.14726 
!             TYPE OF SCALING FUNCTION                                             RAD_ALL.14727 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.14728 
     &     L_DOPPLER(NPD_SPECIES)                                                  RAD_ALL.14729 
!             DOPPLER BROADENING INCLUDED                                          RAD_ALL.14730 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14731 
     &     K_ESFT(NPD_ESFT_TERM, NPD_BAND, NPD_SPECIES)                            RAD_ALL.14732 
!             EXPONENTIAL ESFT TERMS                                               RAD_ALL.14733 
     &   , W_ESFT(NPD_ESFT_TERM, NPD_BAND, NPD_SPECIES)                            RAD_ALL.14734 
!             WEIGHTS FOR ESFT                                                     RAD_ALL.14735 
     &   , SCALE_VECTOR(NPD_SCALE_VARIABLE, NPD_ESFT_TERM, NPD_BAND                RAD_ALL.14736 
     &        , NPD_SPECIES)                                                       RAD_ALL.14737 
!             ABSORBER SCALING PARAMETERS                                          RAD_ALL.14738 
     &   , P_REFERENCE(NPD_SPECIES, NPD_BAND)                                      RAD_ALL.14739 
!             REFERENCE SCALING PRESSURE                                           RAD_ALL.14740 
     &   , T_REFERENCE(NPD_SPECIES, NPD_BAND)                                      RAD_ALL.14741 
!             REFERENCE SCALING TEMPERATURE                                        RAD_ALL.14742 
     &   , GAS_MIX_RATIO(NPD_PROFILE, 0: NPD_LAYER, NPD_SPECIES)                   RAD_ALL.14743 
!             GAS MASS MIXING RATIOS                                               RAD_ALL.14744 
     &   , GAS_FRAC_RESCALED(NPD_PROFILE, 0: NPD_LAYER, NPD_SPECIES)               RAD_ALL.14745 
!             RESCALED GAS MASS FRACTIONS                                          RAD_ALL.14746 
     &   , DOPPLER_CORRECTION(NPD_SPECIES)                                         RAD_ALL.14747 
!             DOPPLER BROADENING TERMS                                             RAD_ALL.14748 
!                                                                                  RAD_ALL.14749 
!                       Spectral Region                                            RAD_ALL.14750 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14751 
     &     ISOLIR                                                                  RAD_ALL.14752 
!             VISIBLE OR IR                                                        RAD_ALL.14753 
!                                                                                  RAD_ALL.14754 
!                       Solar Properties                                           RAD_ALL.14755 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14756 
     &     SEC_0(NPD_PROFILE)                                                      RAD_ALL.14757 
!             SECANT OF SOLAR ZENITH ANGLE                                         RAD_ALL.14758 
     &   , SOLAR_FLUX(NPD_PROFILE)                                                 RAD_ALL.14759 
!             INCIDENT SOLAR FLUX IN BAND                                          RAD_ALL.14760 
!                                                                                  RAD_ALL.14761 
!                       Infra-red Properties                                       RAD_ALL.14762 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.14763 
     &     L_IR_SOURCE_QUAD                                                        RAD_ALL.14764 
!             USE A QUADRATIC SOURCE FUNCTION                                      RAD_ALL.14765 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14766 
     &     PLANCK_SOURCE_TOP(NPD_PROFILE)                                          RAD_ALL.14767 
!             PLANCKIAN SOURCE AT TOP                                              RAD_ALL.14768 
     &   , PLANCK_SOURCE_BOTTOM(NPD_PROFILE)                                       RAD_ALL.14769 
!             PLANCKIAN SOURCE AT BOTTOM                                           RAD_ALL.14770 
     &   , DIFF_PLANCK_BAND(NPD_PROFILE, NPD_LAYER)                                RAD_ALL.14771 
!             THERMAL SOURCE FUNCTION                                              RAD_ALL.14772 
     &   , DIFF_PLANCK_BAND_2(NPD_PROFILE, NPD_LAYER)                              RAD_ALL.14773 
!             TWICE SECOND DIFFERENCE OF PLANCKIAN IN BAND                         RAD_ALL.14774 
!                                                                                  RAD_ALL.14775 
!                       Surface Properties                                         RAD_ALL.14776 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14777 
     &     ALBEDO_SURFACE_DIFF(NPD_PROFILE)                                        RAD_ALL.14778 
!             DIFFUSE SURFACE ALBEDO                                               RAD_ALL.14779 
     &   , ALBEDO_SURFACE_DIR(NPD_PROFILE)                                         RAD_ALL.14780 
!             DIRECT SURFACE ALBEDO                                                RAD_ALL.14781 
     &   , THERMAL_GROUND_BAND(NPD_PROFILE)                                        RAD_ALL.14782 
!             THERMAL SOURCE FUNCTION AT GROUND                                    RAD_ALL.14783 
!                                                                                  RAD_ALL.14784 
!                       Clear-sky optical Properties                               RAD_ALL.14785 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14786 
     &     K_GREY_TOT_FREE(NPD_PROFILE, NPD_LAYER)                                 RAD_ALL.14787 
!             FREE ABSORPTIVE EXTINCTION                                           RAD_ALL.14788 
     &   , K_EXT_SCAT_FREE(NPD_PROFILE, NPD_LAYER)                                 RAD_ALL.14789 
!             FREE SCATTERING EXTINCTION                                           RAD_ALL.14790 
     &   , ASYMMETRY_FREE(NPD_PROFILE, NPD_LAYER)                                  RAD_ALL.14791 
!             CLEAR-SKY ASYMMETRY                                                  RAD_ALL.14792 
     &   , FORWARD_SCATTER_FREE(NPD_PROFILE, NPD_LAYER)                            RAD_ALL.14793 
!             FREE FORWARD SCATTERING                                              RAD_ALL.14794 
!                                                                                  RAD_ALL.14795 
!                       Cloudy Properties                                          RAD_ALL.14796 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.14797 
     &     L_CLOUD                                                                 RAD_ALL.14798 
!             CLOUDS REQUIRED                                                      RAD_ALL.14799 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14800 
     &     I_CLOUD                                                                 RAD_ALL.14801 
!             CLOUD SCHEME USED                                                    RAD_ALL.14802 
!                                                                                  RAD_ALL.14803 
!                       Cloud Geometry                                             RAD_ALL.14804 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14805 
     &     N_CLOUD_TOP                                                             RAD_ALL.14806 
!             TOP CLOUDY LAYER                                                     RAD_ALL.14807 
     &   , N_CLOUD_TYPE                                                            RAD_ALL.14808 
!             NUMBER OF TYPES OF CLOUDS                                            RAD_ALL.14809 
     &   , N_FREE_PROFILE(NPD_LAYER)                                               RAD_ALL.14810 
!             NUMBER OF FREE PROFILES                                              RAD_ALL.14811 
     &   , I_FREE_PROFILE(NPD_PROFILE, NPD_LAYER)                                  RAD_ALL.14812 
!             INDICES OF FREE PROFILES                                             RAD_ALL.14813 
     &   , N_CLOUD_PROFILE(NPD_LAYER)                                              RAD_ALL.14814 
!             NUMBER OF CLOUDY PROFILES                                            RAD_ALL.14815 
     &   , I_CLOUD_PROFILE(NPD_PROFILE, NPD_LAYER)                                 RAD_ALL.14816 
!             INDICES OF CLOUDY PROFILES                                           RAD_ALL.14817 
     &   , N_COLUMN(NPD_PROFILE)                                                   RAD_ALL.14818 
!             NUMBER OF COLUMNS REQUIRED                                           RAD_ALL.14819 
     &   , I_REGION_CLOUD(NPD_CLOUD_TYPE)                                          RAD_ALL.14820 
!             REGIONS IN WHICH TYPES OF CLOUDS FALL                                RAD_ALL.14821 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.14822 
     &     L_COLUMN(NPD_PROFILE, NPD_LAYER, NPD_COLUMN)                            RAD_ALL.14823 
!             FLAGS FOR CONTENT OF COLUMNS                                         RAD_ALL.14824 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14825 
     &     W_FREE(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.14826 
!             CLEAR-SKY FRACTION                                                   RAD_ALL.14827 
     &   , W_CLOUD(NPD_PROFILE, NPD_LAYER)                                         RAD_ALL.14828 
!             CLOUDY FRACTION                                                      RAD_ALL.14829 
     &   , FRAC_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                      RAD_ALL.14830 
!             FRACTIONS OF TYPES OF CLOUDS                                         RAD_ALL.14831 
     &   , CLOUD_OVERLAP(NPD_PROFILE, 0: NPD_LAYER, NPD_OVERLAP_COEFF)             RAD_ALL.14832 
!             COEFFICIENTS FOR TRANSFER FOR ENERGY AT INTERFACES                   RAD_ALL.14833 
     &   , AREA_COLUMN(NPD_PROFILE, NPD_COLUMN)                                    RAD_ALL.14834 
!             AREAS OF COLUMNS                                                     RAD_ALL.14835 
     &   , FRAC_REGION(NPD_PROFILE, NPD_LAYER, NPD_REGION)                         RAD_ALL.14836 
!             FRACTIONS OF TOTAL CLOUD OCCUPIED BY EACH REGION                     RAD_ALL.14837 
!                                                                                  RAD_ALL.14838 
!                       Cloudy Optical Properties                                  RAD_ALL.14839 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14840 
     &     K_GREY_TOT_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                RAD_ALL.14841 
!             CLOUDY ABSORPTIVE EXTINCTION                                         RAD_ALL.14842 
     &   , K_EXT_SCAT_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                RAD_ALL.14843 
!             CLOUDY SCATTERING EXTINCTION                                         RAD_ALL.14844 
     &   , ASYMMETRY_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)                 RAD_ALL.14845 
!             CLOUDY ASYMMETRY                                                     RAD_ALL.14846 
     &   , FORWARD_SCATTER_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)           RAD_ALL.14847 
!             CLOUDY FORWARD SCATTERING                                            RAD_ALL.14848 
!                                                                                  RAD_ALL.14849 
!                       Fluxes Calculated                                          RAD_ALL.14850 
      REAL  !, INTENT(OUT)                                                         RAD_ALL.14851 
     &     FLUX_DIRECT_BAND(NPD_PROFILE, 0: NPD_LAYER)                             RAD_ALL.14852 
!             DIRECT FLUX                                                          RAD_ALL.14853 
     &   , FLUX_TOTAL_BAND(NPD_PROFILE, 2*NPD_LAYER+2)                             RAD_ALL.14854 
!             TOTAL FLUX                                                           RAD_ALL.14855 
!                                                                                  RAD_ALL.14856 
!                       Flags for Clear-sky Calculations                           RAD_ALL.14857 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.14858 
     &     L_CLEAR                                                                 RAD_ALL.14859 
!             CALCULATE NET CLEAR-SKY PROPERTIES                                   RAD_ALL.14860 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.14861 
     &     I_SOLVER_CLEAR                                                          RAD_ALL.14862 
!             CLEAR SOLVER USED                                                    RAD_ALL.14863 
!                                                                                  RAD_ALL.14864 
!                       Clear-sky Fluxes Calculated                                RAD_ALL.14865 
      REAL  !, INTENT(OUT)                                                         RAD_ALL.14866 
     &     FLUX_DIRECT_CLEAR_BAND(NPD_PROFILE, 0: NPD_LAYER)                       RAD_ALL.14867 
!             CLEAR-SKY DIRECT FLUX                                                RAD_ALL.14868 
     &   , FLUX_TOTAL_CLEAR_BAND(NPD_PROFILE, 2*NPD_LAYER+2)                       RAD_ALL.14869 
!             CLEAR-SKY TOTAL FLUX                                                 RAD_ALL.14870 
!                                                                                  RAD_ALL.14871 
!                       Planckian Function                                         RAD_ALL.14872 
      REAL  !, INTENT(IN)                                                          RAD_ALL.14873 
     &     PLANCK_SOURCE_BAND(NPD_PROFILE, 0: NPD_LAYER)                           RAD_ALL.14874 
!             PLANCKIAN SOURCE IN BAND                                             RAD_ALL.14875 
!                                                                                  RAD_ALL.14876 
!                                                                                  RAD_ALL.14877 
!                                                                                  RAD_ALL.14878 
!     LOCAL VARIABLES.                                                             RAD_ALL.14879 
      INTEGER                                                                      RAD_ALL.14880 
     &     L                                                                       RAD_ALL.14881 
!             LOOP VARIABLE                                                        RAD_ALL.14882 
      INTEGER                                                                      RAD_ALL.14883 
     &     I_GAS_POINTER(NPD_SPECIES)                                              RAD_ALL.14884 
!             POINTER ARRAY FOR MONOCHROMATIC ESFTs                                RAD_ALL.14885 
     &   , IEX                                                                     RAD_ALL.14886 
!             INDEX OF ESFT TERM                                                   RAD_ALL.14887 
      REAL                                                                         RAD_ALL.14888 
     &     K_ESFT_MONO(NPD_SPECIES)                                                RAD_ALL.14889 
!             ESFT MONOCHROMATIC EXPONENTS                                         RAD_ALL.14890 
     &   , K_GAS_ABS(NPD_PROFILE, NPD_LAYER)                                       RAD_ALL.14891 
!             GASEOUS ABSORPTIVE EXTINCTION                                        RAD_ALL.14892 
     &   , SOURCE_GROUND(NPD_PROFILE)                                              RAD_ALL.14893 
!             GROUND SOURCE FUNCTION                                               RAD_ALL.14894 
     &   , FLUX_INC_DIRECT(NPD_PROFILE)                                            RAD_ALL.14895 
!             INCIDENT DIRECT FLUX                                                 RAD_ALL.14896 
     &   , FLUX_INC_DOWN(NPD_PROFILE)                                              RAD_ALL.14897 
!             INCIDENT DOWNWARD FLUX                                               RAD_ALL.14898 
     &   , DUMMY_KE(NPD_PROFILE, NPD_LAYER)                                        RAD_ALL.14899 
!             DUMMY ARRAY (NOT USED)                                               RAD_ALL.14900 
      REAL                                                                         RAD_ALL.14901 
     &     FLUX_DIRECT_PART(NPD_PROFILE, 0: NPD_LAYER)                             RAD_ALL.14902 
!             PARTIAL DIRECT FLUX                                                  RAD_ALL.14903 
     &   , FLUX_TOTAL_PART(NPD_PROFILE, 2*NPD_LAYER+2)                             RAD_ALL.14904 
!             PARTIAL TOTAL FLUX                                                   RAD_ALL.14905 
     &   , FLUX_DIRECT_CLEAR_PART(NPD_PROFILE, 0: NPD_LAYER)                       RAD_ALL.14906 
!             PARTIAL CLEAR-SKY DIRECT FLUX                                        RAD_ALL.14907 
     &   , FLUX_TOTAL_CLEAR_PART(NPD_PROFILE, 2*NPD_LAYER+2)                       RAD_ALL.14908 
!             PARTIAL CLEAR-SKY TOTAL FLUX                                         RAD_ALL.14909 
!                                                                                  RAD_ALL.14910 
!     SUBROUTINES CALLED:                                                          RAD_ALL.14911 
      EXTERNAL                                                                     RAD_ALL.14912 
     &     SCALE_ABSORB, GAS_OPTICAL_PROPERTIES                                    RAD_ALL.14913 
     &   , MONOCHROMATIC_FLUX, AUGMENT_FLUX                                        RAD_ALL.14914 
!                                                                                  RAD_ALL.14915 
!                                                                                  RAD_ALL.14916 
!                                                                                  RAD_ALL.14917 
                                                                                   RAD_ALL.14918 
!     THE ESFT TERMS FOR THE FIRST GAS IN THE BAND ALONE ARE USED.                 RAD_ALL.14919 
      I_GAS_POINTER(1)=I_GAS                                                       RAD_ALL.14920 
      DO IEX=1, I_BAND_ESFT(I_BAND, I_GAS)                                         RAD_ALL.14921 
!                                                                                  RAD_ALL.14922 
!        RESCALE FOR EACH ESFT TERM IF THAT IS REQUIRED.                           RAD_ALL.14923 
         IF (I_SCALE_ESFT(I_BAND, I_GAS).EQ.IP_SCALE_TERM) THEN                    RAD_ALL.14924 
            CALL SCALE_ABSORB(IERR, N_PROFILE, N_LAYER                             RAD_ALL.14925 
     &         , GAS_MIX_RATIO(1, 0, I_GAS), P, T                                  RAD_ALL.14926 
     &         , L_LAYER, I_TOP                                                    RAD_ALL.14927 
     &         , GAS_FRAC_RESCALED(1, 0, I_GAS)                                    RAD_ALL.14928 
     &         , I_SCALE_FNC(I_BAND, I_GAS)                                        RAD_ALL.14929 
     &         , P_REFERENCE(I_GAS, I_BAND)                                        RAD_ALL.14930 
     &         , T_REFERENCE(I_GAS, I_BAND)                                        RAD_ALL.14931 
     &         , SCALE_VECTOR(1, IEX, I_BAND, I_GAS)                               RAD_ALL.14932 
     &         , L_DOPPLER(I_GAS), DOPPLER_CORRECTION(I_GAS)                       RAD_ALL.14933 
     &         , NPD_PROFILE, NPD_LAYER, NPD_SCALE_FNC                             RAD_ALL.14934 
     &         , NPD_SCALE_VARIABLE                                                RAD_ALL.14935 
     &         )                                                                   RAD_ALL.14936 
            IF (IERR.NE.I_NORMAL) RETURN                                           RAD_ALL.14937 
         ENDIF                                                                     RAD_ALL.14938 
!                                                                                  RAD_ALL.14939 
!        SET THE APPROPRIATE BOUNDARY TERMS FOR THE TOTAL                          RAD_ALL.14940 
!        UPWARD AND DOWNWARD FLUXES.                                               RAD_ALL.14941 
!                                                                                  RAD_ALL.14942 
         IF (ISOLIR.EQ.IP_SOLAR) THEN                                              RAD_ALL.14943 
!           VISIBLE REGION.                                                        RAD_ALL.14944 
            DO L=1, N_PROFILE                                                      RAD_ALL.14945 
               SOURCE_GROUND(L)=0.0E+00                                            RAD_ALL.14946 
               FLUX_INC_DOWN(L)=SOLAR_FLUX(L)                                      RAD_ALL.14947 
               FLUX_INC_DIRECT(L)=SOLAR_FLUX(L)                                    RAD_ALL.14948 
            ENDDO                                                                  RAD_ALL.14949 
         ELSEIF (ISOLIR.EQ.IP_INFRA_RED) THEN                                      RAD_ALL.14950 
!           INFRA-RED REGION.                                                      RAD_ALL.14951 
            DO L=1, N_PROFILE                                                      RAD_ALL.14952 
               FLUX_INC_DIRECT(L)=0.0E+00                                          RAD_ALL.14953 
               FLUX_INC_DOWN(L)=-PLANCK_SOURCE_TOP(L)                              RAD_ALL.14954 
               SOURCE_GROUND(L)=THERMAL_GROUND_BAND(L)                             RAD_ALL.14955 
     &            -(1.0E+00-ALBEDO_SURFACE_DIFF(L))                                RAD_ALL.14956 
     &            *PLANCK_SOURCE_BOTTOM(L)                                         RAD_ALL.14957 
            ENDDO                                                                  RAD_ALL.14958 
         ENDIF                                                                     RAD_ALL.14959 
!                                                                                  RAD_ALL.14960 
!        ASSIGN THE MONOCHROMATIC ABSORPTION COEFFICIENT.                          RAD_ALL.14961 
         K_ESFT_MONO(I_GAS)=K_ESFT(IEX, I_BAND, I_GAS)                             RAD_ALL.14962 
!                                                                                  RAD_ALL.14963 
         CALL GAS_OPTICAL_PROPERTIES(N_PROFILE, N_LAYER                            RAD_ALL.14964 
     &      , 1, I_GAS_POINTER, K_ESFT_MONO                                        RAD_ALL.14965 
     &      , GAS_FRAC_RESCALED                                                    RAD_ALL.14966 
     &      , K_GAS_ABS                                                            RAD_ALL.14967 
     &      , NPD_PROFILE, NPD_LAYER, NPD_SPECIES                                  RAD_ALL.14968 
     &      )                                                                      RAD_ALL.14969 
!                                                                                  RAD_ALL.14970 
!                                                                                  RAD_ALL.14971 
         CALL MONOCHROMATIC_FLUX(IERR                                              RAD_ALL.14972 
!                       Atmospheric Properties                                     RAD_ALL.14973 
     &      , N_PROFILE, N_LAYER, D_MASS                                           RAD_ALL.14974 
!                       Angular Integration                                        RAD_ALL.14975 
     &      , I_ANGULAR_INTEGRATION, I_2STREAM, L_2_STREAM_CORRECT                 RAD_ALL.14976 
     &      , L_RESCALE, N_ORDER_GAUSS                                             RAD_ALL.14977 
!                       Treatment of Scattering                                    RAD_ALL.14978 
     &      , I_SCATTER_METHOD_BAND                                                RAD_ALL.14979 
!                       Options for Solver                                         RAD_ALL.14980 
     &      , I_SOLVER, L_NET, I_EXTRAPOLATE_MIX_NET, N_AUGMENT                    RAD_ALL.14981 
!                       Gaseous Propreties                                         RAD_ALL.14982 
     &      , K_GAS_ABS                                                            RAD_ALL.14983 
!                       Options for Equivalent Extinction                          RAD_ALL.14984 
     &      , .FALSE., DUMMY_KE                                                    RAD_ALL.14985 
!                       Spectral Region                                            RAD_ALL.14986 
     &      , ISOLIR                                                               RAD_ALL.14987 
!                       Infra-red Properties                                       RAD_ALL.14988 
     &      , DIFF_PLANCK_BAND                                                     RAD_ALL.14989 
     &      , L_IR_SOURCE_QUAD, DIFF_PLANCK_BAND_2                                 RAD_ALL.14990 
!                       Conditions at TOA                                          RAD_ALL.14991 
     &      , SEC_0, FLUX_INC_DIRECT, FLUX_INC_DOWN                                RAD_ALL.14992 
!                       Surface Properties                                         RAD_ALL.14993 
     &      , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR, SOURCE_GROUND               RAD_ALL.14994 
     &      , THERMAL_GROUND_BAND                                                  RAD_ALL.14995 
!                       Clear-sky Optical Properties                               RAD_ALL.14996 
     &      , K_GREY_TOT_FREE, K_EXT_SCAT_FREE                                     RAD_ALL.14997 
     &      , ASYMMETRY_FREE, FORWARD_SCATTER_FREE                                 RAD_ALL.14998 
!                       Cloudy Properties                                          RAD_ALL.14999 
     &      , L_CLOUD, I_CLOUD                                                     RAD_ALL.15000 
!                       Cloud Geometry                                             RAD_ALL.15001 
     &      , N_CLOUD_TOP                                                          RAD_ALL.15002 
     &      , N_CLOUD_TYPE, FRAC_CLOUD                                             RAD_ALL.15003 
     &      , I_REGION_CLOUD, FRAC_REGION                                          RAD_ALL.15004 
     &      , W_FREE, N_FREE_PROFILE, I_FREE_PROFILE                               RAD_ALL.15005 
     &      , W_CLOUD, N_CLOUD_PROFILE, I_CLOUD_PROFILE                            RAD_ALL.15006 
     &      , CLOUD_OVERLAP                                                        RAD_ALL.15007 
     &      , N_COLUMN, L_COLUMN, AREA_COLUMN                                      RAD_ALL.15008 
!                       Cloudy Optical Properties                                  RAD_ALL.15009 
     &      , K_GREY_TOT_CLOUD, K_EXT_SCAT_CLOUD                                   RAD_ALL.15010 
     &      , ASYMMETRY_CLOUD, FORWARD_SCATTER_CLOUD                               RAD_ALL.15011 
!                       Flxues Calculated                                          RAD_ALL.15012 
     &      , FLUX_DIRECT_PART, FLUX_TOTAL_PART                                    RAD_ALL.15013 
!                       Flags for Clear-sky Calculations                           RAD_ALL.15014 
     &      , L_CLEAR, I_SOLVER_CLEAR                                              RAD_ALL.15015 
!                       Clear-sky Fluxes Calculated                                RAD_ALL.15016 
     &      , FLUX_DIRECT_CLEAR_PART, FLUX_TOTAL_CLEAR_PART                        RAD_ALL.15017 
!                       Planckian Function                                         RAD_ALL.15018 
     &      , PLANCK_SOURCE_BAND                                                   RAD_ALL.15019 
!                       Dimensions of Arrays                                       RAD_ALL.15020 
     &      , NPD_PROFILE, NPD_LAYER, NPD_COLUMN                                   RAD_ALL.15021 
     &      )                                                                      RAD_ALL.15022 
         IF (IERR.NE.I_NORMAL) RETURN                                              RAD_ALL.15023 
!                                                                                  RAD_ALL.15024 
!        INCREMENT THE FLUXES WITHIN THE BAND.                                     RAD_ALL.15025 
         CALL AUGMENT_FLUX(N_PROFILE, N_LAYER, N_AUGMENT                           RAD_ALL.15026 
     &      , ISOLIR, L_CLEAR                                                      RAD_ALL.15027 
     &      , W_ESFT(IEX, I_BAND,  I_GAS)                                          RAD_ALL.15028 
     &      , FLUX_DIRECT_BAND, FLUX_TOTAL_BAND                                    RAD_ALL.15029 
     &      , FLUX_DIRECT_PART, FLUX_TOTAL_PART                                    RAD_ALL.15030 
     &      , FLUX_DIRECT_CLEAR_BAND, FLUX_TOTAL_CLEAR_BAND                        RAD_ALL.15031 
     &      , FLUX_DIRECT_CLEAR_PART, FLUX_TOTAL_CLEAR_PART                        RAD_ALL.15032 
     &      , NPD_PROFILE, NPD_LAYER                                               RAD_ALL.15033 
     &      )                                                                      RAD_ALL.15034 
      ENDDO                                                                        RAD_ALL.15035 
!                                                                                  RAD_ALL.15036 
!                                                                                  RAD_ALL.15037 
      RETURN                                                                       RAD_ALL.15038 
      END     
