da_residual_rad.inc

References to this file elsewhere.
1 subroutine da_residual_rad(iv, y, re,                 &
2                                         np_missing, np_bad_data, &
3                                         np_obs_used, np_available)
4 
5   !---------------------------------------------------------------------------
6   ! Purpose: Calculate Obs Residual and counting obs number.
7   !
8   ! Method:  re = (d - H delta_x)
9   !---------------------------------------------------------------------------
10 
11    implicit none
12 
13    type (ob_type), intent(in)        :: iv     ! Innovation vector (O-B).
14    type (y_type) , intent(in)        :: y      ! y = H (xa)
15    type (y_type) , intent(inout)     :: re     ! Residual structure.
16 
17    integer       , intent(inout)     :: np_available, np_obs_used,          &
18                                         np_missing  , np_bad_data
19 
20    type (bad_data_type)              :: n_obs_bad
21    integer                           :: i
22 
23    if (iv%num_inst < 1) return
24 
25    if (trace_use) call da_trace_entry("da_residual_rad")
26 
27    do i = 1, iv%num_inst
28       if (iv%instid(i)%num_rad < 1) cycle
29 
30       n_obs_bad % rad % num = number_type(0, 0, 0)
31       call da_residual_new(y%instid(i)%tb(:,:), iv%instid(i)%tb_qc(:,:), &
32          iv%instid(i)%tb_inv(:,:), re%instid(i)%tb(:,:))
33       np_available = iv%instid(i)%nchan*iv%instid(i)%num_rad
34    end do
35 
36    np_missing  = np_missing  + n_obs_bad % rad % num % miss
37    np_bad_data = np_bad_data + n_obs_bad % rad % num % bad
38    np_obs_used = np_obs_used + n_obs_bad % rad % num % use 
39 
40    if (trace_use) call da_trace_exit("da_residual_rad")
41    
42 end subroutine da_residual_rad
43 
44