da_ao_stats_gpspw.inc
References to this file elsewhere.
1 subroutine da_ao_stats_gpspw (stats_unit, iv, re)
2
3 !-----------------------------------------------------------------------
4 ! Purpose: TBD
5 !-----------------------------------------------------------------------
6
7 implicit none
8
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
13 type (stats_gpspw_type) :: stats
14 integer :: ntpw
15 integer :: n
16 real :: o_minus_b, o_minus_a, sigma_o, sigma_b
17 real :: o_minus_b_0, o_minus_a_0, sigma_o_0, sigma_b_0
18
19 if (trace_use_dull) call da_trace_entry("da_ao_stats_gpspw")
20
21 ntpw = 0
22 o_minus_b_0 = 0.0; o_minus_a_0 = 0.0; sigma_o_0 = 0.0; sigma_b_0 = 0.0
23
24 stats%maximum%tpw = maxmin_type (missing_r, 0, 0)
25 stats%minimum%tpw = maxmin_type(-missing_r, 0, 0)
26
27 stats%average = residual_gpspw1_type(0.0)
28 stats%rms_err = stats%average
29
30 do n=1, iv%info(gpspw)%nlocal
31 if (iv%info(gpspw)%proc_domain(1,n)) then
32 call da_stats_calculate (n, 0, iv%gpspw(n)%tpw%qc, &
33 re%gpspw(n)%tpw, ntpw, &
34 stats%minimum%tpw, stats%maximum%tpw, &
35 stats%average%tpw, stats%rms_err%tpw)
36
37 if (pseudo_var(1:3) == 'tpw' .and. num_pseudo > 0) then
38 o_minus_b = iv%GPSpw(n)%tpw%inv
39 o_minus_a = re%gpspw(n)%tpw
40 sigma_o = iv%gpspw(n)%tpw%error
41
42 ! Calculate equivalent sigma_b using
43 !
44 ! O-A=(O-B)*sigma_o/(sigma_o+sigma_b)
45
46 sigma_b = sqrt ((o_minus_b - o_minus_a) / o_minus_a) * sigma_o
47 o_minus_b_0 = wrf_dm_sum_real (o_minus_b)
48 o_minus_a_0 = wrf_dm_sum_real (o_minus_a)
49 sigma_o_0 = wrf_dm_sum_real (sigma_o)
50 sigma_b_0 = wrf_dm_sum_real (sigma_b)
51 write(unit=stdout,fmt='(A,F10.2)') &
52 'TEST_COVERAGE_da_ao_stats_gpspw: o_minus_b_0 = ', o_minus_b_0
53 write(unit=stdout,fmt='(A,F10.2)') &
54 'TEST_COVERAGE_da_ao_stats_gpspw: o_minus_a_0 = ', o_minus_a_0
55 write(unit=stdout,fmt='(A,F10.2)') &
56 'TEST_COVERAGE_da_ao_stats_gpspw: sigma_o_0 = ', sigma_o_0
57 write(unit=stdout,fmt='(A,F10.2)') &
58 'TEST_COVERAGE_da_ao_stats_gpspw: sigma_b_0 = ', sigma_b_0
59 if (rootproc) then
60 write(stats_unit,'(/A,A3,A,f12.3)') &
61 ' Pseudo ', pseudo_var, ' O-B: ', o_minus_b_0
62 write(stats_unit,' (A,A3,A,f12.3)') &
63 ' Pseudo ', pseudo_var, ' O-A: ', o_minus_a_0
64 write(stats_unit,' (A,A3,A,f12.3)') &
65 ' Pseudo ', pseudo_var, ' sigma_o: ', sigma_o_0
66 write(stats_unit,'(A,A3,A,f12.3)') &
67 ' Pseudo ', pseudo_var, ' sigma_b: ', sigma_b_0
68 end if
69 end if
70 end if ! end if (iv%info(gpspw)%proc_domain(1,n))
71 end do
72
73 ! Do inter-processor communication to gather statistics.
74 call da_proc_sum_int (ntpw)
75 iv%nstats(gpspw) = ntpw
76
77 call da_proc_stats_combine(stats%average%tpw, stats%rms_err%tpw, &
78 stats%minimum%tpw%value, stats%maximum%tpw%value, &
79 stats%minimum%tpw%n, stats%maximum%tpw%n, &
80 stats%minimum%tpw%l, stats%maximum%tpw%l)
81
82 if (rootproc) then
83 if (ntpw /= 0) then
84 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for gpspw'
85 call da_print_stats_gpspw(stats_unit, ntpw, stats)
86 end if
87 end if
88
89 if (trace_use_dull) call da_trace_exit("da_ao_stats_gpspw")
90
91 end subroutine da_ao_stats_gpspw
92
93