1 subroutine da_oi_stats_radar (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_radar_type) :: stats
13 integer :: nrv, nrf, nrrn,nrsn,nrgr,nrqv
16 if (trace_use) call da_trace_entry("da_oi_stats_radar")
25 stats%maximum%rv = maxmin_type(missing_r, 0, 0)
26 stats%minimum%rv = maxmin_type(-missing_r, 0, 0)
27 stats%maximum%rf = maxmin_type(missing_r, 0, 0)
28 stats%minimum%rf = maxmin_type(-missing_r, 0, 0)
30 stats%maximum%rrn = maxmin_type (missing_r, 0, 0)
31 stats%maximum%rsn = maxmin_type (missing_r, 0, 0)
32 stats%maximum%rgr = maxmin_type (missing_r, 0, 0)
33 stats%maximum%rqv = maxmin_type (missing_r, 0, 0)
35 stats%minimum%rrn = maxmin_type(-missing_r, 0, 0)
36 stats%minimum%rsn = maxmin_type(-missing_r, 0, 0)
37 stats%minimum%rgr = maxmin_type(-missing_r, 0, 0)
38 stats%minimum%rqv = maxmin_type(-missing_r, 0, 0)
40 stats%average = residual_radar1_type(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
42 stats%rms_err = stats%average
44 do n=1, iv%info(radar)%nlocal
45 if (iv%info(radar)%proc_domain(1,n)) then
46 do k=1, iv%info(radar)%levels(n)
47 if (use_radar_rv) then
48 call da_stats_calculate(iv%info(radar)%obs_global_index(n), &
49 k, iv%radar(n)%rv(k)%qc, &
50 iv%radar(n)%rv(k)%inv, nrv, &
51 stats%minimum%rv, stats%maximum%rv, &
52 stats%average%rv, stats%rms_err%rv)
55 if (use_radar_rf) then
56 call da_stats_calculate(iv%info(radar)%obs_global_index(n), &
57 k, iv%radar(n)%rf(k)%qc, &
58 iv%radar(n)%rf(k)%inv, nrf, &
59 stats%minimum%rf, stats%maximum%rf, &
60 stats%average%rf, stats%rms_err%rf)
63 if (.not. use_radar_rf .and. use_radar_rhv) then
64 call da_stats_calculate(iv%info(radar)%obs_global_index(n), &
65 k, iv%radar(n)%rrn(k)%qc, &
66 iv%radar(n)%rrn(k)%inv, nrrn, &
67 stats%minimum%rrn, stats%maximum%rrn, &
68 stats%average%rrn, stats%rms_err%rrn)
69 call da_stats_calculate(iv%info(radar)%obs_global_index(n), &
70 k, iv%radar(n)%rsn(k)%qc, &
71 iv%radar(n)%rsn(k)%inv, nrsn, &
72 stats%minimum%rsn, stats%maximum%rsn, &
73 stats%average%rsn, stats%rms_err%rsn)
74 call da_stats_calculate(iv%info(radar)%obs_global_index(n), &
75 k, iv%radar(n)%rgr(k)%qc, &
76 iv%radar(n)%rgr(k)%inv, nrgr, &
77 stats%minimum%rgr, stats%maximum%rgr, &
78 stats%average%rgr, stats%rms_err%rgr)
81 if (use_radar_rqv) then
82 call da_stats_calculate(iv%info(radar)%obs_global_index(n), &
83 k, iv%radar(n)%rqv(k)%qc, &
84 iv%radar(n)%rqv(k)%inv, nrqv, &
85 stats%minimum%rqv, stats%maximum%rqv, &
86 stats%average%rqv, stats%rms_err%rqv)
93 ! Do inter-processor communication to gather statistics.
95 if (use_radar_rv) then
96 call da_proc_sum_int(nrv)
97 call da_proc_stats_combine(stats%average%rv, stats%rms_err%rv, &
98 stats%minimum%rv%value, stats%maximum%rv%value, &
99 stats%minimum%rv%n, stats%maximum%rv%n, &
100 stats%minimum%rv%l, stats%maximum%rv%l)
103 if (use_radar_rf) then
104 call da_proc_sum_int(nrf)
105 call da_proc_stats_combine(stats%average%rf, stats%rms_err%rf, &
106 stats%minimum%rf%value, stats%maximum%rf%value, &
107 stats%minimum%rf%n, stats%maximum%rf%n, &
108 stats%minimum%rf%l, stats%maximum%rf%l)
111 if (.not.use_radar_rf .and. use_radar_rhv) then
112 call da_proc_sum_int(nrrn)
113 call da_proc_stats_combine(stats%average%rrn, stats%rms_err%rrn, &
114 stats%minimum%rrn%value, stats%maximum%rrn%value, &
115 stats%minimum%rrn%n, stats%maximum%rrn%n, &
116 stats%minimum%rrn%l, stats%maximum%rrn%l)
117 call da_proc_sum_int(nrsn)
118 call da_proc_stats_combine(stats%average%rsn, stats%rms_err%rsn, &
119 stats%minimum%rsn%value, stats%maximum%rsn%value, &
120 stats%minimum%rsn%n, stats%maximum%rsn%n, &
121 stats%minimum%rsn%l, stats%maximum%rsn%l)
122 call da_proc_sum_int(nrgr)
123 call da_proc_stats_combine(stats%average%rgr, stats%rms_err%rgr, &
124 stats%minimum%rgr%value, stats%maximum%rgr%value, &
125 stats%minimum%rgr%n, stats%maximum%rgr%n, &
126 stats%minimum%rgr%l, stats%maximum%rgr%l)
129 if (use_radar_rqv) then
130 call da_proc_sum_int(nrqv)
131 call da_proc_stats_combine(stats%average%rqv, stats%rms_err%rqv, &
132 stats%minimum%rqv%value, stats%maximum%rqv%value, &
133 stats%minimum%rqv%n, stats%maximum%rqv%n, &
134 stats%minimum%rqv%l, stats%maximum%rqv%l)
138 if (nrv /= 0 .or. nrf /= 0 .or. nrrn /= 0 .or. nrsn /= 0 .or. nrgr /= 0 .or. nrqv /= 0 ) then
139 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of OI for radar'
140 call da_print_stats_radar(stats_unit, nrv, nrf, nrrn, nrsn, nrgr, nrqv,stats)
144 if (trace_use) call da_trace_exit("da_oi_stats_radar")
146 end subroutine da_oi_stats_radar