<HTML> <BODY BGCOLOR=#ccccdd LINK=#0000aa VLINK=#0000ff ALINK=#ff0000 ><BASE TARGET="bottom_target"><PRE>
<A NAME='DA_CALCULATE_GRADY_POLARAMV'><A href='../../html_code/polaramv/da_calculate_grady_polaramv.inc.html#DA_CALCULATE_GRADY_POLARAMV' TARGET='top_target'><IMG SRC="../../gif/bar_red.gif" border=0></A>

subroutine da_calculate_grady_polaramv(iv, re, jo_grad_y) 1,2

   !-------------------------------------------------------------------------
   ! Purpose: Calculates Gradient of Polar AMVs  Obs.          
   !-------------------------------------------------------------------------

   implicit none


   type (iv_type), intent(in)     :: iv          ! Innovation vector.
   type (y_type),  intent(inout)  :: re          ! Residual vector.
   type (y_type),  intent(inout)  :: jo_grad_y   ! Grad_y(Jo)

   integer :: n , k
   
   if (trace_use_dull) call da_trace_entry("da_calculate_grady_polaramv")

   do n=1, iv%info(polaramv)%nlocal
      do k=1, iv%info(polaramv)%levels(n)
         if (iv%polaramv(n)%u(k)%qc &lt; obs_qc_pointer) then
            re%polaramv(n)%u(k) = 0.0
         end if
         if (iv%polaramv(n)%v(k)%qc &lt; obs_qc_pointer) then
            re%polaramv(n)%v(k) = 0.0
         end if

         jo_grad_y%polaramv(n)%u(k) = -re%polaramv(n)%u(k) / &amp;
             (iv%polaramv(n)%u(k)%error * iv%polaramv(n)%u(k)%error)
         jo_grad_y%polaramv(n)%v(k) = -re%polaramv(n)%v(k) / &amp;
            (iv%polaramv(n)%v(k)%error * iv%polaramv(n)%v(k)%error)
      end do
   end do
   
   if (trace_use_dull) call da_trace_exit("da_calculate_grady_polaramv")

end subroutine da_calculate_grady_polaramv