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 (trace_use_frequent) call da_trace_entry("da_get_q_error")
24
25 if (ABS(p - missing_r) > 1.0 .AND. ABS(t - missing_r) > 1.0 .AND. ABS(q - missing_r) > 1) then
26 ! Calculate rh:
27 call da_tp_to_qs( t, p, es, qs)
28
29 rh = 100.0 * q / qs
30 if (rh > 100.0) rh = 100.0
31
32 ! Get observation error for qv. Is this right?
33 q_error = f_qv_from_rh( rh_error, t_error, rh, t, p)
34 else
35 q_error = missing_r
36 end if
37
38 if (q_error == 0.0) q_error = missing_r
39
40 if (trace_use_frequent) call da_trace_exit("da_get_q_error")
41
42 end subroutine da_get_q_error
43
44