da_ao_stats_polaramv.inc

References to this file elsewhere.
1 subroutine da_ao_stats_polaramv (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_polaramv_type)       :: polaramv
14    integer                          :: nu, nv
15    integer                          :: n, k
16 
17    nu = 0
18    nv = 0
19    num_polaramv_tot = 0
20    
21    polaramv%maximum%u = maxmin_type (missing_r, 0, 0)
22    polaramv%maximum%v = maxmin_type (missing_r, 0, 0)
23    polaramv%minimum%u = maxmin_type(-missing_r, 0, 0)
24    polaramv%minimum%v = maxmin_type(-missing_r, 0, 0)
25    polaramv%average = residual_polaramv1_type(0.0, 0.0)
26    polaramv%rms_err = polaramv%average
27 
28    if (oi%num_polaramv > 0) then  
29       do n=1, oi%num_polaramv
30          if (oi%polaramv(n)%loc%proc_domain) then
31             do k=1, oi%polaramv(n)%info%levels
32                call da_stats_calculate (n, 0, oi%polaramv(n)%u(k)%qc, & 
33                                re%polaramv(n)%u(k), nu, & 
34                                polaramv%minimum%u, polaramv%maximum%u, &
35                                polaramv%average%u, polaramv%rms_err%u)
36                call da_stats_calculate (n, 0, oi%polaramv(n)%v(k)%qc, & 
37                                re%polaramv(n)%v(k), nv, & 
38                                polaramv%minimum%v, polaramv%maximum%v, &
39                                polaramv%average%v, polaramv%rms_err%v)
40 
41             end do
42          end if    ! end if (oi%polaramv(n)%loc%proc_domain)
43       end do
44    end if
45 
46    ! Do inter-processor communication to gather statistics.
47    call da_proc_sum_int (nu)
48    call da_proc_sum_int (nv)
49    num_polaramv_tot = nu + nv
50    
51    call da_proc_stats_combine(polaramv%average%u, polaramv%rms_err%u, &
52                            polaramv%minimum%u%value, polaramv%maximum%u%value, &
53                            polaramv%minimum%u%n, polaramv%maximum%u%n, &
54                            polaramv%minimum%u%l, polaramv%maximum%u%l)
55    call da_proc_stats_combine(polaramv%average%v, polaramv%rms_err%v, &
56                            polaramv%minimum%v%value, polaramv%maximum%v%value, &
57                            polaramv%minimum%v%n, polaramv%maximum%v%n, &
58                            polaramv%minimum%v%l, polaramv%maximum%v%l)
59    
60    
61    if (rootproc) then   
62       if (nu /= 0 .or. nv /= 0) then
63          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for polaramv'
64          call da_print_stats_polaramv (stats_unit, nu, nv, polaramv)
65       end if
66    end if
67 
68 end subroutine da_ao_stats_polaramv  
69 
70