1 subroutine da_ao_stats_radar (stats_unit, iv, re)
3 !-----------------------------------------------------------------------
5 !-----------------------------------------------------------------------
9 integer, intent (in) :: stats_unit ! Output unit for stats.
10 type (iv_type), intent (inout) :: iv ! iv
11 type (y_type), intent (in) :: re ! A - O
13 type (stats_radar_type) :: stats
14 integer :: nrv, nrf, nrrn, nrsn, nrgr,nrqv
17 if (trace_use) call da_trace_entry("da_ao_stats_radar")
26 stats%maximum%rv = maxmin_type (missing_r, 0, 0)
27 stats%maximum%rf = maxmin_type (missing_r, 0, 0)
28 stats%minimum%rv = maxmin_type(-missing_r, 0, 0)
29 stats%minimum%rf = maxmin_type(-missing_r, 0, 0)
31 stats%maximum%rrn = maxmin_type (missing_r, 0, 0)
32 stats%maximum%rsn = maxmin_type (missing_r, 0, 0)
33 stats%maximum%rgr = maxmin_type (missing_r, 0, 0)
34 stats%maximum%rqv = maxmin_type (missing_r, 0, 0)
36 stats%minimum%rrn = maxmin_type(-missing_r, 0, 0)
37 stats%minimum%rsn = maxmin_type(-missing_r, 0, 0)
38 stats%minimum%rgr = maxmin_type(-missing_r, 0, 0)
39 stats%minimum%rqv = maxmin_type(-missing_r, 0, 0)
41 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 (n, k, iv%radar(n)%rv(k)%qc, &
49 re%radar(n)%rv(k), nrv, &
50 stats%minimum%rv, stats%maximum%rv, &
51 stats%average%rv, stats%rms_err%rv)
54 if (use_radar_rf) then
55 call da_stats_calculate (n, k, iv%radar(n)%rf(k)%qc, &
56 re%radar(n)%rf(k), nrf, &
57 stats%minimum%rf, stats%maximum%rf, &
58 stats%average%rf, stats%rms_err%rf)
61 if (.not. use_radar_rf .and. use_radar_rhv) then
62 call da_stats_calculate (n, k, iv%radar(n)%rrn(k)%qc, &
63 re%radar(n)%rrn(k), nrrn, &
64 stats%minimum%rrn, stats%maximum%rrn, &
65 stats%average%rrn, stats%rms_err%rrn)
66 call da_stats_calculate (n, k, iv%radar(n)%rsn(k)%qc, &
67 re%radar(n)%rsn(k), nrsn, &
68 stats%minimum%rsn, stats%maximum%rsn, &
69 stats%average%rsn, stats%rms_err%rsn)
70 call da_stats_calculate (n, k, iv%radar(n)%rgr(k)%qc, &
71 re%radar(n)%rgr(k), nrgr, &
72 stats%minimum%rgr, stats%maximum%rgr, &
73 stats%average%rgr, stats%rms_err%rgr)
76 if (use_radar_rqv) then
77 call da_stats_calculate (n, k, iv%radar(n)%rqv(k)%qc, &
78 re%radar(n)%rqv(k), nrqv, &
79 stats%minimum%rqv, stats%maximum%rqv, &
80 stats%average%rqv, stats%rms_err%rqv)
85 ! Do inter-processor communication to gather statistics.
86 if (use_radar_rv) then
87 call da_proc_sum_int (nrv)
88 call da_proc_stats_combine(stats%average%rv, stats%rms_err%rv, &
89 stats%minimum%rv%value, stats%maximum%rv%value, &
90 stats%minimum%rv%n, stats%maximum%rv%n, &
91 stats%minimum%rv%l, stats%maximum%rv%l)
94 if (use_radar_rf) then
95 call da_proc_sum_int (nrf)
96 call da_proc_stats_combine(stats%average%rf, stats%rms_err%rf, &
97 stats%minimum%rf%value, stats%maximum%rf%value, &
98 stats%minimum%rf%n, stats%maximum%rf%n, &
99 stats%minimum%rf%l, stats%maximum%rf%l)
102 if (.not.use_radar_rf .and. use_radar_rhv) then
103 call da_proc_sum_int (nrrn)
104 call da_proc_stats_combine(stats%average%rrn, stats%rms_err%rrn, &
105 stats%minimum%rrn%value, stats%maximum%rrn%value, &
106 stats%minimum%rrn%n, stats%maximum%rrn%n, &
107 stats%minimum%rrn%l, stats%maximum%rrn%l)
108 call da_proc_sum_int (nrsn)
109 call da_proc_stats_combine(stats%average%rsn, stats%rms_err%rsn, &
110 stats%minimum%rsn%value, stats%maximum%rsn%value, &
111 stats%minimum%rsn%n, stats%maximum%rsn%n, &
112 stats%minimum%rsn%l, stats%maximum%rsn%l)
113 call da_proc_sum_int (nrgr)
114 call da_proc_stats_combine(stats%average%rgr, stats%rms_err%rgr, &
115 stats%minimum%rgr%value, stats%maximum%rgr%value, &
116 stats%minimum%rgr%n, stats%maximum%rgr%n, &
117 stats%minimum%rgr%l, stats%maximum%rgr%l)
120 if (use_radar_rqv) then
121 call da_proc_sum_int (nrqv)
122 call da_proc_stats_combine(stats%average%rqv, stats%rms_err%rqv, &
123 stats%minimum%rqv%value, stats%maximum%rqv%value, &
124 stats%minimum%rqv%n, stats%maximum%rqv%n, &
125 stats%minimum%rqv%l, stats%maximum%rqv%l)
127 iv%nstats(radar) = nrv + nrf + nrrn + nrsn + nrgr + nrqv
130 if (nrv /= 0 .or. nrf /= 0 .or. nrrn /= 0 .or. nrsn /= 0 .or. nrgr /= 0 .or. nrqv /= 0) then
131 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for radar'
132 call da_print_stats_radar(stats_unit, nrv, nrf, nrrn, nrsn, nrgr, nrqv, stats)
136 if (trace_use) call da_trace_exit("da_ao_stats_radar")
138 end subroutine da_ao_stats_radar