da_oi_stats_gpspw.inc

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