1 subroutine da_residual_gpseph(iv, y, re, np_missing, np_bad_data, np_obs_used, np_available)
3 !-----------------------------------------------------------------------
4 ! Purpose: Calculate residiual for gpseph 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_gpseph")
26 ! Assuming the highest latitude is 90.0 degree:
27 constant0= sin(radian * 90.0)
29 n_obs_bad % gpseph % num = number_type(0, 0, 0)
31 do n=1, iv%info(gpseph)%nlocal
32 do k=1, iv%info(gpseph)%levels(n)
33 np_available = np_available + 1
35 ! Weighted the GPSEPH innovation with the latitude:
36 if (iv%gpseph(n)%eph(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%gpseph(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(gpseph)%lat(k,n)
47 weight2 = abs(sin(radian * g_lat) / constant0)
48 ! not depend on the latitude:
51 gpseph_org = iv%gpseph(n)%eph(k)%inv
52 iv%gpseph(n)%eph(k)%inv = gpseph_org * weight1 * weight2
54 !.............................................................
55 if (iv%gpseph(n)%eph(k)%qc >= obs_qc_pointer ) then
56 re%gpseph(n)%eph(k) = &
57 da_residual(n, k, y%gpseph(n)%eph(k), iv%gpseph(n)%eph(k), n_obs_bad%gpseph)
60 if (iv%gpseph(n)%eph(k)%qc >= obs_qc_pointer ) &
61 iv%gpseph(n)%eph(k)%inv = gpseph_org
66 np_missing = np_missing + n_obs_bad % gpseph % num % miss
67 np_bad_data = np_bad_data + n_obs_bad % gpseph % num % bad
68 np_obs_used = np_obs_used + n_obs_bad % gpseph % num % use
70 if (trace_use_dull) call da_trace_exit("da_residual_gpseph")
72 end subroutine da_residual_gpseph