<HTML> <BODY BGCOLOR=#ccccdd LINK=#0000aa VLINK=#0000ff ALINK=#ff0000 ><BASE TARGET="bottom_target"><PRE>
<A NAME='DA_AO_STATS_SSMT1'><A href='../../html_code/ssmi/da_ao_stats_ssmt1.inc.html#DA_AO_STATS_SSMT1' TARGET='top_target'><IMG SRC="../../gif/bar_red.gif" border=0></A>

subroutine da_ao_stats_ssmt1 (stats_unit, iv, re) 1,6

   !-----------------------------------------------------------------------
   ! Purpose: TBD
   !-----------------------------------------------------------------------

   implicit none

   integer,        intent (in)    :: stats_unit    ! Output unit for stats.
   type (iv_type), intent (inout) :: iv            ! OI
   type  (y_type), intent (in)    :: re            ! O-A

   type (maxmin_type) :: minimum
   type (maxmin_type) :: maximum
   integer            :: nt
   integer            :: n, k
   real               :: average, rms_err

   if (trace_use_dull) call da_trace_entry("da_ao_stats_ssmt1")

   nt = 0

   maximum = maxmin_type(-1.0E+20, 0, 0)
   minimum = maxmin_type (1.0E+20, 0, 0)
   average = 0.0
   rms_err = 0.0

   if (iv%info(ssmt1)%nlocal &gt; 0) then
      do n=1, iv%info(ssmt1)%nlocal
         if (iv%info(ssmt1)%proc_domain(1,n)) then
            do k=1, iv%info(ssmt1)%levels(n)
               call da_stats_calculate (n, k, iv%ssmt1(n)%t(k)%qc, re%ssmt1(n)%t(k), nt, &amp;
                  minimum, maximum, average, rms_err)
            end do
         end if    ! end if (iv%info(ssmt1)%proc_domain(1,n))
      end do
   end if

   ! Do inter-processor communication to gather statistics.
   call da_proc_sum_int (nt)
   iv%nstats(ssmt1) = nt

   call da_proc_stats_combine(average, rms_err, minimum%value, maximum%value, &amp;
      minimum%n, maximum%n, minimum%l, maximum%l)
   
   if (rootproc) then
      if (nt /= 0) then
          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of O-A for SSMT1'
          call da_print_stats_ssmt1 (stats_unit, nt, minimum, maximum, average, rms_err)
      end if
   end if

   if (trace_use_dull) call da_trace_exit("da_ao_stats_ssmt1")

end subroutine da_ao_stats_ssmt1