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

function da_residual(n, k, yy, ox, n_bad) result (rr) 86,2

   !-----------------------------------------------------------------------
   ! Purpose: TBD
   !-----------------------------------------------------------------------

   implicit none

   integer,              intent(in)    :: n, k
   type (field_type),    intent(in)    :: ox
   real,                 intent(in)    :: yy
   type (bad_info_type), intent(inout) :: n_bad

   real :: rr

   if (trace_use_frequent) call da_trace_entry("da_residual")

   ! WHY?
   if (k ==0 .OR. n==0) then
   end if

   rr = 0.0

   if (ox % qc &gt;= obs_qc_pointer) then
      ! WHY?
      ! n_bad % num % use = n_bad % num % use + 1
      rr = ox % inv - yy
      ! else
      !    if (ox % qc /= -88) then
      !       n_bad % num % bad = n_bad % num % bad + 1
      !       n_bad % nn(n_bad % num % bad) = n
      !       n_bad % kk(n_bad % num % bad) = k
      !     else
      !       n_bad % num % miss = n_bad % num % miss + 1
      !    end if
   end if

   if (trace_use_frequent) call da_trace_exit("da_residual")

end function da_residual