1 subroutine da_ao_stats_airep (stats_unit, iv, re, ob)
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
12 type(y_type), intent (in) :: ob ! Observation structure.
14 type (stats_airep_type) :: stats
15 integer :: nu, nv, nt, nq
17 real :: u_inc, v_inc, u_obs, v_obs
19 if (trace_use_dull) call da_trace_entry("da_ao_stats_airep")
26 stats%maximum%u = maxmin_type (missing_r, 0, 0)
27 stats%maximum%v = maxmin_type (missing_r, 0, 0)
28 stats%maximum%t = maxmin_type (missing_r, 0, 0)
29 stats%maximum%q = maxmin_type (missing_r, 0, 0)
30 stats%minimum%u = maxmin_type(-missing_r, 0, 0)
31 stats%minimum%v = maxmin_type(-missing_r, 0, 0)
32 stats%minimum%t = maxmin_type(-missing_r, 0, 0)
33 stats%minimum%q = maxmin_type(-missing_r, 0, 0)
34 stats%average = residual_airep1_type(0.0, 0.0, 0.0, 0.0)
35 stats%rms_err = stats%average
37 do n=1, iv%info(airep)%nlocal
38 do k=1, iv%info(airep)%levels(n)
39 if (iv%info(airep)%proc_domain(k,n)) then
41 u_inc = re%airep(n)%u(k)
42 v_inc = re%airep(n)%v(k)
43 u_obs = ob%airep(n)%u(k)
44 v_obs = ob%airep(n)%v(k)
46 if (.not. wind_sd_airep .and. wind_stats_sd) &
47 call da_ffdduv_diagnose(u_obs,u_obs,u_inc,v_obs,v_obs,v_inc, &
48 iv%airep(n)%u(k)%qc,iv%airep(n)%v(k)%qc, convert_uv2fd)
49 if (wind_sd_airep .and. .not. wind_stats_sd) &
50 call da_ffdduv_diagnose(u_obs,u_obs,u_inc,v_obs,v_obs,v_inc, &
51 iv%airep(n)%u(k)%qc,iv%airep(n)%v(k)%qc, convert_fd2uv)
53 call da_stats_calculate (n, k, iv%airep(n)%u(k)%qc, &
55 stats%minimum%u, stats%maximum%u, &
56 stats%average%u, stats%rms_err%u)
57 call da_stats_calculate (n, k, iv%airep(n)%v(k)%qc, &
59 stats%minimum%v, stats%maximum%v, &
60 stats%average%v, stats%rms_err%v)
61 call da_stats_calculate (n, k, iv%airep(n)%t(k)%qc, &
62 re%airep(n)%t(k), nt, &
63 stats%minimum%t, stats%maximum%t, &
64 stats%average%t, stats%rms_err%t)
65 call da_stats_calculate (n, k, iv%airep(n)%q(k)%qc, &
66 re%airep(n)%q(k), nq, &
67 stats%minimum%q, stats%maximum%q, &
68 stats%average%q, stats%rms_err%q)
73 ! Do inter-processor communication to gather statistics.
74 call da_proc_sum_int (nu)
75 call da_proc_sum_int (nv)
76 call da_proc_sum_int (nt)
77 call da_proc_sum_int (nq)
78 iv%nstats(airep) = nu + nv + nt + nq
80 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
81 stats%minimum%u%value, stats%maximum%u%value, &
82 stats%minimum%u%n, stats%maximum%u%n, &
83 stats%minimum%u%l, stats%maximum%u%l)
84 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
85 stats%minimum%v%value, stats%maximum%v%value, &
86 stats%minimum%v%n, stats%maximum%v%n, &
87 stats%minimum%v%l, stats%maximum%v%l)
88 call da_proc_stats_combine(stats%average%t, stats%rms_err%t, &
89 stats%minimum%t%value, stats%maximum%t%value, &
90 stats%minimum%t%n, stats%maximum%t%n, &
91 stats%minimum%t%l, stats%maximum%t%l)
92 call da_proc_stats_combine(stats%average%q, stats%rms_err%q, &
93 stats%minimum%q%value, stats%maximum%q%value, &
94 stats%minimum%q%n, stats%maximum%q%n, &
95 stats%minimum%q%l, stats%maximum%q%l)
98 if (nu /= 0 .or. nv /= 0 .or. nt /= 0 .or. nq /= 0) then
99 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for airep'
100 call da_print_stats_airep(stats_unit, nu, nv, nt, nq, stats)
104 if (trace_use_dull) call da_trace_exit("da_ao_stats_airep")
106 end subroutine da_ao_stats_airep