da_oi_stats_pilot.inc

References to this file elsewhere.
1 subroutine da_oi_stats_pilot (stats_unit, iv)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    integer,        intent (in) :: stats_unit    ! Output unit for stats.
10    type (iv_type), intent (in) :: iv            ! OI
11 
12    type (stats_pilot_type) :: stats
13    integer                 :: nu, nv
14    integer                 :: n, k
15 
16    if (trace_use_dull) call da_trace_entry("da_oi_stats_pilot")
17 
18    nu = 0
19    nv = 0
20 
21    stats%maximum%u = maxmin_type(missing_r, 0, 0)
22    stats%maximum%v = maxmin_type(missing_r, 0, 0)
23    stats%minimum%u = maxmin_type(-missing_r, 0, 0)
24    stats%minimum%v = maxmin_type(-missing_r, 0, 0)
25    stats%average = residual_pilot1_type(0.0, 0.0)
26    stats%rms_err = stats%average
27 
28    do n=1, iv%info(pilot)%nlocal
29       if (iv%info(pilot)%proc_domain(1,n)) then
30          do k=1, iv%info(pilot)%levels(n)
31             call da_stats_calculate(iv%info(pilot)%obs_global_index(n), &
32                k, iv%pilot(n)%u(k)%qc,  &
33                iv%pilot(n)%u(k)%inv, nu, &
34                stats%minimum%u, stats%maximum%u, &
35                stats%average%u, stats%rms_err%u)
36             call da_stats_calculate(iv%info(pilot)%obs_global_index(n), &
37                k, iv%pilot(n)%v(k)%qc, &
38                iv%pilot(n)%v(k)%inv, nv, &
39                stats%minimum%v, stats%maximum%v, &
40                stats%average%v, stats%rms_err%v)
41          end do
42       end if
43    end do
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(stats%average%u, stats%rms_err%u, &
50       stats%minimum%u%value, stats%maximum%u%value, &
51       stats%minimum%u%n, stats%maximum%u%n, &
52       stats%minimum%u%l, stats%maximum%u%l)
53    call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
54       stats%minimum%v%value, stats%maximum%v%value, &
55       stats%minimum%v%n, stats%maximum%v%n, &
56       stats%minimum%v%l, stats%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, stats)
62       end if
63    end if
64 
65    if (trace_use_dull) call da_trace_exit("da_oi_stats_pilot")
66 
67  end subroutine da_oi_stats_pilot
68 
69