da_residual_buoy.inc

References to this file elsewhere.
1 subroutine da_residual_buoy(oi, y, re,                        &
2                                         np_missing, np_bad_data,          &
3                                         np_obs_used, np_available)
4 
5    !-----------------------------------------------------------------------
6    ! Purpose: TBD
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
20 
21    if (oi%num_buoy > 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 % p % num = number_type(0, 0, 0)
26       n_obs_bad % q % num = number_type(0, 0, 0)
27 
28       do n=1, oi%num_buoy
29          np_available = np_available + 5
30 
31          re%buoy(n)%u = da_residual(n, 0, y%buoy(n)%u, &
32                                      oi%buoy(n)%u, n_obs_bad % u)
33          re%buoy(n)%v = da_residual(n, 0, y%buoy(n)%v, &
34                                   oi%buoy(n)%v, n_obs_bad % v)
35          re%buoy(n)%t = da_residual(n, 0, y%buoy(n)%t, &
36                                   oi%buoy(n)%t, n_obs_bad % t)
37          re%buoy(n)%p = da_residual(n, 0, y%buoy(n)%p, &
38                                   oi%buoy(n)%p, n_obs_bad % p)
39          re%buoy(n)%q = da_residual(n, 0, y%buoy(n)%q, &
40                                   oi%buoy(n)%q, n_obs_bad % q)
41       end do
42 
43       np_missing = np_missing + n_obs_bad % u % num % miss + &
44                   n_obs_bad % v % num % miss + n_obs_bad % t % num % miss + &
45                   n_obs_bad % p % num % miss + n_obs_bad % q % num % miss
46       np_bad_data = np_bad_data + n_obs_bad % u % num % bad + &
47                    n_obs_bad % v % num % bad + n_obs_bad % t % num % bad + &
48                    n_obs_bad % p % num % bad + n_obs_bad % q % num % bad
49       np_obs_used = np_obs_used + n_obs_bad % u % num % use + &
50                    n_obs_bad % v % num % use + n_obs_bad % t % num % use + &
51                    n_obs_bad % p % num % use + n_obs_bad % q % num % use
52 
53    end if
54 
55 end subroutine da_residual_buoy
56 
57