1 subroutine da_residual_sonde_sfc(iv, y, re,np_missing, np_bad_data,np_obs_used, np_available)
3 !-----------------------------------------------------------------------
4 ! Purpose: Calculate residuals for sonde surface obs
5 !-----------------------------------------------------------------------
9 type (iv_type), intent(in) :: iv ! Innovation vector (O-B).
10 type (y_type) , intent(in) :: y ! y = H (xa)
11 type (y_type) , intent(inout) :: re ! Residual vector (O-A).
13 integer , intent(inout) :: np_available
14 integer , intent(inout) :: np_obs_used
15 integer , intent(inout) :: np_missing
16 integer , intent(inout) :: np_bad_data
18 type (bad_data_type) :: n_obs_bad
21 if (trace_use_dull) call da_trace_entry("da_residual_sonde_sfc")
23 n_obs_bad % u % num = number_type(0, 0, 0)
24 n_obs_bad % v % num = number_type(0, 0, 0)
25 n_obs_bad % t % num = number_type(0, 0, 0)
26 n_obs_bad % p % num = number_type(0, 0, 0)
27 n_obs_bad % q % num = number_type(0, 0, 0)
29 do n=1, iv%info(sound)%nlocal
30 np_available = np_available + 5
32 re%sonde_sfc(n)%u = da_residual(n, 0, y%sonde_sfc(n)%u, iv%sonde_sfc(n)%u, n_obs_bad % u)
33 re%sonde_sfc(n)%v = da_residual(n, 0, y%sonde_sfc(n)%v, iv%sonde_sfc(n)%v, n_obs_bad % v)
34 re%sonde_sfc(n)%t = da_residual(n, 0, y%sonde_sfc(n)%t, iv%sonde_sfc(n)%t, n_obs_bad % t)
35 re%sonde_sfc(n)%p = da_residual(n, 0, y%sonde_sfc(n)%p, iv%sonde_sfc(n)%p, n_obs_bad % p)
36 re%sonde_sfc(n)%q = da_residual(n, 0, y%sonde_sfc(n)%q, iv%sonde_sfc(n)%q, n_obs_bad % q)
39 np_missing = np_missing + n_obs_bad % u % num % miss + &
40 n_obs_bad % v % num % miss + n_obs_bad % t % num % miss + &
41 n_obs_bad % p % num % miss + n_obs_bad % q % num % miss
42 np_bad_data = np_bad_data + n_obs_bad % u % num % bad + &
43 n_obs_bad % v % num % bad + n_obs_bad % t % num % bad + &
44 n_obs_bad % p % num % bad + n_obs_bad % q % num % bad
45 np_obs_used = np_obs_used + n_obs_bad % u % num % use + &
46 n_obs_bad % v % num % use + n_obs_bad % t % num % use + &
47 n_obs_bad % p % num % use + n_obs_bad % q % num % use
49 if (trace_use_dull) call da_trace_exit("da_residual_sonde_sfc")
51 end subroutine da_residual_sonde_sfc