!+ Subroutine to solve for the monochromatic fluxes.
!
! Method:
!	The final single scattering properties are calculated
!	and rescaled. An appropriate subroutine is called to
!	calculate the fluxes depending on the treatment of 
!	cloudiness.
!
! Current Owner of Code: J. M. Edwards
!
! History:
!	Version		Date			Comment
!	1.0		12-04-95		First Version under RCS
!						(J. M. Edwards)
!
! Description of Code:
!   FORTRAN 77  with extensions listed in documentation.
!
!- ---------------------------------------------------------------------
      SUBROUTINE MONOCHROMATIC_FLUX(IERR
!			Atmospheric Propetries
     &   , N_PROFILE, N_LAYER, D_MASS
!			Angular Integration
     &   , I_ANGULAR_INTEGRATION, I_2STREAM, L_2_STREAM_CORRECT
     &   , L_RESCALE, N_ORDER_GAUSS
!			Treatment of Scattering
     &   , I_SCATTER_METHOD_BAND
!			Options for Solver
     &   , I_SOLVER, L_NET, I_EXTRAPOLATE_MIX_NET, N_AUGMENT
!			Gaseous Propeties
     &   , K_GAS_ABS
!			Options for Equivalent Extinction
     &   , L_SCALE_SOLAR, ADJUST_SOLAR_KE
!			Spectral Region
     &   , ISOLIR
!			Infra-red Properties
     &   , DIFF_PLANCK
     &   , L_IR_SOURCE_QUAD, DIFF_PLANCK_2
!			Conditions at TOA
     &   , SEC_0, FLUX_INC_DIRECT, FLUX_INC_DOWN
!			Surface Propeties
     &   , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR, SOURCE_GROUND
     &   , GROUND_EMISSION
!			Clear-sky Optical Propeties
     &   , K_GREY_TOT_FREE, K_EXT_SCAT_FREE, ASYMMETRY_FREE
     &   , FORWARD_SCATTER_FREE
!			Cloudy Properties
     &   , L_CLOUD, I_CLOUD
!			Cloud Geometry
     &   , N_CLOUD_TOP
     &   , N_CLOUD_TYPE, FRAC_CLOUD
     &   , I_REGION_CLOUD, FRAC_REGION
     &   , W_FREE, N_FREE_PROFILE, I_FREE_PROFILE
     &   , W_CLOUD, N_CLOUD_PROFILE, I_CLOUD_PROFILE
     &   , CLOUD_OVERLAP
     &   , N_COLUMN, L_COLUMN, AREA_COLUMN
!			Cloudy Optical Propeties
     &   , K_GREY_TOT_CLOUD, K_EXT_SCAT_CLOUD
     &   , ASYMMETRY_CLOUD, FORWARD_SCATTER_CLOUD
!			Fluxes Calculated
     &   , FLUX_DIRECT, FLUX_TOTAL
!			Flags for Clear-sky Calculation
     &   , L_CLEAR, I_SOLVER_CLEAR
!			Clear-sky Fluxes Calculated
     &   , FLUX_DIRECT_CLEAR, FLUX_TOTAL_CLEAR
!			Planckian Source
     &   , PLANCK_SOURCE
     &   )
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/dimensions_spec.ucf'
      INCLUDE 'incl/dimensions_field.ucf'
      INCLUDE 'incl/dimensions_fixed.pcf'
      INCLUDE 'incl/def_std_io.icf'
      INCLUDE 'incl/cloud_scheme.pcf'
      INCLUDE 'incl/angular_integration.pcf'
      INCLUDE 'incl/solver.pcf'
      INCLUDE 'incl/error.pcf'
!
!
!
!     DUMMY ARGUMENTS.
      INTEGER	!, INTENT(OUT)
     &     IERR
!             ERROR FLAG
!
!			Atmospheric Properties
      INTEGER	!, INTENT(IN)
     &     N_PROFILE
!             NUMBER OF PROFILES
     &   , N_LAYER
!             NUMBER OF LAYERS
      REAL*8	!, INTENT(IN)
     &     D_MASS(NPD_PROFILE, NPD_LAYER)
!             MASS THICKNESS OF EACH LAYER
!
!			Angular Integration
      INTEGER	!, INTENT(IN)
     &     I_ANGULAR_INTEGRATION
