1 subroutine da_oi_stats_sonde_sfc (stats_unit, iv, ob)
3 !-----------------------------------------------------------------------
5 !-----------------------------------------------------------------------
9 integer, intent (in) :: stats_unit ! Output unit for stats.
10 type (iv_type), intent (in) :: iv ! OI
11 type(y_type), intent (in) :: ob ! Observation structure.
13 type (stats_sonde_sfc_type) :: stats
14 integer :: nu, nv, nt, np, nq
16 real :: u_inv, v_inv, u_obs, v_obs
18 if (trace_use_dull) call da_trace_entry("da_oi_stats_sonde_sfc")
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%p = maxmin_type(missing_r, 0, 0)
30 stats%maximum%q = maxmin_type(missing_r, 0, 0)
31 stats%minimum%u = maxmin_type(-missing_r, 0, 0)
32 stats%minimum%v = maxmin_type(-missing_r, 0, 0)
33 stats%minimum%t = maxmin_type(-missing_r, 0, 0)
34 stats%minimum%p = maxmin_type(-missing_r, 0, 0)
35 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_inv = iv%sonde_sfc(n)%u%inv
44 v_inv = iv%sonde_sfc(n)%v%inv
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_inv, u_obs, v_obs, v_inv, v_obs, &
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_inv, u_obs, v_obs, v_inv, v_obs, &
53 iv%sonde_sfc(n)%u%qc, iv%sonde_sfc(n)%v%qc, convert_fd2uv)
55 call da_stats_calculate(iv%info(sonde_sfc)%obs_global_index(n), &
56 0, iv%sonde_sfc(n)%u%qc, &
58 stats%minimum%u, stats%maximum%u, &
59 stats%average%u, stats%rms_err%u)
60 call da_stats_calculate(iv%info(sonde_sfc)%obs_global_index(n), &
61 0, iv%sonde_sfc(n)%v%qc, &
63 stats%minimum%v, stats%maximum%v, &
64 stats%average%v, stats%rms_err%v)
65 call da_stats_calculate(iv%info(sonde_sfc)%obs_global_index(n), &
66 0, iv%sonde_sfc(n)%t%qc, &
67 iv%sonde_sfc(n)%t%inv, nt, &
68 stats%minimum%t, stats%maximum%t, &
69 stats%average%t, stats%rms_err%t)
70 call da_stats_calculate(iv%info(sonde_sfc)%obs_global_index(n), &
71 0, iv%sonde_sfc(n)%p%qc, &
72 iv%sonde_sfc(n)%p%inv, np, &
73 stats%minimum%p, stats%maximum%p, &
74 stats%average%p, stats%rms_err%p)
76 call da_stats_calculate(iv%info(sonde_sfc)%obs_global_index(n), &
77 0, iv%sonde_sfc(n)%q%qc, &
78 iv%sonde_sfc(n)%q%inv, nq, &
79 stats%minimum%q, stats%maximum%q, &
80 stats%average%q, stats%rms_err%q)
81 end if ! end if (iv%info(sonde_sfc)%proc_domain(1,n))
84 ! Do inter-processor communication to gather statistics.
85 call da_proc_sum_int(nu)
86 call da_proc_sum_int(nv)
87 call da_proc_sum_int(nt)
88 call da_proc_sum_int(np)
89 call da_proc_sum_int(nq)
91 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
92 stats%minimum%u%value, stats%maximum%u%value, &
93 stats%minimum%u%n, stats%maximum%u%n, &
94 stats%minimum%u%l, stats%maximum%u%l)
96 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
97 stats%minimum%v%value, stats%maximum%v%value, &
98 stats%minimum%v%n, stats%maximum%v%n, &
99 stats%minimum%v%l, stats%maximum%v%l)
101 call da_proc_stats_combine(stats%average%t, stats%rms_err%t, &
102 stats%minimum%t%value, stats%maximum%t%value, &
103 stats%minimum%t%n, stats%maximum%t%n, &
104 stats%minimum%t%l, stats%maximum%t%l)
106 call da_proc_stats_combine(stats%average%p, stats%rms_err%p, &
107 stats%minimum%p%value, stats%maximum%p%value, &
108 stats%minimum%p%n, stats%maximum%p%n, &
109 stats%minimum%p%l, stats%maximum%p%l)
111 call da_proc_stats_combine(stats%average%q, stats%rms_err%q, &
112 stats%minimum%q%value, stats%maximum%q%value, &
113 stats%minimum%q%n, stats%maximum%q%n, &
114 stats%minimum%q%l, stats%maximum%q%l)
117 if (nu /= 0 .or. nv /= 0 .or. nt /= 0 .or. np /= 0 .or. nq /= 0) then
118 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of OI for sonde_sfc'
119 call da_print_stats_sonde_sfc(stats_unit, nu, nv, nt, np, nq, stats)
123 if (trace_use_dull) call da_trace_exit("da_oi_stats_sonde_sfc")
125 end subroutine da_oi_stats_sonde_sfc