da_oi_stats_profiler.inc

References to this file elsewhere.
1 subroutine da_oi_stats_profiler (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_profiler_type)       :: Profiler
13    integer                          :: nu, nv
14    integer                          :: n, k
15 
16    nu = 0
17    nv = 0
18    
19    Profiler%maximum%u = maxmin_type(missing_r, 0, 0)
20    Profiler%maximum%v = maxmin_type(missing_r, 0, 0)
21    Profiler%minimum%u = maxmin_type(-missing_r, 0, 0)
22    Profiler%minimum%v = maxmin_type(-missing_r, 0, 0)
23    Profiler%average = residual_profiler1_type(0.0, 0.0)
24    Profiler%rms_err = Profiler%average
25 
26    if (oi%num_Profiler > 0) then
27       do n=1, oi%num_Profiler
28          if (oi%profiler(n)%loc%proc_domain) then
29             do k=1, oi%Profiler(n)%info%levels
30                call da_stats_calculate(oi%profiler(n)%loc%obs_global_index, &
31                                k, oi%profiler(n)%u(k)%qc,  &
32                                oi%profiler(n)%u(k)%inv, nu, &
33                                profiler%minimum%u, Profiler%maximum%u, &
34                                profiler%average%u, Profiler%rms_err%u)
35                call da_stats_calculate(oi%profiler(n)%loc%obs_global_index, &
36                                k, oi%profiler(n)%v(k)%qc, &
37                                oi%profiler(n)%v(k)%inv, nv, &
38                                Profiler%minimum%v, Profiler%maximum%v, &
39                                Profiler%average%v, Profiler%rms_err%v)
40             end do
41          end if    ! end if (oi%profiler(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(Profiler%average%u, Profiler%rms_err%u, &
50                            Profiler%minimum%u%value, Profiler%maximum%u%value, &
51                            Profiler%minimum%u%n, Profiler%maximum%u%n, &
52                            Profiler%minimum%u%l, Profiler%maximum%u%l)
53    call da_proc_stats_combine(Profiler%average%v, Profiler%rms_err%v, &
54                            Profiler%minimum%v%value, Profiler%maximum%v%value, &
55                            Profiler%minimum%v%n, Profiler%maximum%v%n, &
56                            Profiler%minimum%v%l, Profiler%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 profiler'
61          call da_print_stats_profiler(stats_unit, nu, nv, Profiler)
62       end if
63    end if
64 
65 end subroutine da_oi_stats_profiler
66 
67