da_residual_sound.inc

References to this file elsewhere.
1 subroutine da_residual_sound(oi, y, re,                        &
2                                         np_missing, np_bad_data,          &
3                                         np_obs_used, np_available)
4 
5    !-----------------------------------------------------------------------
6    ! Purpose: Calculate residuals for sound obs
7    !-----------------------------------------------------------------------
8 
9    implicit none
10 
11    type (ob_type), intent(in)        :: oi     ! Innovation vector (O-B).
12    type (y_type) , intent(in)        :: y      ! y = H (xa)
13    type (y_type) , intent(inout)     :: re     ! Residual structure.
14 
15    integer       , intent(inout)     :: np_available, np_obs_used,          &
16                                        np_missing  , np_bad_data
17 
18    type (bad_data_type)              :: n_obs_bad
19    integer                           :: n, k
20 
21    if (oi%num_Sound > 0) then
22       n_obs_bad % u % num = number_type(0, 0, 0)
23       n_obs_bad % v % num = number_type(0, 0, 0)
24       n_obs_bad % t % num = number_type(0, 0, 0)
25       n_obs_bad % q % num = number_type(0, 0, 0)
26 
27       do n=1, oi%num_Sound
28          do k=1, oi%sound(n)%info%levels
29             np_available = np_available + 4
30 
31             re%Sound(n)%u(k) = da_residual(n, k, y%Sound(n)%u(k), &
32                                      oi%Sound(n)%u(k), n_obs_bad % u)
33             re%Sound(n)%v(k) = da_residual(n, k, y%Sound(n)%v(k), &
34                                      oi%Sound(n)%v(k), n_obs_bad % v)
35             re%Sound(n)%t(k) = da_residual(n, k, y%Sound(n)%t(k), &
36                                      oi%Sound(n)%t(k), n_obs_bad % t)
37             re%Sound(n)%q(k) = da_residual(n, k, y%Sound(n)%q(k), &
38                                      oi%Sound(n)%q(k), n_obs_bad % q)
39          end do
40       end do
41 
42       np_missing = np_missing + n_obs_bad % u % num % miss + &
43                   n_obs_bad % v % num % miss + n_obs_bad % t % num % miss + &
44                   n_obs_bad % q % num % miss
45       np_bad_data = np_bad_data + n_obs_bad % u % num % bad + &
46                    n_obs_bad % v % num % bad + n_obs_bad % t % num % bad + &
47                    n_obs_bad % q % num % bad
48       np_obs_used = np_obs_used + n_obs_bad % u % num % use + &
49                    n_obs_bad % v % num % use + n_obs_bad % t % num % use + &
50                    n_obs_bad % q % num % use
51 
52    end if
53 
54 end subroutine da_residual_sound
55 
56