Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_chem_sfc / da_check_max_iv_chem_sfc.inc
blob9b849d8c820241f79dd64af92f5556fa72a9f45d
1 subroutine da_check_max_iv_chem_sfc(iv,ob, it, num_qcstat_conv)
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    ! Update:
6    !    Removed Outerloop check as it is done in da_get_innov
7    !-----------------------------------------------------------------------
9    implicit none
11    type(iv_type), intent(inout) :: iv
12    integer,       intent(in)    :: it      ! Outer iteration 
13    integer,       intent(inout) :: num_qcstat_conv(:,:,:,:)
14    type(y_type),  intent(in)    :: ob      ! Observation structure.
16    logical :: failed 
17    integer :: n, ichem
18    
19    if (trace_use) call da_trace_entry("da_check_max_iv_chem_sfc")       
22    !---------------------------------------------------------------------------
23    ! [1.0] Perform maximum innovation vector check:
24    !---------------------------------------------------------------------------
26    do ichem = num_chemic_surf, num_chemic_surf
27    do n=iv%info(chemic_surf)%n1,iv%info(chemic_surf)%n2
28       failed=.false.
29       if ( iv%chemic_surf(n)%chem(ichem)%qc >= obs_qc_pointer ) then 
30          call da_max_error_qc (it, iv%info(chemic_surf), n, iv%chemic_surf(n)%chem(ichem), max_error_chemic_surf, failed)
31          if ( iv%info(chemic_surf)%proc_domain(1,n) ) then
32             num_qcstat_conv(1,chemic_surf,10,1)= num_qcstat_conv(1,chemic_surf,10,1) + 1
33             if (failed) then
34                num_qcstat_conv(2,chemic_surf,10,1)= num_qcstat_conv(2,chemic_surf,10,1) + 1
35                write(qcstat_conv_unit,'(2x,a10,2x,a4,2f12.2,a12)')&
36                   'Rainfall','Rain',iv%info(chemic_surf)%lat(1,n),iv%info(chemic_surf)%lon(1,n),'-8888.88'   
37             end if
38          end if
39       end if
40    end do
41    end do
43    if (trace_use) call da_trace_exit("da_check_max_iv_chem_sfc")       
45 end subroutine da_check_max_iv_chem_sfc