1 subroutine da_oi_stats_qscat (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_qscat_type) :: stats
16 real :: u_inv, v_inv, u_obs, v_obs
18 if (trace_use_dull) call da_trace_entry("da_oi_stats_qscat")
23 stats%maximum%u = maxmin_type(-1.0E+20, 0, 0)
24 stats%maximum%v = maxmin_type(-1.0E+20, 0, 0)
25 stats%minimum%u = maxmin_type(1.0E+20, 0, 0)
26 stats%minimum%v = maxmin_type(1.0E+20, 0, 0)
27 stats%average = residual_qscat1_type(0.0, 0.0)
28 stats%rms_err = stats%average
30 do n=1, iv%info(qscat)%nlocal
31 if (iv%info(qscat)%proc_domain(1,n)) then
33 u_inv = iv%qscat(n)%u%inv
34 v_inv = iv%qscat(n)%v%inv
38 if (.not. wind_sd_qscat .and. wind_stats_sd) &
39 call da_ffdduv_diagnose(u_obs, u_inv, u_obs, v_obs, v_inv, v_obs, &
40 iv%qscat(n)%u%qc, iv%qscat(n)%v%qc, convert_uv2fd)
41 if (wind_sd_qscat .and. .not. wind_stats_sd) &
42 call da_ffdduv_diagnose(u_obs, u_inv, u_obs, v_obs, v_inv, v_obs, &
43 iv%qscat(n)%u%qc, iv%qscat(n)%v%qc, convert_fd2uv)
45 call da_stats_calculate(n, 0, iv%qscat(n)%u%qc, u_inv, nu, &
46 stats%minimum%u, stats%maximum%u, stats%average%u, stats%rms_err%u)
47 call da_stats_calculate(n, 0, iv%qscat(n)%v%qc, v_inv, nv, &
48 stats%minimum%v, stats%maximum%v, stats%average%v, stats%rms_err%v)
49 end if ! end if (iv%info(qscat)%proc_domain(1,n))
52 ! Do inter-processor communication to gather statistics.
53 call da_proc_sum_int(nu)
54 call da_proc_sum_int(nv)
56 call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
57 stats%minimum%u%value, stats%maximum%u%value, &
58 stats%minimum%u%n, stats%maximum%u%n, &
59 stats%minimum%u%l, stats%maximum%u%l)
60 call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
61 stats%minimum%v%value, stats%maximum%v%value, &
62 stats%minimum%v%n, stats%maximum%v%n, &
63 stats%minimum%v%l, stats%maximum%v%l)
66 if (nu /= 0 .or. nv /= 0) then
67 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of OI for qscat'
68 call da_print_stats_qscat(stats_unit, nu, nv, stats)
72 if (trace_use_dull) call da_trace_exit("da_oi_stats_qscat")
74 end subroutine da_oi_stats_qscat