1 subroutine da_ao_stats_sonde_sfc (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_sonde_sfc_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_sonde_sfc")
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)
37 stats%average = residual_sonde_sfc1_type(0.0, 0.0, 0.0, 0.0, 0.0)
38 stats%rms_err = stats%average
40 do n=1, iv%info(sound)%nlocal
41 if (iv%info(sonde_sfc)%proc_domain(1,n)) then
43 u_inc = re%sonde_sfc(n)%u
44 v_inc = re%sonde_sfc(n)%v
45 u_obs = ob%sonde_sfc(n)%u
46 v_obs = ob%sonde_sfc(n)%v
48 if (.not. wind_sd_sound .and. wind_stats_sd) &
49 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
50 iv%sonde_sfc(n)%u%qc, iv%sonde_sfc(n)%v%qc, convert_uv2fd)
51 if (wind_sd_sound .and. .not. wind_stats_sd) &
52 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
53 iv%sonde_sfc(n)%u%qc, iv%sonde_sfc(n)%v%qc, convert_fd2uv)
55 call da_stats_calculate (n, 0, iv%sonde_sfc(n)%u%qc, &
57 stats%minimum%u, stats%maximum%u, &
58 stats%average%u, stats%rms_err%u)
59 call da_stats_calculate (n, 0, iv%sonde_sfc(n)%v%qc, &
61 stats%minimum%v, stats%maximum%v, &
62 stats%average%v, stats%rms_err%v)
63 call da_stats_calculate (n, 0, iv%sonde_sfc(n)%t%qc, &
64 re%sonde_sfc(n)%t, nt, &
65 stats%minimum%t, stats%maximum%t, &
66 stats%average%t, stats%rms_err%t)
67 call da_stats_calculate (n, 0, iv%sonde_sfc(n)%p%qc, &
68 re%sonde_sfc(n)%p, np, &
69 stats%minimum%p, stats%maximum%p, &
70 stats%average%p, stats%rms_err%p)
71 call da_stats_calculate (n, 0, iv%sonde_sfc(n)%q%qc, &
72 re%sonde_sfc(n)%q, nq, &
73 stats%minimum%q, stats%maximum%q, &
74 stats%average%q, stats%rms_err%q)
78 ! Do inter-processor communication to gather statistics.
79 call da_proc_sum_int (nu)
80 call da_proc_sum_int (nv)
81 call da_proc_sum_int (nt)
82 call da_proc_sum_int (np)
83 call da_proc_sum_int (nq)
84 iv%nstats(sonde_sfc) = nu + nv + nt + np + nq
86 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
87 stats%minimum%u%value, stats%maximum%u%value, &
88 stats%minimum%u%n, stats%maximum%u%n, &
89 stats%minimum%u%l, stats%maximum%u%l)
90 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
91 stats%minimum%v%value, stats%maximum%v%value, &
92 stats%minimum%v%n, stats%maximum%v%n, &
93 stats%minimum%v%l, stats%maximum%v%l)
94 call da_proc_stats_combine(stats%average%t, stats%rms_err%t, &
95 stats%minimum%t%value, stats%maximum%t%value, &
96 stats%minimum%t%n, stats%maximum%t%n, &
97 stats%minimum%t%l, stats%maximum%t%l)
98 call da_proc_stats_combine(stats%average%p, stats%rms_err%p, &
99 stats%minimum%p%value, stats%maximum%p%value, &
100 stats%minimum%p%n, stats%maximum%p%n, &
101 stats%minimum%p%l, stats%maximum%p%l)
102 call da_proc_stats_combine(stats%average%q, stats%rms_err%q, &
103 stats%minimum%q%value, stats%maximum%q%value, &
104 stats%minimum%q%n, stats%maximum%q%n, &
105 stats%minimum%q%l, stats%maximum%q%l)
108 if (nu /= 0 .or. nv /= 0 .or. nt /= 0 .or. np /= 0 .or. nq /= 0) then
109 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for sonde_sfc'
110 call da_print_stats_sonde_sfc(stats_unit, nu, nv, nt, np, nq, stats)
114 if (trace_use_dull) call da_trace_exit("da_ao_stats_sonde_sfc")
116 end subroutine da_ao_stats_sonde_sfc