da_oi_stats_pilot.inc

References to this file elsewhere.
1 subroutine da_oi_stats_pilot (stats_unit, oi)
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 
12    type (stats_pilot_type)          :: Pilot
13    integer                          :: nu, nv
14    integer                          :: n, k
15 
16    nu = 0
17    nv = 0
18 
19    Pilot%maximum%u = maxmin_type(missing_r, 0, 0)
20    Pilot%maximum%v = maxmin_type(missing_r, 0, 0)
21    Pilot%minimum%u = maxmin_type(-missing_r, 0, 0)
22    Pilot%minimum%v = maxmin_type(-missing_r, 0, 0)
23    Pilot%average = residual_pilot1_type(0.0, 0.0)
24    Pilot%rms_err = Pilot%average
25 
26    if (oi%num_Pilot > 0) then
27       do n=1, oi%num_Pilot
28          if (oi%pilot(n)%loc%proc_domain) then
29             do k=1, oi%Pilot(n)%info%levels
30                call da_stats_calculate(oi%Pilot(n)%loc%obs_global_index, &
31                                k, oi%pilot(n)%u(k)%qc,  &
32                                oi%pilot(n)%u(k)%inv, nu, &
33                                pilot%minimum%u, Pilot%maximum%u, &
34                                pilot%average%u, Pilot%rms_err%u)
35                call da_stats_calculate(oi%Pilot(n)%loc%obs_global_index, &
36                                k, oi%Pilot(n)%v(k)%qc, &
37                                oi%Pilot(n)%v(k)%inv, 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 
49    call da_proc_stats_combine(Pilot%average%u, Pilot%rms_err%u, &
50                            Pilot%minimum%u%value, Pilot%maximum%u%value, &
51                            Pilot%minimum%u%n, Pilot%maximum%u%n, &
52                            Pilot%minimum%u%l, Pilot%maximum%u%l)
53    call da_proc_stats_combine(Pilot%average%v, Pilot%rms_err%v, &
54                            Pilot%minimum%v%value, Pilot%maximum%v%value, &
55                            Pilot%minimum%v%n, Pilot%maximum%v%n, &
56                            Pilot%minimum%v%l, Pilot%maximum%v%l)
57 
58    if (rootproc) then
59       if (nu /= 0 .or. nv /= 0) then
60          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of OI for pilot'
61          call da_print_stats_pilot(stats_unit, nu, nv, Pilot)
62       end if
63    end if
64 
65  end subroutine da_oi_stats_pilot
66 
67