da_transform_xtoy_ssmi_tb.inc

References to this file elsewhere.
1 subroutine da_transform_xtoy_ssmi_tb(xb, oi, xa, y)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    type (xb_type), intent(in)   :: xb       ! first guess state.
10    type (ob_type), intent(in)   :: oi       ! obs. increment vector (o-b).
11    type (x_type),  intent(inout):: xa       ! gridded analysis increment.
12    type (y_type), intent(inout) :: y        ! y = h (xa)
13 
14    integer                      :: n        ! loop counter.
15    integer                      :: i,j
16    real                         :: dx, dy, dxm, dym
17 
18    ! real, dimension(mix,mjy)     :: TGL_dotspeed
19    ! real, dimension(mix,mjy)     :: psfc,ta,gamma,sst,htpw,speed,alw,zcld,tpw
20    ! real, dimension(mix,mjy)     :: TGL_psfc,TGL_ta,TGL_gamma,TGL_sst,TGL_tpw
21    ! real, dimension(mix,mjy)     :: TGL_htpw,TGL_speed,TGL_alw,TGL_zcld         
22 
23    ! real, dimension(mix,mjy)     :: tb19v,tb19h, &
24    !                                  tb22v,       &
25    !                                  tb37v,tb37h, &
26    !                                  tb85v,tb85h
27 
28    ! real, dimension(mix,mjy)     :: TGL_tb19v,TGL_tb19h, &
29    !                                  TGL_tb22v,           &
30    !                                  TGL_tb37v,TGL_tb37h, &
31    !                                  TGL_tb85v,TGL_tb85h
32 
33    ! real, dimension(mkz)         :: zh
34    ! real, dimension(mkz+1)       :: zf
35    !----------------------------------------------------------------------------
36 
37    ! Wind at 1st level at dot points
38 
39    ! speed, surface wind speed (m/sec)    (0 - 30) , take 10 m wind
40 
41    ! total precipitable water in cm
42 
43    ! call da_transform_xtotpw(xa, xb)
44 
45    ! do j=1,mjy-1
46    !    do i=1,mix-1
47    !       zf(1) = xb%ztop
48    !       do k=1,mkz
49    !          zh(k)=xb%h(i,j,k)
50    !          zf(k+1)=xb%hf(i,j,k)
51    !       end do
52 
53    !       ! surface pressure (mb) (940 -1030)
54 
55    !       psfc(i,j)     = (xb%p(i,j,mkz)+xb%Psac(i,j)*(1.0-xb % sigmah(mkz)))*0.01
56    !       TGL_psfc(i,j) =  xa%p  (i,j,mkz)*0.01
57 
58    !       ! sea surface temperature (k) (273 - 303) (doesnot change) 
59 
60    !       sst(i,j)      = xb%tgrn(i,j)
61    !       TGL_sst(i,j)  = xa%tgrn(1,1)
62    !       TGL_sst(i,j)  = 0.
63 
64    !       ! effective surface air temperature (263 - 303)
65 
66    !       ta(i,j)     = xb%tgrn(i,j) + &
67    !                   (xb%t(i,j,mkz)-xb%tgrn(i,j))*log(2./0.0001)/ &
68    !                   log(zh(mkz)/0.0001)
69 
70    !       TGL_ta(i,j) = xa%tgrn(1,1) + &
71    !                   (xa%t(i,j,mkz)-xa%tgrn(1,1))*log(2./0.0001)/ &
72    !                   log(zh(mkz)/0.0001)
73 
74    !       TGL_ta(i,j) = (xa%t(i,j,mkz)-0.)*log(2./0.0001)/ &
75    !                   log(zh(mkz)/0.0001)
76 
77    !       ! gamma is an emperical formula and zcld is given for now
78 
79    !       gamma(i,j) = (ta(i,j)-270)*0.023 + 5.03  ! effective lapse rate   (km) (4.0 - 6.5)
80    !       zcld(i,j)  = 1                           ! effective cloud height (km)
81                                                      ! = 1 if no cloud infomation
82    !       TGL_gamma(i,j) = TGL_ta(i,j)*0.023
83    !       TGL_zcld(i,j)  = 0.
84 
85    !       ! total precipitable water in (kg/m**2) (0 - 70)
86 
87    !       tpw(i,j)     = xb%tpw(i,j)*10.
88    !       TGL_tpw(i,j) = xa%tpw(i,j)*10.
89 
90    !       ! Column liquid water (kg/m**2)   (0 - 0.5) (no data now. So, do it later.)
91 
92    !       alw(i,j)     = 0.
93    !       TGL_alw(i,j) = 0.
94 
95    !       ! Column height weighted moisture density on the grid locally 
96 
97    !       call da_transform_xtozrhoq(xb, i, j, zh, zf, zrhom)
98    !       call da_transform_xtozrhoq_lin(xb, xa, i, j, zh, zf, TGL_zrhom)
99 
100    !       ! Column moisture density on the grid locally
101 
102    !       htpw(i,j)     = zrhom/tpw(i,j)/1000.
103    !       TGL_htpw(i,j) = TGL_zrhom/tpw(i,j)/1000. &
104    !                   - TGL_tpw(i,j)/tpw(i,j)*htpw(i,j)
105 
106    !    end do
107    ! end do
108 
109    ! do j=1,mjy-1
110    !    do i=1,mix-1
111 
112    !       call tgl_tb(1,53.,psfc(i,j),ta(i,j),gamma(i,j),sst(i,j),tpw(i,j),  &
113    !          htpw(i,j),speed(i,j),alw(i,j),zcld(i,j),               &
114    !          xb%tb19v(i,j),xb%tb19h(i,j),                           &
115    !          TGL_psfc(i,j),TGL_ta(i,j),TGL_gamma(i,j),TGL_sst(i,j), &
116    !          TGL_tpw(i,j),TGL_htpw(i,j),TGL_speed(i,j),TGL_alw(i,j),&
117    !          TGL_zcld(i,j),TGL_tb19v(i,j),TGL_tb19h(i,j)           )
118 
119    !       call TGL_tb(2,53.,psfc(i,j),ta(i,j),gamma(i,j),sst(i,j),tpw(i,j),  &
120    !          htpw(i,j),speed(i,j),alw(i,j),zcld(i,j),               &
121    !          xb%tb22v(i,j),dum1,                                    &
122    !          TGL_psfc(i,j),TGL_ta(i,j),TGL_gamma(i,j),TGL_sst(i,j), &
123    !          TGL_tpw(i,j),TGL_htpw(i,j),TGL_speed(i,j),TGL_alw(i,j),&
124    !          TGL_zcld(i,j),TGL_tb22v(i,j),dum2                     )
125 
126    !       call TGL_tb(3,53.,psfc(i,j),ta(i,j),gamma(i,j),sst(i,j),tpw(i,j),  &
127    !          htpw(i,j),speed(i,j),alw(i,j),zcld(i,j),               &
128    !          xb%tb37v(i,j),xb%tb37h(i,j),                           &
129    !          TGL_psfc(i,j),TGL_ta(i,j),TGL_gamma(i,j),TGL_sst(i,j), &
130    !          TGL_tpw(i,j),TGL_htpw(i,j),TGL_speed(i,j),TGL_alw(i,j),&
131    !          TGL_zcld(i,j),TGL_tb37v(i,j),TGL_tb37h(i,j)           )
132 
133    !       call TGL_tb(4,53.,psfc(i,j),ta(i,j),gamma(i,j),sst(i,j),tpw(i,j),  &
134    !          htpw(i,j),speed(i,j),alw(i,j),zcld(i,j),               &
135    !          xb%tb85v(i,j),xb%tb85h(i,j),                           &
136    !          TGL_psfc(i,j),TGL_ta(i,j),TGL_gamma(i,j),TGL_sst(i,j), &
137    !          TGL_tpw(i,j),TGL_htpw(i,j),TGL_speed(i,j),TGL_alw(i,j),&
138    !          TGL_zcld(i,j),TGL_tb85v(i,j),TGL_tb85h(i,j)           )
139    !    end do
140    ! end do
141 
142    do n=1, oi % num_ssmi_tb
143       i = oi%ssmi_tb(n)%loc%i
144       j = oi%ssmi_tb(n)%loc%j
145       dx = oi%ssmi_tb(n)%loc%dx
146       dy = oi%ssmi_tb(n)%loc%dy
147       dxm = oi%ssmi_tb(n)%loc%dxm
148       dym = oi%ssmi_tb(n)%loc%dym
149 
150       ! Interpolating from 4 grid points to obs location
151 
152       ! if (xb%landmask(i,j ) .eq. 0 .and. xb%landmask(i+1,j ) .eq. 0 .and. &
153       !     xb%landmask(i,j+1) .eq. 0 .and. xb%landmask(i+1,j+1) .eq. 0) then       
154       !    ! only calculate over water
155 
156       call da_interp_lin_2d(xa%tb19v, xb%ims, xb%ime, xb%jms, xb%jme, &
157                          i, j, dx, dy, dxm, dym, y%ssmi_tb(n)%tb19v)
158       call da_interp_lin_2d(xa%tb19h, xb%ims, xb%ime, xb%jms, xb%jme, &
159                          i, j, dx, dy, dxm, dym, y%ssmi_tb(n)%tb19h)
160       call da_interp_lin_2d(xa%tb22v, xb%ims, xb%ime, xb%jms, xb%jme, &
161                          i, j, dx, dy, dxm, dym, y%ssmi_tb(n)%tb22v)
162       call da_interp_lin_2d(xa%tb37v, xb%ims, xb%ime, xb%jms, xb%jme, &
163                          i, j, dx, dy, dxm, dym, y%ssmi_tb(n)%tb37v)
164       call da_interp_lin_2d(xa%tb37h, xb%ims, xb%ime, xb%jms, xb%jme, &
165                          i, j, dx, dy, dxm, dym, y%ssmi_tb(n)%tb37h)
166       call da_interp_lin_2d(xa%tb85v, xb%ims, xb%ime, xb%jms, xb%jme, &
167                          i, j, dx, dy, dxm, dym, y%ssmi_tb(n)%tb85v)
168       call da_interp_lin_2d(xa%tb85h, xb%ims, xb%ime, xb%jms, xb%jme, &
169                          i, j, dx, dy, dxm, dym, y%ssmi_tb(n)%tb85h)
170       ! end if
171    end do
172     
173    ! WHY
174    !          y%ssmi_tb(n)%tb19v = hor_interp(dxm,dx,dym,dy, &
175    !              TGL_tb19v(i,j ),TGL_tb19v(i+1,j ), &
176    !              TGL_tb19v(i,j+1),TGL_tb19v(i+1,j+1) )
177 
178    !          y%ssmi_tb(n)%tb19h = hor_interp(dxm,dx,dym,dy, &
179    !              TGL_tb19h(i,j ),TGL_tb19h(i+1,j ), &
180    !              TGL_tb19h(i,j+1),TGL_tb19h(i+1,j+1) )
181 
182    !          y%ssmi_tb(n)%tb22v = hor_interp(dxm,dx,dym,dy, &
183    !              TGL_tb22v(i,j ),TGL_tb22v(i+1,j ), &
184    !              TGL_tb22v(i,j+1),TGL_tb22v(i+1,j+1) )
185 
186    !          y%ssmi_tb(n)%tb37v = hor_interp(dxm,dx,dym,dy, &
187    !              TGL_tb37v(i,j ),TGL_tb37v(i+1,j ), &
188    !              TGL_tb37v(i,j+1),TGL_tb37v(i+1,j+1) )
189 
190    !          y%ssmi_tb(n)%tb37h = hor_interp(dxm,dx,dym,dy, &
191    !              TGL_tb37h(i,j ),TGL_tb37h(i+1,j ), &
192    !              TGL_tb37h(i,j+1),TGL_tb37h(i+1,j+1) )
193 
194    !          y%ssmi_tb(n)%tb85v = hor_interp(dxm,dx,dym,dy, &
195    !              TGL_tb85v(i,j ),TGL_tb85v(i+1,j ), &
196    !              TGL_tb85v(i,j+1),TGL_tb85v(i+1,j+1) )
197 
198    !          y%ssmi_tb(n)%tb85h = hor_interp(dxm,dx,dym,dy, &
199    !              TGL_tb85h(i,j ),TGL_tb85h(i+1,j ), &
200    !              TGL_tb85h(i,j+1),TGL_tb85h(i+1,j+1) )
201    !       end if
202    !    end if
203 
204    ! end do
205 
206 end subroutine da_transform_xtoy_ssmi_tb
207 
208