Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / da / da_airsr / da_check_max_iv_airsr.inc
blob925b8d1d92b905cedbaf71c83dcb077a66257156
1 subroutine da_check_max_iv_airsr(iv, it,num_qcstat_conv)     
3    !-------------------------------------------------------------------------
4    ! Purpose: Applies max error check on AIRS retrievals
5    ! Update:
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    !-------------------------------------------------------------------------
10    implicit none
12    type(iv_type), intent(inout) :: iv
13    integer,       intent(in)    :: it      ! Outer iteration
14    integer,       intent(inout) :: num_qcstat_conv(:,:,:,:)
16    integer :: k,n, ipr
17    logical :: failed
18    
19    if (trace_use_dull) call da_trace_entry("da_check_max_iv_airsr")
21    !---------------------------------------------------------------------------
22    ! [1.0] Perform maximum innovation vector check:
23    !---------------------------------------------------------------------------
25    do n=iv%info(airsr)%n1,iv%info(airsr)%n2
26       do k = 1, iv%info(airsr)%levels(n)
27         call da_get_print_lvl(iv%airsr(n)%p(k),ipr)
28         failed = .false.
29         if( iv%airsr(n)%t(k)%qc >= obs_qc_pointer ) then 
30          call da_max_error_qc (it,iv%info(airsr), n, iv%airsr(n)%t(k), max_error_t ,failed)
31         if( iv%info(airsr)%proc_domain(k,n) ) then
32           num_qcstat_conv(1,airsr,3,ipr) = num_qcstat_conv(1,airsr,3,ipr) + 1
33          if(failed)then
34           num_qcstat_conv(2,airsr,3,ipr) = num_qcstat_conv(2,airsr,3,ipr) + 1
35         if ( write_rej_obs_conv ) then
36         write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
37         'airsr',ob_vars(3),iv%info(airsr)%lat(k,n),iv%info(airsr)%lon(k,n),0.01*iv%airsr(n)%p(k)
38         end if
39          endif
40         endif
41         endif
43         failed = .false.
44         if( iv%airsr(n)%q(k)%qc >= obs_qc_pointer ) then 
45          call da_max_error_qc (it,iv%info(airsr), n, iv%airsr(n)%q(k), max_error_q ,failed)
46          if( iv%info(airsr)%proc_domain(k,n) ) then
47            num_qcstat_conv(1,airsr,4,ipr) = num_qcstat_conv(1,airsr,4,ipr) + 1
48          if(failed)then
49           num_qcstat_conv(2,airsr,4,ipr) = num_qcstat_conv(2,airsr,4,ipr) + 1
50         if ( write_rej_obs_conv ) then
51         write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
52         'airsr',ob_vars(4),iv%info(airsr)%lat(k,n),iv%info(airsr)%lon(k,n),0.01*iv%airsr(n)%p(k)
53         end if
54          endif
55         endif
56         endif
57       end do
58    end do
59    
60    if (trace_use_dull) call da_trace_exit("da_check_max_iv_airsr")
61 end subroutine da_check_max_iv_airsr