da_oi_stats_profiler.inc
References to this file elsewhere.
1 subroutine da_oi_stats_profiler (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_profiler_type) :: stats
13 integer :: nu, nv
14 integer :: n, k
15
16 if (trace_use_dull) call da_trace_entry("da_oi_stats_profiler")
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
26 stats%average = residual_profiler1_type(0.0, 0.0)
27 stats%rms_err = stats%average
28
29 do n=1, iv%info(profiler)%nlocal
30 if (iv%info(profiler)%proc_domain(1,n)) then
31 do k=1, iv%info(profiler)%levels(n)
32 call da_stats_calculate(iv%info(profiler)%obs_global_index(n), &
33 k, iv%profiler(n)%u(k)%qc, &
34 iv%profiler(n)%u(k)%inv, nu, &
35 stats%minimum%u, stats%maximum%u, &
36 stats%average%u, stats%rms_err%u)
37 call da_stats_calculate(iv%info(profiler)%obs_global_index(n), &
38 k, iv%profiler(n)%v(k)%qc, &
39 iv%profiler(n)%v(k)%inv, nv, &
40 stats%minimum%v, stats%maximum%v, &
41 stats%average%v, stats%rms_err%v)
42 end do
43 end if
44 end do
45
46 ! Do inter-processor communication to gather statistics.
47 call da_proc_sum_int(nu)
48 call da_proc_sum_int(nv)
49
50 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
51 stats%minimum%u%value, stats%maximum%u%value, &
52 stats%minimum%u%n, stats%maximum%u%n, &
53 stats%minimum%u%l, stats%maximum%u%l)
54 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
55 stats%minimum%v%value, stats%maximum%v%value, &
56 stats%minimum%v%n, stats%maximum%v%n, &
57 stats%minimum%v%l, stats%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 OI for profiler'
62 call da_print_stats_profiler(stats_unit, nu, nv, stats)
63 end if
64 end if
65
66 if (trace_use_dull) call da_trace_exit("da_oi_stats_profiler")
67
68 end subroutine da_oi_stats_profiler
69
70