1 subroutine da_transform_xtoy_lightning (grid, iv, y)
3 !-----------------------------------------------------------------------
4 ! Authors: Z Chen (zchen@fjnu.edu.cn), Jenny Sun (NCAR), X Qie (IAP)
5 !-----------------------------------------------------------------------
9 type (domain), intent(in) :: grid
10 type (iv_type), intent(in) :: iv ! Innovation vector (O-B).
11 type (y_type), intent(inout) :: y ! y = h (grid%xa)
13 integer :: n ! Loop counter.
14 integer :: i, j, k ! Index dimension.
17 integer :: num_levs ! obs vertical levels
19 real :: div(kts:kte) !Model divergence at ob loc
20 real :: ave_div(kts:kte) !Model averaged divergence at ob loc
21 real :: model_q(kts:kte) !Model Q at ob loc
22 real :: model_t(kts:kte) !Model T at ob loc
24 real :: TGL_div(kts:kte)
25 real :: TGL_model_q(kts:kte)
27 if (trace_use_dull) call da_trace_entry("da_transform_xtoy_lightning")
29 do n = iv%info(lightning)%n1, iv%info(lightning)%n2
31 num_levs = iv%info(lightning)%levels(n)
33 ! [1.0] Get horizontal interpolation weights:
35 i = iv%info(lightning)%i(1,n)
36 dy = iv%info(lightning)%dy(1,n)
37 dym = iv%info(lightning)%dym(1,n)
38 j = iv%info(lightning)%j(1,n)
39 dx = iv%info(lightning)%dx(1,n)
40 dxm = iv%info(lightning)%dxm(1,n)
45 if(use_lightning_w) then
46 if(iv%lightning(n)%w(k)%qc == missing_data) then
47 y%lightning(n)%w(k) = 0.0
49 y%lightning(n)%w(k) = grid%xa%w(i,j,k)
53 if(use_lightning_div) then
54 if(iv%lightning(n)%div(k)%qc == missing_data) then
55 y%lightning(n)%div(k) = 0.0
57 call da_div_profile_tl(grid, iv%info(lightning), n, k, TGL_div(k)) ! divergence profile
58 y%lightning(n)%div(k) = TGL_div(k)
62 if(use_lightning_qv) then
63 if(iv%lightning(n)%qv(k)%qc == missing_data) then
64 y%lightning(n)%qv(k) = 0.0
66 y%lightning(n)%qv(k) = grid%xa%q(i,j,k)
67 y%lightning(n)%qv(k) = y%lightning(n)%qv(k) + (17.67*243.5/(grid%xb%t(i,j,k)+243.5)**2.0)*grid%xb%q(i,j,k)*grid%xa%t(i,j,k)
73 if (trace_use_dull) call da_trace_exit("da_transform_xtoy_lightning")
75 end subroutine da_transform_xtoy_lightning