!             ANGULAR INTEGRATION SCHEME
     &   , I_2STREAM
!             TWO-STREAM SCHEME
     &   , N_ORDER_GAUSS
!             ORDER OF GAUSSIAN INTEGRATION
      LOGICAL 	!, INTENT(IN)
     &     L_2_STREAM_CORRECT
!             CORRECTION TO TWO-STREAM SCHEME
     &   , L_RESCALE
!             RESCALE OPTICAL PROPERTIES
!
!			Treatment of Scattering
      INTEGER	!, INTENT(IN)
     &     I_SCATTER_METHOD_BAND
!
!			Options for Solver
      INTEGER	!, INTENT(IN)
     &     I_SOLVER
!             SOLVER USED
     &   , I_EXTRAPOLATE_MIX_NET
!             METHOD FOR EXTRAPOLATING WITH A MIXED SOLVER
     &   , N_AUGMENT
!             LENGTH OF LONG FLUX VECTOR
      LOGICAL 	!, INTENT(IN)
     &     L_NET
!             CALCULATE NET FLUXES
!
!			Gaseous Properties
      REAL*8	!, INTENT(IN)
     &     K_GAS_ABS(NPD_PROFILE, NPD_LAYER)
!             GASEOUS ABSORPTIVE EXTINCTIONS
!
!			Variables for Equivalent Extinction
      LOGICAL 	!, INTENT(IN)
     &     L_SCALE_SOLAR
!             APPLY SCALING TO SOLAR FLUX
      REAL*8	!, INTENT(IN)
     &     ADJUST_SOLAR_KE(NPD_PROFILE, NPD_LAYER)
!             ADJUSTMENT OF SOLAR BEAM WITH EQUIVALENT EXTINCTION
!
!			Spectral Region
      INTEGER	!, INTENT(IN)
     &     ISOLIR
!             VISIBLE OR IR
!
!			Infra-red Properties
      LOGICAL 	!, INTENT(IN)
     &     L_IR_SOURCE_QUAD
!             FLAG FOR QUADRATIC IR-SOURCE
      REAL*8	!, INTENT(IN)
     &     PLANCK_SOURCE(NPD_PROFILE, 0: NPD_LAYER)
!             MONOCHROMATIC PLANCKIAN SOURCE
     &   , DIFF_PLANCK(NPD_PROFILE, NPD_LAYER)
!             THERMAL SOURCE FUNCTION
     &   , DIFF_PLANCK_2(NPD_PROFILE, NPD_LAYER)
!             2ND DIFF. OF THERMAL SOURCE FUNCTION
!
!			Conditions at TOA
      REAL*8	!, INTENT(IN)
     &     SEC_0(NPD_PROFILE)
!             SECANT OF SOLAR ZENITH ANGLE
     &   , FLUX_INC_DIRECT(NPD_PROFILE)
!             INCIDENT DIRECT FLUX
     &   , FLUX_INC_DOWN(NPD_PROFILE)
!             INCIDENT DOWNWARD FLUX
!
!			Surface Propeties
      REAL*8	!, INTENT(IN)
     &     ALBEDO_SURFACE_DIFF(NPD_PROFILE)
!             DIFFUSE SURFACE ALBEDO
     &   , ALBEDO_SURFACE_DIR(NPD_PROFILE)
!             DIRECT SURFACE ALBEDO
     &   , SOURCE_GROUND(NPD_PROFILE)
!             GROUND SOURCE FUNCTION
      REAL*8	!, INTENT(IN)
     &     GROUND_EMISSION(NPD_PROFILE)
!             TOTAL FLUX EMITTED FROM GROUND
!
!			Optical Properties
      REAL*8	!, INTENT(IN)
     &     K_GREY_TOT_FREE(NPD_PROFILE, NPD_LAYER)
!             FREE ABSORPTIVE EXTINCTION
     &   , K_EXT_SCAT_FREE(NPD_PROFILE, NPD_LAYER)
!             FREE SCATTERING EXTINCTION
     &   , ASYMMETRY_FREE(NPD_PROFILE, NPD_LAYER)
!             CLEAR-SKY ASYMMETRY
     &   , FORWARD_SCATTER_FREE(NPD_PROFILE, NPD_LAYER)
