da_oi_stats_gpsref.inc

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