1 subroutine da_oi_stats_airep (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_airep_type) :: stats
14 integer :: nu, nv, nt, nq
16 real :: u_inv, v_inv, u_obs, v_obs
18 if (trace_use_dull) call da_trace_entry("da_oi_stats_airep")
25 stats%maximum%u = maxmin_type(missing_r, 0, 0)
26 stats%maximum%v = maxmin_type(missing_r, 0, 0)
27 stats%maximum%t = maxmin_type(missing_r, 0, 0)
28 stats%maximum%q = maxmin_type(missing_r, 0, 0)
29 stats%minimum%u = maxmin_type(-missing_r, 0, 0)
30 stats%minimum%v = maxmin_type(-missing_r, 0, 0)
31 stats%minimum%t = maxmin_type(-missing_r, 0, 0)
32 stats%minimum%q = maxmin_type(-missing_r, 0, 0)
33 stats%average = residual_airep1_type(0.0, 0.0, 0.0, 0.0)
34 stats%rms_err = stats%average
36 do n=1, iv%info(airep)%nlocal
37 do k=1, iv%info(airep)%levels(n)
38 if (iv%info(airep)%proc_domain(k,n)) then
40 u_inv = iv%airep(n)%u(k)%inv
41 v_inv = iv%airep(n)%v(k)%inv
42 u_obs = ob%airep(n)%u(k)
43 v_obs = ob%airep(n)%v(k)
45 if (.not. wind_sd_airep .and. wind_stats_sd) &
46 call da_ffdduv_diagnose(u_obs,u_inv,u_obs,v_obs,v_inv,v_obs, &
47 iv%airep(n)%u(k)%qc,iv%airep(n)%v(k)%qc, convert_uv2fd)
48 if (wind_sd_airep .and. .not. wind_stats_sd) &
49 call da_ffdduv_diagnose(u_obs,u_inv,u_obs,v_obs,v_inv,v_obs, &
50 iv%airep(n)%u(k)%qc,iv%airep(n)%v(k)%qc, convert_fd2uv)
52 call da_stats_calculate(iv%info(airep)%obs_global_index(n), &
53 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(iv%info(airep)%obs_global_index(n), &
58 k, iv%airep(n)%v(k)%qc, &
60 stats%minimum%v, stats%maximum%v, &
61 stats%average%v, stats%rms_err%v)
62 call da_stats_calculate(iv%info(airep)%obs_global_index(n), &
63 k, iv%airep(n)%t(k)%qc, &
64 iv%airep(n)%t(k)%inv, nt, &
65 stats%minimum%t, stats%maximum%t, &
66 stats%average%t, stats%rms_err%t)
67 call da_stats_calculate(iv%info(airep)%obs_global_index(n), &
68 k, iv%airep(n)%q(k)%qc, &
69 iv%airep(n)%q(k)%inv, nq, &
70 stats%minimum%q, stats%maximum%q, &
71 stats%average%q, stats%rms_err%q)
76 ! do inter-processor communication to gather statistics.
77 call da_proc_sum_int(nu)
78 call da_proc_sum_int(nv)
79 call da_proc_sum_int(nt)
80 call da_proc_sum_int(nq)
82 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
83 stats%minimum%u%value, stats%maximum%u%value, &
84 stats%minimum%u%n, stats%maximum%u%n, &
85 stats%minimum%u%l, stats%maximum%u%l)
86 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
87 stats%minimum%v%value, stats%maximum%v%value, &
88 stats%minimum%v%n, stats%maximum%v%n, &
89 stats%minimum%v%l, stats%maximum%v%l)
90 call da_proc_stats_combine(stats%average%t, stats%rms_err%t, &
91 stats%minimum%t%value, stats%maximum%t%value, &
92 stats%minimum%t%n, stats%maximum%t%n, &
93 stats%minimum%t%l, stats%maximum%t%l)
94 call da_proc_stats_combine(stats%average%q, stats%rms_err%q, &
95 stats%minimum%q%value, stats%maximum%q%value, &
96 stats%minimum%q%n, stats%maximum%q%n, &
97 stats%minimum%q%l, stats%maximum%q%l)
100 if (nu /= 0 .or. nv /= 0 .or. nt /= 0 .or. nq /= 0) then
101 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of OI for airep'
102 call da_print_stats_airep(stats_unit, nu, nv, nt, nq, stats)
106 if (trace_use_dull) call da_trace_exit("da_oi_stats_airep")
108 end subroutine da_oi_stats_airep