!             FREE FORWARD SCATTERING
!
!			Cloudy Properties
      LOGICAL 	!, INTENT(IN)
     &     L_CLOUD
!             CLOUDS REQUIRED
      INTEGER	!, INTENT(IN)
     &     I_CLOUD
!             CLOUD SCHEME USED
!
!			Cloud Geometry
      INTEGER	!, INTENT(IN)
     &     N_CLOUD_TOP
!             TOPMOST CLOUDY LAYER
     &   , N_CLOUD_TYPE
!             NUMBER OF TYPES OF CLOUDS
     &   , N_FREE_PROFILE(NPD_LAYER)
!             NUMBER OF FREE PROFILES
     &   , I_FREE_PROFILE(NPD_PROFILE, NPD_LAYER)
!             INDICES OF FREE PROFILES
     &   , N_CLOUD_PROFILE(NPD_LAYER)
!             NUMBER OF CLOUDY PROFILES
     &   , I_CLOUD_PROFILE(NPD_PROFILE, NPD_LAYER)
!             INDICES OF CLOUDY PROFILES
     &   , N_COLUMN(NPD_PROFILE)
!             NUMBER OF COLUMNS REQUIRED
     &   , I_REGION_CLOUD(NPD_CLOUD_TYPE)
!             REGIONS IN WHICH TYPES OF CLOUDS FALL
      LOGICAL 	!, INTENT(IN)
     &     L_COLUMN(NPD_PROFILE, NPD_LAYER, NPD_COLUMN)
!             FLAGS FOR CONTENTS OF COLUMNS
      REAL*8	!, INTENT(IN)
     &     W_CLOUD(NPD_PROFILE, NPD_LAYER)
!             CLOUDY FRACTION
     &   , FRAC_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)
!             FRACTIONS OF DIFFERENT TYPES OF CLOUD
     &   , W_FREE(NPD_PROFILE, NPD_LAYER)
!             CLEAR-SKY FRACTION
     &   , CLOUD_OVERLAP(NPD_PROFILE, 0: NPD_LAYER, NPD_OVERLAP_COEFF)
!             COEFFICIENTS FOR ENERGY TRANSFER AT INTERFACES
     &   , AREA_COLUMN(NPD_PROFILE, NPD_COLUMN)
!             AREAS OF COLUMNS
     &   , FRAC_REGION(NPD_PROFILE, NPD_LAYER, NPD_REGION)
!             FRACTIONS OF TOTAL CLOUD OCCUPIED BY EACH REGION
!
!			Cloudy Optical Properties
      REAL*8	!, INTENT(IN)
     &     K_GREY_TOT_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)
!             CLOUDY ABSORPTIVE EXTINCTION
     &   , K_EXT_SCAT_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)
!             CLOUDY SCATTERING EXTINCTION
     &   , ASYMMETRY_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)
!             CLOUDY ASYMMETRY
     &   , FORWARD_SCATTER_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)
!             CLOUDY FORWARD SCATTERING
!
!			Fluxes Calculated
      REAL*8	!, INTENT(OUT)
     &     FLUX_DIRECT(NPD_PROFILE, 0: NPD_LAYER)
!             DIRECT FLUX
     &   , FLUX_TOTAL(NPD_PROFILE, 2*NPD_LAYER+2)
!             TOTAL FLUX
!
!			Flags for Clear-sky Calculations
      LOGICAL 	!, INTENT(IN)
     &     L_CLEAR
!             CALCULATE CLEAR-SKY PROPERTIES
      INTEGER	!, INTENT(IN)
     &     I_SOLVER_CLEAR
!             CLEAR SOLVER USED
!
!			Clear-sky Fluxes Calculated
      REAL*8	!, INTENT(OUT)
     &     FLUX_DIRECT_CLEAR(NPD_PROFILE, 0: NPD_LAYER)
!             CLEAR-SKY DIRECT FLUX
     &   , FLUX_TOTAL_CLEAR(NPD_PROFILE, 2*NPD_LAYER+2)
!             CLEAR-SKY TOTAL FLUX
!
!
!
!     LOCAL VARIABLES.
      INTEGER
     &     K
