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

subroutine da_add_noise (fld, yo, z) 77,3

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

   implicit none

   type (field_type), intent(inout) :: fld     ! O-B sub-type.
   real, intent(inout)              :: yo      ! Observation.
   real, intent(out)                :: z       ! Random number.

   real                             :: noise

   if (trace_use) call da_trace_entry("da_add_noise")

   z = missing_r

   if (fld % qc &gt;= obs_qc_pointer) then
      ! [1] Calculate scaled Gaussian noise:

      call da_gauss_noise (z)      
      noise = fld % error * z
      
      ! [3] Recalculate corresponding O and O-B:
      yo = yo + noise
      fld % inv = fld % inv + noise
   end if

   if (trace_use) call da_trace_exit("da_add_noise")

end subroutine da_add_noise