da_get_innov_vector_profiler.inc
References to this file elsewhere.
1 subroutine da_get_innov_vector_profiler( it, xb, xp, ob, iv)
2
3 !-----------------------------------------------------------------------
4 ! Purpose: TBD
5 ! Update :
6 ! 01/24/2007 Syed RH Rizvi
7 ! Updated for "VERIFY"
8 !-----------------------------------------------------------------------
9
10 implicit none
11
12 integer, intent(in) :: it ! External iteration.
13 type(xb_type), intent(in) :: xb ! first guess state.
14 type(xpose_type), intent(in) :: xp ! Domain decomposition vars.
15 type(y_type), intent(inout) :: ob ! Observation structure.
16 type(ob_type), intent(inout) :: iv ! O-B structure.
17
18 integer :: n ! Loop counter.
19 integer :: i, j, k ! Index dimension.
20 integer :: num_levs ! Number of obs levels.
21
22 real :: dx, dxm ! Interpolation weights.
23 real :: dy, dym ! Interpolation weights.
24
25 real, dimension(1:max_ob_levels) :: model_u ! Model value u at ob location.
26 real, dimension(1:max_ob_levels) :: model_v ! Model value v at ob location.
27
28 real, dimension(xp%kms:xp%kme) :: v_p ! Model value p at ob hor. location.
29 integer :: itu,ituf,itvv,itvvf
30
31 if (iv % num_profiler < 1) return
32
33 if (trace_use) call da_trace_entry("da_get_innov_vector_profiler")
34
35
36 itu = 0; itvv = 0;
37 ituf = 0; itvvf = 0;
38
39 do n=iv%ob_numb(iv%current_ob_time-1)%profiler + 1, &
40 iv%ob_numb(iv%current_ob_time)%profiler
41
42 num_levs = iv % profiler(n) % info % levels
43
44 if (num_levs < 1) cycle
45
46 model_u(:) = 0.0
47 model_v(:) = 0.0
48
49 ! [1.3] Get horizontal interpolation weights:
50
51 i = iv%profiler(n)%loc%i
52 j = iv%profiler(n)%loc%j
53 dx = iv%profiler(n)%loc%dx
54 dy = iv%profiler(n)%loc%dy
55 dxm = iv%profiler(n)%loc%dxm
56 dym = iv%profiler(n)%loc%dym
57
58 do k=xp%kts,xp%kte
59 v_p(k) = dym*(dxm*xb%p(i,j ,k) + dx*xb%p(i+1,j ,k)) &
60 + dy *(dxm*xb%p(i,j+1,k) + dx*xb%p(i+1,j+1,k))
61 end do
62
63 do k=1, iv % profiler(n) % info % levels
64 iv%profiler(n)%zk(k)=missing_r
65
66 if (iv % profiler(n) % p(k) > 1.0) then
67 call da_to_zk(iv % profiler(n) % p(k), v_p, xp, v_interp_p, iv%profiler(n)%zk(k))
68 end if
69
70 if (iv%profiler(n)%zk(k) < 0.0 .and. .not.anal_type_verify) then
71 iv % profiler(n) % u(k) % qc = missing
72 iv % profiler(n) % v(k) % qc = missing
73 end if
74 end do
75
76 ! [1.4] Interpolate horizontally:
77 call da_interp_lin_3d( xb % u, xp, i, j, dx, dy, dxm, dym, &
78 model_u, max_ob_levels, iv%profiler(n)%zk, num_levs)
79 call da_interp_lin_3d( xb % v, xp, i, j, dx, dy, dxm, dym, &
80 model_v, max_ob_levels, iv%profiler(n)%zk, num_levs)
81
82 !------------------------------------------------------------------------
83 ! [2.0] Initialise components of innovation vector:
84 !------------------------------------------------------------------------
85
86 do k = 1, iv % profiler(n) % info % levels
87 iv % profiler(n) % u(k) % inv = 0.0
88 iv % profiler(n) % v(k) % inv = 0.0
89
90 !----------------------------------------------------------------
91 ! [4.0] Fast interpolation:
92 !----------------------------------------------------------------
93
94 if (ob % profiler(n) % u(k) > missing_r .AND. &
95 iv % profiler(n) % u(k) % qc >= obs_qc_pointer) then
96
97 iv % profiler(n) % u(k) % inv = ob % profiler(n) % u(k) - &
98 model_u(k)
99 end if
100
101 if (ob % profiler(n) % v(k) > missing_r .AND. &
102 iv % profiler(n) % v(k) % qc >= obs_qc_pointer) then
103
104 iv % profiler(n) % v(k) % inv = ob % profiler(n) % v(k) - &
105 model_v(k)
106 end if
107 end do
108
109 !------------------------------------------------------------------
110 ! [5.0] Perform optional maximum error check:
111 !------------------------------------------------------------------
112
113 if (check_max_iv) then
114 call da_check_max_iv_profiler(it, iv % profiler(n), &
115 itu,ituf,itvv,itvvf)
116 end if
117 end do
118
119 if (rootproc .and. check_max_iv_print) then
120 write(unit = check_max_iv_unit, fmt ='(A,i5,A)')&
121 'For outer iteration ',it, ', Total Rejections for Profiler follows:'
122 write(unit = check_max_iv_unit, fmt = '(/,10(2(A,I6),/))') &
123 'Number of failed u-wind observations: ',ituf, ' on ',itu, &
124 'Number of failed v-wind observations: ',itvvf,' on ',itvv, &
125 'Finally Total Profiler rejections ',ituf+itvvf,' on ',itu +itvv
126 end if
127
128 if (trace_use) call da_trace_exit("da_get_innov_vector_profiler")
129
130 end subroutine da_get_innov_vector_profiler
131
132