da_oi_stats_gpspw.inc

References to this file elsewhere.
1 subroutine da_oi_stats_gpspw (stats_unit, oi)
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 
12    type (stats_gpspw_type)                :: Gpspw
13    integer                          :: ntpw
14    integer                          :: n
15 
16    ntpw = 0
17 
18    Gpspw%maximum%tpw = maxmin_type(missing_r, 0, 0)
19    Gpspw%minimum%tpw = maxmin_type(-missing_r, 0, 0)
20    Gpspw%average = residual_gpspw1_type(0.0)
21    Gpspw%rms_err = Gpspw%average
22 
23    if (oi%num_Gpspw > 0) then
24       do n=1, oi%num_Gpspw
25          if (oi%gpspw(n)%loc%proc_domain) then
26             call da_stats_calculate(oi%Gpspw(n)%loc%obs_global_index, &
27                                0, oi%gpspw(n)%tpw%qc, &
28                               oi%gpspw(n)%tpw%inv, ntpw, &
29                               gpspw%minimum%tpw  , gpspw%maximum%tpw, &
30                               gpspw%average%tpw  , gpspw%rms_err%tpw)
31 
32          end if    ! end if (oi%gpspw(n)%loc%proc_domain)
33       end do
34    end if
35 
36    ! Do inter-processor communication to gather statistics.
37 
38    call da_proc_sum_int(ntpw)
39 
40    call da_proc_stats_combine(Gpspw%average%tpw, Gpspw%rms_err%tpw, &
41                            Gpspw%minimum%tpw%value, Gpspw%maximum%tpw%value, &
42                            Gpspw%minimum%tpw%n, Gpspw%maximum%tpw%n, &
43                            Gpspw%minimum%tpw%l, Gpspw%maximum%tpw%l)
44 
45    if (rootproc) then
46       if (ntpw /= 0) then
47          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of OI for gpspw'
48          call da_print_stats_gpspw(stats_unit, ntpw, Gpspw)
49       end if
50    end if
51 
52 end subroutine da_oi_stats_gpspw
53 
54