!             LOOP VARIABLE
      REAL*8
     &     TAU_FREE(NPD_PROFILE, NPD_LAYER)
!             FREE OPTICAL DEPTH
     &   , OMEGA_FREE(NPD_PROFILE, NPD_LAYER)
!             FREE ALBEDO OF S. S.
     &   , TAU_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)
!             CLOUDY OPTICAL DEPTH
     &   , OMEGA_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_CLOUD_TYPE)
!             CLOUDY SINGLE SCATTERING ALBEDO 
!
!     SUBROUTINES CALLED:
      EXTERNAL
     &     SINGLE_SCATTERING_ALL, RESCALE_TAU_OMEGA
     &   , TWO_STREAM
     &   , MIX_COLUMN, CLOUD_COLUMN
     &   , GAUSS_ANGLE
!
!
!
!     CALCULATE SINGLE SCATTERING PROPERTIES FOR ALL ATMOSPHERIC 
!     CONSTITUENTS.
!
      CALL SINGLE_SCATTERING_ALL(I_SCATTER_METHOD_BAND
!			Atmospheric Properties
     &   , N_PROFILE, N_LAYER, D_MASS
!			Cloudy Properties
     &   , L_CLOUD, N_CLOUD_TOP, N_CLOUD_TYPE
!			Optical Properties
     &   , K_GREY_TOT_FREE, K_EXT_SCAT_FREE
     &   , K_GREY_TOT_CLOUD, K_EXT_SCAT_CLOUD
     &   , K_GAS_ABS
!			Single Scattering Properties
     &   , TAU_FREE, OMEGA_FREE
     &   , TAU_CLOUD, OMEGA_CLOUD
     &   )
!
!
!
      IF (I_ANGULAR_INTEGRATION.EQ.IP_TWO_STREAM) THEN
!
!        RESCALE TAU AND OMEGA. THE ASYMMETRY HAS ALREADY BEEN RESCALED.
!
         IF (L_RESCALE) THEN
!
            CALL RESCALE_TAU_OMEGA(N_PROFILE, 1, N_LAYER
     &         , TAU_FREE, OMEGA_FREE, FORWARD_SCATTER_FREE
     &         )
!
            IF (L_CLOUD) THEN
!
               DO K=1, N_CLOUD_TYPE
                  CALL RESCALE_TAU_OMEGA(N_PROFILE, N_CLOUD_TOP
     &               , N_LAYER
     &               , TAU_CLOUD(1, 1, K), OMEGA_CLOUD(1, 1, K)
     &               , FORWARD_SCATTER_CLOUD(1, 1, K)
     &               )
               ENDDO
!
            ENDIF
!
         ENDIF
!
!
!        SOLVE THE EQUATIONS USING THE SCHEME INDICATED BY THE VALUES
!        OF I_CLOUD AND I_SOLVER.
         IF (I_CLOUD.EQ.IP_CLOUD_CLEAR) THEN
!
!           A TWO-STREAM SCHEME WITH NO CLOUDS.
            CALL TWO_STREAM(IERR
!			Atmospheric Properties
     &         , N_PROFILE, N_LAYER
!			Two-stream Scheme 
     &         , I_2STREAM
!			Corrections to Two-stream Equations
     &         , L_2_STREAM_CORRECT, PLANCK_SOURCE, GROUND_EMISSION
!			Options for Solver
     &         , L_NET, I_SOLVER
!			Options for Equivalent Extinction
     &         , L_SCALE_SOLAR, ADJUST_SOLAR_KE
!			Spectral Region
     &         , ISOLIR
!			Infra-red Properties
     &         , DIFF_PLANCK
     &         , L_IR_SOURCE_QUAD, DIFF_PLANCK_2
!			Conditions at TOA
     &         , FLUX_INC_DOWN, FLUX_INC_DIRECT, SEC_0
!			Surface Conditions
     &         , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR, SOURCE_GROUND
!			Single Scattering Propeties
     &         , TAU_FREE, OMEGA_FREE, ASYMMETRY_FREE
!			Fluxes Calculated
     &         , FLUX_DIRECT, FLUX_TOTAL
!			Flag for Clear-sky Fluxes
     &         , L_CLEAR
!			Clear-sky Fluxes Calculated
     &         , FLUX_DIRECT_CLEAR, FLUX_TOTAL_CLEAR
     &         )
               IF (IERR.NE.I_NORMAL) RETURN
