!+ Subroutine to write averaged scattering properties.
!
! Method:
!	Straightforward.
!
! 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 WRITE_AVERAGE(N_BAND, I_BLOCK
     &   , I_TYPE, I_COMPONENT
     &   , I_OUTPUT_TYPE, HUMIDITY
     &   , NAME_TYPE, NAME_COMPONENT
     &   , NUMBER_TOTAL, RADIUS_EFF, VOLUME_FRACTION
     &   , RADIUS_EFF_DRY, VOLUME_FRACTION_DRY
     &   , ABSORPTION, SCATTERING, ASYMMETRY
     &   )
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/dimensions_spec.ucf'
      INCLUDE 'incl/def_sct_io.icf'
      INCLUDE 'incl/scatter_pp.pcf'
      INCLUDE 'incl/file_type.pcf'
!
!     DUMMY ARGUMENTS.
      CHARACTER	!, INTENT(IN)
     &     NAME_TYPE*20
!             NAME OF TYPE
     &   , NAME_COMPONENT*20
!             NAME OF COMPONENT
      INTEGER	!, INTENT(IN)
     &     N_BAND
!             NUMBER OF BANDS
     &   , I_BLOCK
!             INDEX OF BLOCK
     &   , I_TYPE
!             TYPE OF SCATTERER
     &   , I_COMPONENT
!             COMPONENT INDEX
     &   , I_OUTPUT_TYPE
!             OUTPUT TYPE
      REAL*8	!, INTENT(IN)
     &     HUMIDITY
!             HUMIDITY
     &   , NUMBER_TOTAL
!             TOTAL NUMBER OF PARTICLES
     &   , RADIUS_EFF
!             EFFECTIVE RADIUS
     &   , VOLUME_FRACTION
!             VOLUME FRACTION OF ABSORBER
     &   , RADIUS_EFF_DRY
!             EFFECTIVE RADIUS OF DRY PARTICLES
     &   , VOLUME_FRACTION_DRY
!             VOLUME FRACTION OF DRY ABSORBER
     &   , ABSORPTION(NPD_BAND)
!             ABSORPTION EXTINCTION
     &   , SCATTERING(NPD_BAND)
!             SCATTERING EXTINCTION
     &   , ASYMMETRY(NPD_BAND)
!             ASYMMETRY
!
!     LOCAL VARIABLES.
      INTEGER
     &     I
!             LOOP VARIABLE
!
!
      WRITE(IU_AVERAGE, '(A13, I5)') '*FILE TYPE = ', I_OUTPUT_TYPE
      WRITE(IU_AVERAGE, '(/,A)')
     &   'SCATTERING PROPERTIES AVERAGED ACROSS EACH BAND'
      WRITE(IU_AVERAGE, '(/, 3X, A8, I5)') 'BLOCK = ', I_BLOCK
      WRITE(IU_AVERAGE, '(3X, A20, I5, 3X, A20)')
     &   'TYPE OF SCATTERER = ', I_TYPE, NAME_TYPE
      IF (I_TYPE.EQ.IP_TYPE_AEROSOL) THEN
         WRITE(IU_AVERAGE, '(3X, A21, I5, 3X, A20)')
     &      'INDEX OF COMPONENT = ', I_COMPONENT, NAME_COMPONENT
      ENDIF
      IF ( I_OUTPUT_TYPE .EQ. IT_FILE_AVE_MIE_DRY ) THEN
         WRITE(IU_AVERAGE, '(/, 3X, A19, 1PE12.5, 1X, A4, /
     &      , 3X, A19, 1PE12.5, 1X, A2, /, 3X, A19, 1PE12.5)')
     &      'NUMBER DENSITY   = ', NUMBER_TOTAL, 'm-3:'
     &      , 'EFFECTIVE RADIUS = ', RADIUS_EFF, 'm:'
     &      , 'VOLUME FRACTION  = ', VOLUME_FRACTION
      ELSE IF ( I_OUTPUT_TYPE .EQ. IT_FILE_AVE_MIE_HUMID ) THEN
         WRITE(IU_AVERAGE, '(/, 3X,A11,F7.5)') 'HUMIDITY = ', HUMIDITY
         WRITE(IU_AVERAGE, '(/, 3X, A19, 1PE12.5, 1X, A4, /
     &      , 3X, A19, 1PE12.5, 1X, A2, /, 3X, A36, 1PE12.5, 1X, A2, /
     &      , 3X, A19, 1PE12.5, /,  3X, A36, 1PE12.5)')
     &      'NUMBER DENSITY   = ', NUMBER_TOTAL, 'm-3:'
     &      , 'EFFECTIVE RADIUS = ', RADIUS_EFF, 'm:'
     &      , 'EFFECTIVE RADIUS OF DRY PARTICLES = '
     &      , RADIUS_EFF_DRY, 'm:'
     &      , 'VOLUME FRACTION  = ', VOLUME_FRACTION
     &      , 'VOLUME FRACTION OF DRY PARTICLES  = '
     &      , VOLUME_FRACTION_DRY
      ENDIF
      WRITE(IU_AVERAGE, '(/, A4, 6X, A10, 10X, A10, 10X, A9)')
     &   'BAND', 'ABSORPTION', 'SCATTERING', 'ASYMMETRY'
      WRITE(IU_AVERAGE, '(10X, A10, 10X, A10)')
     &   '  (m-1)   ', '  (m-1)   '
      DO I=1, N_BAND
         WRITE(IU_AVERAGE, '(I5,3(4X, 1PE12.5, 4X))')
     &      I, ABSORPTION(I), SCATTERING(I), ASYMMETRY(I)
      ENDDO
      WRITE(IU_AVERAGE, '(//)')
!
!
      RETURN
      END
