1 subroutine da_oi_stats_bogus (stats_unit, iv)
3 !-----------------------------------------------------------------------
5 !-----------------------------------------------------------------------
9 integer, intent (in) :: stats_unit ! Output unit for stats.
10 type (iv_type), intent (in) :: iv ! OI
12 type (stats_bogus_type) :: stats
13 integer :: nu, nv, nt, nq, nslp
16 if (trace_use_dull) call da_trace_entry("da_oi_stats_bogus")
24 stats%maximum%u = maxmin_type(missing_r, 0, 0)
25 stats%maximum%v = maxmin_type(missing_r, 0, 0)
26 stats%maximum%t = maxmin_type(missing_r, 0, 0)
27 stats%maximum%q = maxmin_type(missing_r, 0, 0)
28 stats%maximum%slp = maxmin_type(missing_r, 0, 0)
29 stats%minimum%u = maxmin_type(-missing_r, 0, 0)
30 stats%minimum%v = maxmin_type(-missing_r, 0, 0)
31 stats%minimum%t = maxmin_type(-missing_r, 0, 0)
32 stats%minimum%q = maxmin_type(-missing_r, 0, 0)
33 stats%minimum%slp = maxmin_type(-missing_r, 0, 0)
35 stats%average = residual_bogus1_type(0.0, 0.0, 0.0, 0.0, 0.0)
36 stats%rms_err = stats%average
38 do n=1, iv%info(bogus)%nlocal
39 if (iv%info(bogus)%proc_domain(1,n)) then
40 do k=1, iv%info(bogus)%levels(n)
41 call da_stats_calculate(iv%info(bogus)%obs_global_index(n), &
42 k, iv%bogus(n)%u(k)%qc, &
43 iv%bogus(n)%u(k)%inv, nu, &
44 stats%minimum%u, stats%maximum%u, &
45 stats%average%u, stats%rms_err%u)
46 call da_stats_calculate(iv%info(bogus)%obs_global_index(n), &
47 k, iv%bogus(n)%v(k)%qc, &
48 iv%bogus(n)%v(k)%inv, nv, &
49 stats%minimum%v, stats%maximum%v, &
50 stats%average%v, stats%rms_err%v)
51 call da_stats_calculate(iv%info(bogus)%obs_global_index(n), &
52 k, iv%bogus(n)%t(k)%qc, &
53 iv%bogus(n)%t(k)%inv, nt, &
54 stats%minimum%t, stats%maximum%t, &
55 stats%average%t, stats%rms_err%t)
56 call da_stats_calculate(iv%info(bogus)%obs_global_index(n), &
57 k, iv%bogus(n)%q(k)%qc, &
58 iv%bogus(n)%q(k)%inv, nq, &
59 stats%minimum%q, stats%maximum%q, &
60 stats%average%q, stats%rms_err%q)
62 call da_stats_calculate( iv%info(bogus)%obs_global_index(n), &
63 0, iv%bogus(n)%slp%qc, &
64 iv%bogus(n)%slp%inv, nslp, &
65 stats%minimum%slp, stats%maximum%slp, &
66 stats%average%slp, stats%rms_err%slp)
70 ! Do inter-processor communication to gather statistics.
71 call da_proc_sum_int(nu)
72 call da_proc_sum_int(nv)
73 call da_proc_sum_int(nt)
74 call da_proc_sum_int(nq)
75 call da_proc_sum_int(nslp)
77 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
78 stats%minimum%u%value, stats%maximum%u%value, &
79 stats%minimum%u%n, stats%maximum%u%n, &
80 stats%minimum%u%l, stats%maximum%u%l)
81 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
82 stats%minimum%v%value, stats%maximum%v%value, &
83 stats%minimum%v%n, stats%maximum%v%n, &
84 stats%minimum%v%l, stats%maximum%v%l)
85 call da_proc_stats_combine(stats%average%t, stats%rms_err%t, &
86 stats%minimum%t%value, stats%maximum%t%value, &
87 stats%minimum%t%n, stats%maximum%t%n, &
88 stats%minimum%t%l, stats%maximum%t%l)
89 call da_proc_stats_combine(stats%average%q, stats%rms_err%q, &
90 stats%minimum%q%value, stats%maximum%q%value, &
91 stats%minimum%q%n, stats%maximum%q%n, &
92 stats%minimum%q%l, stats%maximum%q%l)
93 call da_proc_stats_combine(stats%average%slp, stats%rms_err%slp, &
94 stats%minimum%slp%value, stats%maximum%slp%value, &
95 stats%minimum%slp%n, stats%maximum%slp%n, &
96 stats%minimum%slp%l, stats%maximum%slp%l)
99 if (nu /= 0 .or. nv /= 0 .or. nt /= 0 .or. nq /= 0 .or. nslp /= 0) then
100 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of OI for bogus'
101 call da_print_stats_bogus(stats_unit, nu, nv, nt, nq, nslp, stats)
105 if (trace_use_dull) call da_trace_exit("da_oi_stats_bogus")
107 end subroutine da_oi_stats_bogus