!
         ELSEIF (I_CLOUD.EQ.IP_CLOUD_SCHMETZ) THEN
!
!           CLOUDS ARE TREATED USING SCHMETZ'S SCHEME.
!           THIS HAS NOW BEEN WITHDRAWN.
!
            WRITE(IU_ERR, '(/A)') 
     &         '*** ERROR: SCHMETZ''S SCHEME HAS BEEN WITHDRAWN.'
            IERR=I_ERR_FATAL
            RETURN
!
         ELSEIF ( (I_CLOUD.EQ.IP_CLOUD_MIX_MAX)
     &          .OR. (I_CLOUD.EQ.IP_CLOUD_MIX_RANDOM) ) THEN
!
!           CLOUDS ARE TREATED USING ZDUNKOWSKI'S MIXED-COLUMN SCHEME.
!           THE GEOMETRY HAS BEEN SET BEFORE.
!
            CALL MIX_COLUMN(IERR
!			Atmospheric Properties
     &         , N_PROFILE, N_LAYER
!			Two-stream Scheme
     &         , I_2STREAM
!			Corrections to Two-stream Equations
     &         , L_2_STREAM_CORRECT, PLANCK_SOURCE, GROUND_EMISSION
!			Options for Solver
     &         , I_SOLVER, I_EXTRAPOLATE_MIX_NET, L_NET
!			Options for Equivalent Extinction
     &         , L_SCALE_SOLAR, ADJUST_SOLAR_KE
!			Spectral Region
     &         , ISOLIR
!			Infra-red Properties
     &         , DIFF_PLANCK
     &         , L_IR_SOURCE_QUAD, DIFF_PLANCK_2
!			Conditions at TOA
     &         , FLUX_INC_DOWN, FLUX_INC_DIRECT, SEC_0
!			Conditions at Surface
     &         , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR, SOURCE_GROUND
!			Clear-sky Single Scattering Properties
     &         , TAU_FREE, OMEGA_FREE, ASYMMETRY_FREE
!			Cloud Geometry
     &         , N_CLOUD_TOP
     &         , N_CLOUD_TYPE, FRAC_CLOUD
     &         , W_FREE, N_FREE_PROFILE, I_FREE_PROFILE
     &         , W_CLOUD, N_CLOUD_PROFILE, I_CLOUD_PROFILE
     &         , CLOUD_OVERLAP
!			Cloudy Optical Properties
     &         , TAU_CLOUD, OMEGA_CLOUD, ASYMMETRY_CLOUD
!			Fluxes Calculated
     &         , FLUX_DIRECT, FLUX_TOTAL
!			Flags for Clear-sky Calculations
     &         , L_CLEAR, I_SOLVER_CLEAR
!			Clear-sky Fluxes Calculated
     &         , FLUX_DIRECT_CLEAR, FLUX_TOTAL_CLEAR
     &         )
            IF (IERR.NE.I_NORMAL) RETURN
         ELSEIF (I_CLOUD.EQ.IP_CLOUD_TRIPLE) THEN
