1 subroutine da_ao_stats_synop (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_synop_type) :: stats
15 integer :: nu, nv, nt, np, nq
17 real :: u_inc, v_inc, u_obs, v_obs
19 if (trace_use_dull) call da_trace_entry("da_ao_stats_synop")
27 stats%maximum%u = maxmin_type (missing_r, 0, 0)
28 stats%maximum%v = maxmin_type (missing_r, 0, 0)
29 stats%maximum%t = maxmin_type (missing_r, 0, 0)
30 stats%maximum%p = maxmin_type (missing_r, 0, 0)
31 stats%maximum%q = maxmin_type (missing_r, 0, 0)
32 stats%minimum%u = maxmin_type(-missing_r, 0, 0)
33 stats%minimum%v = maxmin_type(-missing_r, 0, 0)
34 stats%minimum%t = maxmin_type(-missing_r, 0, 0)
35 stats%minimum%p = maxmin_type(-missing_r, 0, 0)
36 stats%minimum%q = maxmin_type(-missing_r, 0, 0)
38 stats%average = residual_synop1_type(0.0, 0.0, 0.0, 0.0, 0.0)
39 stats%rms_err = stats%average
41 do n=1, iv%info(synop)%nlocal
42 if (iv%info(synop)%proc_domain(1,n)) then
49 if (.not. wind_sd_synop .and. wind_stats_sd) &
50 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
51 iv%synop(n)%u%qc, iv%synop(n)%v%qc, convert_uv2fd)
52 if (wind_sd_synop .and. .not. wind_stats_sd) &
53 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
54 iv%synop(n)%u%qc, iv%synop(n)%v%qc, convert_fd2uv)
56 call da_stats_calculate (n, 0, iv%synop(n)%u%qc, &
58 stats%minimum%u, stats%maximum%u, &
59 stats%average%u, stats%rms_err%u)
60 call da_stats_calculate (n, 0, iv%synop(n)%v%qc, &
62 stats%minimum%v, stats%maximum%v, &
63 stats%average%v, stats%rms_err%v)
64 call da_stats_calculate (n, 0, iv%synop(n)%t%qc, &
66 stats%minimum%t, stats%maximum%t, &
67 stats%average%t, stats%rms_err%t)
68 call da_stats_calculate (n, 0, iv%synop(n)%p%qc, &
70 stats%minimum%p, stats%maximum%p, &
71 stats%average%p, stats%rms_err%p)
72 call da_stats_calculate (n, 0, iv%synop(n)%q%qc, &
74 stats%minimum%q, stats%maximum%q, &
75 stats%average%q, stats%rms_err%q)
76 end if ! end if (iv%info(synop)%proc_domain(1,n))
79 ! Do inter-processor communication to gather statistics.
80 call da_proc_sum_int (nu)
81 call da_proc_sum_int (nv)
82 call da_proc_sum_int (nt)
83 call da_proc_sum_int (np)
84 call da_proc_sum_int (nq)
85 iv%nstats(synop) = nu + nv + nt + np + nq
87 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
88 stats%minimum%u%value, stats%maximum%u%value, &
89 stats%minimum%u%n, stats%maximum%u%n, &
90 stats%minimum%u%l, stats%maximum%u%l)
91 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
92 stats%minimum%v%value, stats%maximum%v%value, &
93 stats%minimum%v%n, stats%maximum%v%n, &
94 stats%minimum%v%l, stats%maximum%v%l)
95 call da_proc_stats_combine(stats%average%t, stats%rms_err%t, &
96 stats%minimum%t%value, stats%maximum%t%value, &
97 stats%minimum%t%n, stats%maximum%t%n, &
98 stats%minimum%t%l, stats%maximum%t%l)
99 call da_proc_stats_combine(stats%average%p, stats%rms_err%p, &
100 stats%minimum%p%value, stats%maximum%p%value, &
101 stats%minimum%p%n, stats%maximum%p%n, &
102 stats%minimum%p%l, stats%maximum%p%l)
103 call da_proc_stats_combine(stats%average%q, stats%rms_err%q, &
104 stats%minimum%q%value, stats%maximum%q%value, &
105 stats%minimum%q%n, stats%maximum%q%n, &
106 stats%minimum%q%l, stats%maximum%q%l)
109 if (nu /= 0 .or. nv /= 0 .or. nt /= 0 .or. np /= 0 .or. nq /= 0) then
110 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for synop'
111 call da_print_stats_synop(stats_unit, nu, nv, nt, np, nq, stats)
115 if (trace_use_dull) call da_trace_exit("da_ao_stats_synop")
117 end subroutine da_ao_stats_synop