da_add_noise.inc

References to this file elsewhere.
1 subroutine da_add_noise (fld, yo, z)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    type (field_type), intent(inout) :: fld     ! O-B sub-type.
10    real, intent(inout)              :: yo      ! Observation.
11    real, intent(out)                :: z       ! Random number.
12 
13    real                             :: noise
14 
15    if (trace_use) call da_trace_entry("da_add_noise")
16 
17    z = missing_r
18 
19    if (fld % qc >= obs_qc_pointer) then
20       ! [1] Calculate scaled Gaussian noise:
21 
22       call da_gauss_noise (z)      
23       noise = fld % error * z
24       
25       ! [3] Recalculate corresponding O and O-B:
26       yo = yo + noise
27       fld % inv = fld % inv + noise
28    end if
29 
30    if (trace_use) call da_trace_exit("da_add_noise")
31 
32 end subroutine da_add_noise
33 
34