1 subroutine da_residual_chem_sfc(iv, y, re, np_missing, np_bad_data, np_obs_used, np_available)
3 !-----------------------------------------------------------------------
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) call da_trace_entry("da_residual_chem_sfc")
23 n_obs_bad % chemic_surf % num = number_type(0, 0, 0)
26 allocate ( re%chemic_surf(iv%info(chemic_surf)%nlocal) )
28 do n=1, iv%info(chemic_surf)%nlocal
29 allocate ( re%chemic_surf(n)%chem(num_chemic_surf))
30 do ichem = PARAM_FIRST_SCALAR, num_chemic_surf
31 np_available = np_available + 1
32 re%chemic_surf(n)%chem(ichem) = da_residual(n, 0, y%chemic_surf(n)%chem(ichem), &
33 iv%chemic_surf(n)%chem(ichem), n_obs_bad % chemic_surf)
37 np_missing = np_missing + n_obs_bad % chemic_surf % num % miss
38 np_bad_data = np_bad_data + n_obs_bad % chemic_surf % num % bad
39 np_obs_used = np_obs_used + n_obs_bad % chemic_surf % num % use
41 if (trace_use) call da_trace_exit("da_residual_chem_sfc")
43 end subroutine da_residual_chem_sfc