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