Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_sound / da_calculate_grady_sound.inc
blob67e8a17fcebbbcfe2da2e8a6e2039707c592d225
1 subroutine da_calculate_grady_sound(iv, re, jo_grad_y)
3    !-------------------------------------------------------------------------
4    ! Purpose: Applies obs inverse on re-vector
5    !-------------------------------------------------------------------------
7    implicit none
9    type (iv_type), intent(in)     :: iv          ! Innovation vector.
10    type (y_type),  intent(inout)  :: re          ! Residual vector.
11    type (y_type),  intent(inout)  :: jo_grad_y   ! Grad_y(Jo)
13    integer                      :: n, k
15    if (trace_use_dull) call da_trace_entry("da_calculate_grady_sound")
17    do n=1, iv%info(sound)%nlocal
18       do k=1, iv%info(sound)%levels(n)
19          if (iv%sound(n)%u(k)%qc < obs_qc_pointer) re%sound(n)%u(k) = 0.0
20          if (iv%sound(n)%v(k)%qc < obs_qc_pointer) re%sound(n)%v(k) = 0.0
21          if (iv%sound(n)%t(k)%qc < obs_qc_pointer) re%sound(n)%t(k) = 0.0
22          if (iv%sound(n)%q(k)%qc < obs_qc_pointer) re%sound(n)%q(k) = 0.0
24          jo_grad_y%sound(n)%u(k) = -re%sound(n)%u(k) / (iv%sound(n)%u(k)%error * iv%sound(n)%u(k)%error)
25          jo_grad_y%sound(n)%v(k) = -re%sound(n)%v(k) / (iv%sound(n)%v(k)%error * iv%sound(n)%v(k)%error)
26          jo_grad_y%sound(n)%t(k) = -re%sound(n)%t(k) / (iv%sound(n)%t(k)%error * iv%sound(n)%t(k)%error)
27          jo_grad_y%sound(n)%q(k) = -re%sound(n)%q(k) / (iv%sound(n)%q(k)%error * iv%sound(n)%q(k)%error)
28       end do
29    end do
31    if (trace_use_dull) call da_trace_exit("da_calculate_grady_sound")
33 end subroutine da_calculate_grady_sound