1 subroutine da_ao_stats_qscat (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_qscat_type) :: stats
17 real :: u_inc, v_inc, u_obs, v_obs
19 if (trace_use_dull) call da_trace_entry("da_ao_stats_qscat")
24 stats%maximum%u = maxmin_type(-1.0E+20, 0, 0)
25 stats%maximum%v = maxmin_type(-1.0E+20, 0, 0)
26 stats%minimum%u = maxmin_type (1.0E+20, 0, 0)
27 stats%minimum%v = maxmin_type (1.0E+20, 0, 0)
28 stats%average = residual_qscat1_type(0.0, 0.0)
29 stats%rms_err = stats%average
31 do n=1, iv%info(qscat)%nlocal
32 if (iv%info(qscat)%proc_domain(1,n)) then
39 if (.not. wind_sd_qscat .and. wind_stats_sd) &
40 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
41 iv%qscat(n)%u%qc, iv%qscat(n)%v%qc, convert_uv2fd)
42 if (wind_sd_qscat .and. .not. wind_stats_sd) &
43 call da_ffdduv_diagnose(u_obs, u_obs, u_inc, v_obs, v_obs, v_inc, &
44 iv%qscat(n)%u%qc, iv%qscat(n)%v%qc, convert_fd2uv)
46 call da_stats_calculate (n, 0, iv%qscat(n)%u%qc, &
48 stats%minimum%u, stats%maximum%u, &
49 stats%average%u, stats%rms_err%u)
50 call da_stats_calculate (n, 0, iv%qscat(n)%v%qc, &
52 stats%minimum%v, stats%maximum%v, &
53 stats%average%v, stats%rms_err%v)
54 end if ! end if (iv%info(qscat)%proc_domain(1,n))
57 ! Do inter-processor communication to gather statistics.
58 call da_proc_sum_int (nu)
59 call da_proc_sum_int (nv)
60 iv%nstats(qscat) = nu + nv
62 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
63 stats%minimum%u%value, stats%maximum%u%value, &
64 stats%minimum%u%n, stats%maximum%u%n, &
65 stats%minimum%u%l, stats%maximum%u%l)
66 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
67 stats%minimum%v%value, stats%maximum%v%value, &
68 stats%minimum%v%n, stats%maximum%v%n, &
69 stats%minimum%v%l, stats%maximum%v%l)
72 if (nu /= 0 .or. nv /= 0) then
73 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for qscat'
74 call da_print_stats_qscat(stats_unit, nu, nv, stats)
78 if (trace_use_dull) call da_trace_exit("da_ao_stats_qscat")
80 end subroutine da_ao_stats_qscat