1 subroutine da_residual_gpsref(iv, y, re, np_missing, np_bad_data, np_obs_used, np_available)
3 !-----------------------------------------------------------------------
4 ! Purpose: Calculate residiual for gpsref obs
5 !-----------------------------------------------------------------------
9 type (iv_type),intent(inout) :: 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 real :: constant0, g_lat, g_height, weight1, weight2, &
24 if (trace_use_dull) call da_trace_entry("da_residual_gpsref")
26 ! Assuming the highest latitude is 90.0 degree:
27 constant0= sin(radian * 90.0)
29 n_obs_bad % gpsref % num = number_type(0, 0, 0)
31 do n=1, iv%info(gpsref)%nlocal
32 do k=1, iv%info(gpsref)%levels(n)
33 np_available = np_available + 1
35 ! Weighted the GPSREF innovation with the latitude:
36 if (iv%gpsref(n)%ref(k)%qc >= obs_qc_pointer ) then
38 ! depend on the height: above 7km, set to 1.0, below 7km, decrease to 0.0:
39 g_height = iv%gpsref(n)% h(k)
40 weight1 = 1.0 - (7000.0 - g_height) / 7000.0
41 if ( weight1 > 1.0 ) weight1 = 1.0
42 ! not depend on height:
45 ! depend on the latitude, at 90 degree, weight = 1.0, at 0 degree, weight = 0.0
46 g_lat = iv%info(gpsref)%lat(k,n)
47 weight2 = abs(sin(radian * g_lat) / constant0)
48 ! not depend on the latitude:
51 gpsref_org = iv%gpsref(n)%ref(k)%inv
52 iv%gpsref(n)%ref(k)%inv = gpsref_org * weight1 * weight2
54 !.............................................................
55 re%gpsref(n)%ref(k) = &
56 da_residual(n, k, y%gpsref(n)%ref(k), iv%gpsref(n)%ref(k), n_obs_bad%gpsref)
58 if (iv%gpsref(n)%ref(k)%qc >= obs_qc_pointer ) &
59 iv%gpsref(n)%ref(k)%inv = gpsref_org
64 np_missing = np_missing + n_obs_bad % gpsref % num % miss
65 np_bad_data = np_bad_data + n_obs_bad % gpsref % num % bad
66 np_obs_used = np_obs_used + n_obs_bad % gpsref % num % use
68 if (trace_use_dull) call da_trace_exit("da_residual_gpsref")
71 end subroutine da_residual_gpsref