da_stats_calculate.inc

References to this file elsewhere.
1 subroutine da_stats_calculate(n, k, qc_flag, x, nn, minimum, maximum, &
2    average, rms_err)
3 
4    !-----------------------------------------------------------------------
5    ! Purpose: TBD
6    !-----------------------------------------------------------------------
7 
8    implicit none
9 
10    integer,            intent(in)    :: n             ! Sequence number of ob.
11    integer,            intent(in)    :: k             ! Level of ob.
12    integer,            intent(in)    :: qc_flag       ! QC flag.
13    real,               intent(in)    :: x             ! Value.
14    integer,            intent(inout) :: nn            ! Number of ok obs.
15    type (maxmin_type), intent(inout) :: minimum, maximum
16    real,               intent(inout) :: average, rms_err
17 
18    if (trace_use_dull) call da_trace_entry("da_stats_calculate")
19 
20    if (qc_flag >= obs_qc_pointer) then
21       nn = nn + 1
22 
23       if (x < minimum%value) then
24          minimum%value = x
25          minimum%n     = n
26          minimum%l     = k
27       end if
28 
29       if (x > maximum%value) then
30          maximum%value = x
31          maximum%n     = n
32          maximum%l     = k
33       end if
34 
35       average = average + x
36       rms_err = rms_err + x * x
37    end if
38 
39    if (trace_use_dull) call da_trace_exit("da_stats_calculate")
40 
41 end subroutine da_stats_calculate
42 
43