1 subroutine da_check_max_iv_sound(iv, it,num_qcstat_conv)
3 !-----------------------------------------------------------------------
6 ! Removed Outerloop check as it is done in da_get_innov
7 ! Author: Syed RH Rizvi, MMM/NESL/NCAR, Date: 07/12/2009
8 !-----------------------------------------------------------------------
12 type(iv_type), intent(inout) :: iv
13 integer, intent(in) :: it ! Outer iteration
14 integer, intent(inout) :: num_qcstat_conv(:,:,:,:)
17 logical :: failed,failed1,failed2
19 if (trace_use_dull) call da_trace_entry("da_check_max_iv_sound")
21 !---------------------------------------------------------------------------
22 ! [1.0] Perform maximum innovation vector check:
23 !---------------------------------------------------------------------------
25 do n = iv%info(sound)%n1,iv%info(sound)%n2
26 do k = 1, iv%info(sound)%levels(n)
27 call da_get_print_lvl(iv%sound(n)%p(k),ipr)
29 if(.not. qc_rej_both)then
32 if( iv%sound(n)%u(k)%qc >= obs_qc_pointer ) then
33 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%u(k), max_error_spd,failed)
34 if( iv%info(sound)%proc_domain(k,n) ) then
35 num_qcstat_conv(1,sound,1,ipr) = num_qcstat_conv(1,sound,1,ipr) + 1
37 num_qcstat_conv(2,sound,1,ipr) = num_qcstat_conv(2,sound,1,ipr) + 1
38 if ( write_rej_obs_conv ) then
39 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
40 'sound',ob_vars(1),iv%info(sound)%lat(k,n),iv%info(sound)%lon(k,n),0.01*iv%sound(n)%p(k)
47 if( iv%sound(n)%v(k)%qc >= obs_qc_pointer ) then
48 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%v(k), max_error_dir,failed)
49 if( iv%info(sound)%proc_domain(k,n) ) then
50 num_qcstat_conv(1,sound,2,ipr) = num_qcstat_conv(1,sound,2,ipr) + 1
52 num_qcstat_conv(2,sound,2,ipr) = num_qcstat_conv(2,sound,2,ipr) + 1
53 if ( write_rej_obs_conv ) then
54 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
55 'sound',ob_vars(2),iv%info(sound)%lat(k,n),iv%info(sound)%lon(k,n),0.01*iv%sound(n)%p(k)
62 if( iv%sound(n)%u(k)%qc >= obs_qc_pointer ) then
63 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%u(k), max_error_uv,failed)
64 if( iv%info(sound)%proc_domain(k,n) ) then
65 num_qcstat_conv(1,sound,1,ipr) = num_qcstat_conv(1,sound,1,ipr) + 1
67 num_qcstat_conv(2,sound,1,ipr) = num_qcstat_conv(2,sound,1,ipr) + 1
68 if ( write_rej_obs_conv ) then
69 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
70 'sound',ob_vars(1),iv%info(sound)%lat(k,n),iv%info(sound)%lon(k,n),0.01*iv%sound(n)%p(k)
77 if( iv%sound(n)%v(k)%qc >= obs_qc_pointer ) then
78 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%v(k), max_error_uv,failed)
79 if( iv%info(sound)%proc_domain(k,n) ) then
80 num_qcstat_conv(1,sound,2,ipr) = num_qcstat_conv(1,sound,2,ipr) + 1
82 num_qcstat_conv(2,sound,2,ipr) = num_qcstat_conv(2,sound,2,ipr) + 1
83 if ( write_rej_obs_conv ) then
84 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
85 'sound',ob_vars(2),iv%info(sound)%lat(k,n),iv%info(sound)%lon(k,n),0.01*iv%sound(n)%p(k)
93 if(iv%sound(n)%u(k)%qc == fails_error_max .or. abs(iv%sound(n)%u(k)%inv) >= max_omb_spd) then
94 iv%sound(n)%u(k)%qc = fails_error_max
95 iv%sound(n)%u(k)%inv = 0.0
97 if(iv%sound(n)%v(k)%qc == fails_error_max .or. abs(iv%sound(n)%v(k)%inv) >= max_omb_dir) then
98 iv%sound(n)%v(k)%qc = fails_error_max
99 iv%sound(n)%v(k)%inv = 0.0
106 if( iv%sound(n)%v(k)%qc >= obs_qc_pointer .or. iv%sound(n)%u(k)%qc >= obs_qc_pointer ) then
107 if(wind_sd_sound)then
108 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%u(k), max_error_spd,failed1)
109 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%v(k), max_error_dir,failed2)
111 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%u(k), max_error_uv,failed1)
112 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%v(k), max_error_uv,failed2)
116 if( iv%info(sound)%proc_domain(k,n) ) then
117 num_qcstat_conv(1,sound,1,ipr) = num_qcstat_conv(1,sound,1,ipr) + 1
118 num_qcstat_conv(1,sound,2,ipr) = num_qcstat_conv(1,sound,2,ipr) + 1
120 if(failed1 .or. failed2) then
121 num_qcstat_conv(2,sound,1,ipr) = num_qcstat_conv(2,sound,1,ipr) + 1
122 if ( write_rej_obs_conv ) then
123 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
124 'sound',ob_vars(1),iv%info(sound)%lat(k,n),iv%info(sound)%lon(k,n),0.01*iv%sound(n)%p(k)
126 num_qcstat_conv(2,sound,2,ipr) = num_qcstat_conv(2,sound,2,ipr) + 1
127 if ( write_rej_obs_conv ) then
128 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
129 'sound',ob_vars(2),iv%info(sound)%lat(k,n),iv%info(sound)%lon(k,n),0.01*iv%sound(n)%p(k)
134 if(wind_sd_sound)then
135 if(iv%sound(n)%u(k)%qc == fails_error_max .or. iv%sound(n)%v(k)%qc == fails_error_max .or. &
136 abs(iv%sound(n)%v(k)%inv) >= max_omb_dir .or. abs(iv%sound(n)%u(k)%inv) >= max_omb_spd )then
137 iv%sound(n)%u(k)%qc = fails_error_max
138 iv%sound(n)%v(k)%qc = fails_error_max
139 iv%sound(n)%u(k)%inv = 0.0
140 iv%sound(n)%v(k)%inv = 0.0
143 if(iv%sound(n)%u(k)%qc == fails_error_max .or. iv%sound(n)%v(k)%qc == fails_error_max ) then
144 iv%sound(n)%u(k)%qc = fails_error_max
145 iv%sound(n)%v(k)%qc = fails_error_max
146 iv%sound(n)%u(k)%inv = 0.0
147 iv%sound(n)%v(k)%inv = 0.0
154 if( iv%sound(n)%t(k)%qc >= obs_qc_pointer ) then
155 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%t(k), max_error_t ,failed)
156 if( iv%info(sound)%proc_domain(k,n) ) then
157 num_qcstat_conv(1,sound,3,ipr) = num_qcstat_conv(1,sound,3,ipr) + 1
159 num_qcstat_conv(2,sound,3,ipr) = num_qcstat_conv(2,sound,3,ipr) + 1
160 if ( write_rej_obs_conv ) then
161 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
162 'sound',ob_vars(3),iv%info(sound)%lat(k,n),iv%info(sound)%lon(k,n),0.01*iv%sound(n)%p(k)
169 if( iv%sound(n)%q(k)%qc >= obs_qc_pointer ) then
170 if( iv%sound(n)%t(k)%qc == fails_error_max ) then
172 iv%sound(n)%q(k)%qc = fails_error_max
173 iv%sound(n)%q(k)%inv = 0.0
175 call da_max_error_qc (it,iv%info(sound), n, iv%sound(n)%q(k), max_error_q ,failed)
177 if( iv%info(sound)%proc_domain(k,n) ) then
178 num_qcstat_conv(1,sound,4,ipr) = num_qcstat_conv(1,sound,4,ipr) + 1
180 num_qcstat_conv(2,sound,4,ipr) = num_qcstat_conv(2,sound,4,ipr) + 1
181 if ( write_rej_obs_conv ) then
182 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
183 'sound',ob_vars(4),iv%info(sound)%lat(k,n),iv%info(sound)%lon(k,n),0.01*iv%sound(n)%p(k)
192 if (trace_use_dull) call da_trace_exit("da_check_max_iv_sound")
194 end subroutine da_check_max_iv_sound