!
!           CLOUDS ARE TREATED USING A DECOMPOSITION OF THE COLUMN
!           INTO CLEAR-SKY, STRATIFORM AND CONVECTIVE REGIONS, ALL
!           MAXIMALLY OVERLAPPED.
!
            CALL TRIPLE_COLUMN(IERR
!			Atmospheric Properties
     &         , N_PROFILE, N_LAYER
!			Two-stream Scheme
     &         , I_2STREAM
!			Corrections to Two-stream Equations
     &         , L_2_STREAM_CORRECT, PLANCK_SOURCE, GROUND_EMISSION
!			Options for Solver
     &         , I_SOLVER, I_EXTRAPOLATE_MIX_NET, L_NET
!			Options for Equivalent Extinction
     &         , L_SCALE_SOLAR, ADJUST_SOLAR_KE
!			Spectral Region
     &         , ISOLIR
!			Infra-red Properties
     &         , DIFF_PLANCK
     &         , L_IR_SOURCE_QUAD, DIFF_PLANCK_2
!			Conditions at TOA
     &         , FLUX_INC_DOWN, FLUX_INC_DIRECT, SEC_0
!			Conditions at Surface
     &         , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR, SOURCE_GROUND
!			Clear-sky Single Scattering Properties
     &         , TAU_FREE, OMEGA_FREE, ASYMMETRY_FREE
!			Cloud Geometry
     &         , N_CLOUD_TOP
     &         , N_CLOUD_TYPE, FRAC_CLOUD
     &         , I_REGION_CLOUD, FRAC_REGION
     &         , W_FREE, N_FREE_PROFILE, I_FREE_PROFILE
     &         , W_CLOUD, N_CLOUD_PROFILE, I_CLOUD_PROFILE
     &         , CLOUD_OVERLAP
!			Cloudy Optical Properties
     &         , TAU_CLOUD, OMEGA_CLOUD, ASYMMETRY_CLOUD
!			Fluxes Calculated
     &         , FLUX_DIRECT, FLUX_TOTAL
!			Flags for Clear-sky Calculations
     &         , L_CLEAR, I_SOLVER_CLEAR
!			Clear-sky Fluxes Calculated
     &         , FLUX_DIRECT_CLEAR, FLUX_TOTAL_CLEAR
     &         )
            IF (IERR.NE.I_NORMAL) RETURN
!
         ELSEIF (I_CLOUD.EQ.IP_CLOUD_COLUMN_MAX) THEN
!           CLOUDS ARE TREATED ON THE ASSUMPTION OF MAXIMUM OVERLAP
!           IN A COLUMN MODEL.
            CALL CLOUD_COLUMN(IERR
!			Atmospheric Properties
     &         , N_PROFILE, N_LAYER
!			Two-stream Scheme
     &         , I_2STREAM
!			Corrections to Two-stream Equations
     &         , L_2_STREAM_CORRECT, PLANCK_SOURCE, GROUND_EMISSION
!			Options for Solver
     &         , I_SOLVER, N_AUGMENT
!			Options for Equivalent Extinction
     &         , L_SCALE_SOLAR, ADJUST_SOLAR_KE
!			Spectral Region
     &         , ISOLIR
!			Infra-red Properties
     &         , DIFF_PLANCK
     &         , L_IR_SOURCE_QUAD, DIFF_PLANCK_2
!			Conditions at TOA
     &         , FLUX_INC_DOWN, FLUX_INC_DIRECT, SEC_0
!			Conditions at Surface
     &         , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR, SOURCE_GROUND
!			Clear-sky Single Scattering Properties
     &         , TAU_FREE, OMEGA_FREE, ASYMMETRY_FREE
!			Cloud Geometry
     &         , N_CLOUD_TOP
     &         , N_CLOUD_TYPE, FRAC_CLOUD
     &         , N_COLUMN, L_COLUMN, AREA_COLUMN
!			Cloudy Optical Properties
     &         , TAU_CLOUD, OMEGA_CLOUD, ASYMMETRY_CLOUD
!			Fluxes Calculated
     &         , FLUX_DIRECT, FLUX_TOTAL
!			Flags for Clear-sky Calculations
     &         , L_CLEAR, I_SOLVER_CLEAR
!			Clear-sky Fluxes Calculated
     &         , FLUX_DIRECT_CLEAR, FLUX_TOTAL_CLEAR
     &         )
            IF (IERR.NE.I_NORMAL) RETURN
!
         ENDIF
!
      ELSE IF (I_ANGULAR_INTEGRATION.EQ.IP_IR_GAUSS) THEN
!
!        FULL ANGULAR RESOLUTION USING GASUSSIAN INTEGRATION.
         CALL GAUSS_ANGLE(N_PROFILE, N_LAYER, L_NET, N_AUGMENT
     &      , N_ORDER_GAUSS
     &      , TAU_FREE
     &      , FLUX_INC_DOWN
     &      , DIFF_PLANCK, SOURCE_GROUND, ALBEDO_SURFACE_DIFF
     &      , FLUX_TOTAL
     &      , L_IR_SOURCE_QUAD, DIFF_PLANCK_2
     &      )
         IF (IERR.NE.I_NORMAL) RETURN
!
      ENDIF
!
!
      RETURN
      END
