1 subroutine da_ao_stats_tamdar (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_tamdar_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_tamdar")
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)
35 stats%average = residual_tamdar1_type(0.0, 0.0, 0.0, 0.0)
36 stats%rms_err = stats%average
38 do n=1, iv%info(tamdar)%nlocal
39 do k=1, iv%info(tamdar)%levels(n)
40 if (iv%info(tamdar)%proc_domain(1,n)) then
42 u_inc = re%tamdar(n)%u(k)
43 v_inc = re%tamdar(n)%v(k)
44 u_obs = ob%tamdar(n)%u(k)
45 v_obs = ob%tamdar(n)%v(k)
47 if (.not. wind_sd_tamdar .and. wind_stats_sd) &
48 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
49 iv%tamdar(n)%u(k)%qc, iv%tamdar(n)%v(k)%qc, convert_uv2fd)
50 if (wind_sd_tamdar .and. .not. wind_stats_sd) &
51 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
52 iv%tamdar(n)%u(k)%qc, iv%tamdar(n)%v(k)%qc, convert_fd2uv)
54 call da_stats_calculate (n, k, iv%tamdar(n)%u(k)%qc, &
56 stats%minimum%u, stats%maximum%u, &
57 stats%average%u, stats%rms_err%u)
58 call da_stats_calculate (n, k, iv%tamdar(n)%v(k)%qc, &
60 stats%minimum%v, stats%maximum%v, &
61 stats%average%v, stats%rms_err%v)
62 call da_stats_calculate (n, k, iv%tamdar(n)%t(k)%qc, &
63 re%tamdar(n)%t(k), nt, &
64 stats%minimum%t, stats%maximum%t, &
65 stats%average%t, stats%rms_err%t)
66 call da_stats_calculate (n, k, iv%tamdar(n)%q(k)%qc, &
67 re%tamdar(n)%q(k), nq, &
68 stats%minimum%q, stats%maximum%q, &
69 stats%average%q, stats%rms_err%q)
74 ! Do inter-processor communication to gather statistics.
75 call da_proc_sum_int (nu)
76 call da_proc_sum_int (nv)
77 call da_proc_sum_int (nt)
78 call da_proc_sum_int (nq)
79 iv%nstats(tamdar) = nu + nv + nt + nq
81 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
82 stats%minimum%u%value, stats%maximum%u%value, &
83 stats%minimum%u%n, stats%maximum%u%n, &
84 stats%minimum%u%l, stats%maximum%u%l)
85 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
86 stats%minimum%v%value, stats%maximum%v%value, &
87 stats%minimum%v%n, stats%maximum%v%n, &
88 stats%minimum%v%l, stats%maximum%v%l)
89 call da_proc_stats_combine(stats%average%t, stats%rms_err%t, &
90 stats%minimum%t%value, stats%maximum%t%value, &
91 stats%minimum%t%n, stats%maximum%t%n, &
92 stats%minimum%t%l, stats%maximum%t%l)
93 call da_proc_stats_combine(stats%average%q, stats%rms_err%q, &
94 stats%minimum%q%value, stats%maximum%q%value, &
95 stats%minimum%q%n, stats%maximum%q%n, &
96 stats%minimum%q%l, stats%maximum%q%l)
99 if (nu /= 0 .or. nv /= 0 .or. nt /= 0 .or. nq /= 0) then
100 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for tamdar'
101 call da_print_stats_tamdar(stats_unit, nu, nv, nt, nq, stats)
105 if (trace_use_dull) call da_trace_exit("da_ao_stats_tamdar")
107 end subroutine da_ao_stats_tamdar