da_get_q_error.inc
References to this file elsewhere.
1 subroutine da_get_q_error( p, t, q, t_error, rh_error, q_error)
2
3 !-----------------------------------------------------------------------
4 ! Purpose: TBD
5 !-----------------------------------------------------------------------
6
7 implicit none
8
9 real, intent(in) :: p ! Observed pressure.
10 real, intent(in) :: t ! Observed temperature.
11 real, intent(in) :: q ! Observed specific humidity.
12 real, intent(in) :: t_error ! Temperature observation error.
13 real, intent(in) :: rh_error ! RH observation error.
14 real, intent(out) :: q_error ! q observation error.
15
16 real :: es ! Saturation vapor pressure.
17 real :: qs ! Saturation specific humidity.
18 real :: rh ! Relative humidity.
19
20 real :: f_qv_from_rh
21 external f_qv_from_rh
22
23 if (ABS(p - missing_r) > 1.0 .AND. ABS(t - missing_r) > 1.0 .AND. &
24 ABS(q - missing_r) > 1) then
25
26 ! Calculate rh:
27
28 call da_tp_to_qs( t, p, es, qs)
29
30 rh = 100.0 * q / qs
31 if (rh > 100.0) rh = 100.0
32
33 ! Get observation error for qv. Is this right?
34
35 q_error = f_qv_from_rh( rh_error, t_error, rh, t, p)
36
37 else
38 q_error = missing_r
39 end if
40
41 if (q_error == 0.0) q_error = missing_r
42
43 end subroutine da_get_q_error
44
45