da_ao_stats_geoamv.inc

References to this file elsewhere.
1 subroutine da_ao_stats_geoamv (stats_unit, oi, re)
2 
3    !-------------------------------------------------------------------------
4    ! Purpose: Calculates (Obs - Analysis) statistics for Geo.  AMV's
5    !
6    !-------------------------------------------------------------------------
7 
8    implicit none
9 
10    integer,        intent (in)      :: stats_unit    ! Output unit for stats.
11    type (ob_type), intent (in)      :: oi            ! OI
12    type  (y_type), intent (in)      :: re            ! A - O
13 
14    type (stats_geoamv_type)         :: geoamv
15    integer                          :: nu, nv
16    integer                          :: n, k
17 
18    nu = 0
19    nv = 0
20    num_geoamv_tot = 0
21 
22    geoamv%maximum%u = maxmin_type (missing_r, 0, 0)
23    geoamv%maximum%v = maxmin_type (missing_r, 0, 0)
24    geoamv%minimum%u = maxmin_type(-missing_r, 0, 0)
25    geoamv%minimum%v = maxmin_type(-missing_r, 0, 0)
26    geoamv%average = residual_geoamv1_type (0.0, 0.0)
27    geoamv%rms_err = geoamv%average
28 
29    if (oi%num_geoamv > 0) then
30       do n=1, oi%num_geoamv
31          if (oi%geoamv(n)%loc%proc_domain) then
32             do k=1, oi%geoamv(n)%info%levels
33                call da_stats_calculate (n, 0, oi%geoamv(n)%u(k)%qc, & 
34                                    re%geoamv(n)%u(k), nu, & 
35                                    geoamv%minimum%u, geoamv%maximum%u, &
36                                    geoamv%average%u, geoamv%rms_err%u)
37                call da_stats_calculate (n, 0, oi%geoamv(n)%v(k)%qc, & 
38                                    re%geoamv(n)%v(k), nv, & 
39                                    geoamv%minimum%v, geoamv%maximum%v, &
40                                    geoamv%average%v, geoamv%rms_err%v)
41 
42             end do
43          end if    ! end if (oi%geoamv(n)%loc%proc_domain)
44       end do
45    end if
46 
47    ! Do inter-processor communication to gather statistics.
48    call da_proc_sum_int (nu)
49    call da_proc_sum_int (nv)
50    num_geoamv_tot = nu + nv
51 
52    call da_proc_stats_combine(geoamv%average%u, geoamv%rms_err%u, &
53                            geoamv%minimum%u%value, geoamv%maximum%u%value, &
54                            geoamv%minimum%u%n, geoamv%maximum%u%n, &
55                            geoamv%minimum%u%l, geoamv%maximum%u%l)
56    call da_proc_stats_combine(geoamv%average%v, geoamv%rms_err%v, &
57                            geoamv%minimum%v%value, geoamv%maximum%v%value, &
58                            geoamv%minimum%v%n, geoamv%maximum%v%n, &
59                            geoamv%minimum%v%l, geoamv%maximum%v%l)
60 
61 
62    if (rootproc) then
63       if (nu /= 0 .or. nv /= 0) then
64          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for geoamv'
65          call da_print_stats_geoamv (stats_unit, nu, nv, geoamv)
66       end if
67    end if
68 
69 end subroutine da_ao_stats_geoamv  
70 
71