da_ao_stats_pilot.inc

References to this file elsewhere.
1 subroutine da_ao_stats_pilot (stats_unit, oi, re)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    integer,        intent (in)      :: stats_unit    ! Output unit for stats.
10    type (ob_type), intent (in)      :: oi            ! OI
11    type  (y_type), intent (in)      :: re            ! A - O
12 
13    type (stats_pilot_type)          :: Pilot
14    integer                          :: nu, nv
15    integer                          :: n, k
16 
17    nu = 0
18    nv = 0
19    num_pilot_tot = 0
20 
21    Pilot%maximum%u = maxmin_type (missing_r, 0, 0)
22    Pilot%maximum%v = maxmin_type (missing_r, 0, 0)
23    Pilot%minimum%u = maxmin_type(-missing_r, 0, 0)
24    Pilot%minimum%v = maxmin_type(-missing_r, 0, 0)
25    Pilot%average = residual_pilot1_type(0.0, 0.0)
26    Pilot%rms_err = Pilot%average
27 
28    if (oi%num_Pilot > 0) then
29       do n=1, oi%num_Pilot
30          if (oi%pilot(n)%loc%proc_domain) then
31             do k=1, oi%Pilot(n)%info%levels
32                call da_stats_calculate (n, k, oi%Pilot(n)%u(k)%qc, & 
33                                re%pilot(n)%u(k), nu, & 
34                                pilot%minimum%u, Pilot%maximum%u, &
35                                pilot%average%u, Pilot%rms_err%u)
36                call da_stats_calculate (n, k, oi%Pilot(n)%v(k)%qc, & 
37                                re%Pilot(n)%v(k), nv, & 
38                                Pilot%minimum%v, Pilot%maximum%v, &
39                                Pilot%average%v, Pilot%rms_err%v)
40             end do
41          end if    ! end if (oi%pilot(n)%loc%proc_domain)
42       end do
43    end if
44 
45    ! Do inter-processor communication to gather statistics.
46    call da_proc_sum_int (nu)
47    call da_proc_sum_int (nv)
48    num_pilot_tot = nu + nv
49 
50    call da_proc_stats_combine(Pilot%average%u, Pilot%rms_err%u, &
51                            Pilot%minimum%u%value, Pilot%maximum%u%value, &
52                            Pilot%minimum%u%n, Pilot%maximum%u%n, &
53                            Pilot%minimum%u%l, Pilot%maximum%u%l)
54    call da_proc_stats_combine(Pilot%average%v, Pilot%rms_err%v, &
55                            Pilot%minimum%v%value, Pilot%maximum%v%value, &
56                            Pilot%minimum%v%n, Pilot%maximum%v%n, &
57                            Pilot%minimum%v%l, Pilot%maximum%v%l)
58 
59    if (rootproc) then
60       if (nu /= 0 .or. nv /= 0) then
61          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for pilot'
62          call da_print_stats_pilot(stats_unit, nu, nv, Pilot)
63       end if
64    end if
65 
66 end subroutine da_ao_stats_pilot
67 
68