1 subroutine da_ao_stats_pilot (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_pilot_type) :: stats
17 real :: u_inc, v_inc, u_obs, v_obs
19 if (trace_use_dull) call da_trace_entry("da_ao_stats_pilot")
24 stats%maximum%u = maxmin_type (missing_r, 0, 0)
25 stats%maximum%v = maxmin_type (missing_r, 0, 0)
26 stats%minimum%u = maxmin_type(-missing_r, 0, 0)
27 stats%minimum%v = maxmin_type(-missing_r, 0, 0)
29 stats%average = residual_pilot1_type(0.0, 0.0)
30 stats%rms_err = stats%average
32 do n=1, iv%info(pilot)%nlocal
33 if (iv%info(pilot)%proc_domain(1,n)) then
34 do k=1, iv%info(pilot)%levels(n)
36 u_inc = re%pilot(n)%u(k)
37 v_inc = re%pilot(n)%v(k)
38 u_obs = ob%pilot(n)%u(k)
39 v_obs = ob%pilot(n)%v(k)
41 if (.not. wind_sd_pilot .and. wind_stats_sd) &
42 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
43 iv%pilot(n)%u(k)%qc, iv%pilot(n)%v(k)%qc, convert_uv2fd)
44 if (wind_sd_pilot .and. .not. wind_stats_sd) &
45 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
46 iv%pilot(n)%u(k)%qc, iv%pilot(n)%v(k)%qc, convert_fd2uv)
48 call da_stats_calculate (n, k, iv%pilot(n)%u(k)%qc, &
50 stats%minimum%u, stats%maximum%u, &
51 stats%average%u, stats%rms_err%u)
52 call da_stats_calculate (n, k, iv%pilot(n)%v(k)%qc, &
54 stats%minimum%v, stats%maximum%v, &
55 stats%average%v, stats%rms_err%v)
57 end if ! end if (iv%info(pilot)%proc_domain(1,n))
60 ! do inter-processor communication to gather statistics.
61 call da_proc_sum_int (nu)
62 call da_proc_sum_int (nv)
63 iv%nstats(pilot) = nu + nv
65 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
66 stats%minimum%u%value, stats%maximum%u%value, &
67 stats%minimum%u%n, stats%maximum%u%n, &
68 stats%minimum%u%l, stats%maximum%u%l)
69 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
70 stats%minimum%v%value, stats%maximum%v%value, &
71 stats%minimum%v%n, stats%maximum%v%n, &
72 stats%minimum%v%l, stats%maximum%v%l)
75 if (nu /= 0 .or. nv /= 0) then
76 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for pilot'
77 call da_print_stats_pilot(stats_unit, nu, nv, stats)
81 if (trace_use_dull) call da_trace_exit("da_ao_stats_pilot")
83 end subroutine da_ao_stats_pilot