12 use fckit_log_module,
only: fckit_log
13 use kinds,
only: kind_real
16 use typesizes,
only: wp => eightbytereal
17 use datetimetypes,
only: dp
18 use ropp_fm_types,
only: state1dfm, obs1dbangle
19 use geodesy,
only: gravity, r_eff, geometric2geopotential
20 use arrays,
only: callocate
36 subroutine init_ropp_1d_statevec(step_time,rlon,rlat, temp,shum,pres,phi,lm,phi_sfc,x, iflip)
55 type(state1dfm),
intent(out) :: x
56 real(kind=dp),
intent(in) :: step_time
57 real(kind=kind_real),
intent(in) :: rlat, rlon
58 real(kind=kind_real),
intent(in) :: phi_sfc
59 integer,
intent(in) :: lm
60 real(kind=kind_real),
dimension(lm),
intent(in) :: temp,shum,pres,phi
63 character(len=250) :: record
64 real(kind=kind_real) :: rlon_local
66 integer,
optional,
intent(in) :: iflip
68 x%direct_ion = .false.
70 x%new_bangle_op = .true.
73 x%lat = real(rlat,kind=wp)
75 if (rlon_local .gt. 180) rlon_local = rlon_local - 360.
76 x%lon = real(rlon_local,kind=wp)
77 x%time = real(step_time, kind=wp)
87 if (
associated(x%temp))
deallocate(x%temp)
88 if (
associated(x%shum))
deallocate(x%shum)
89 if (
associated(x%pres))
deallocate(x%pres)
90 if (
associated(x%geop))
deallocate(x%geop)
92 allocate(x%temp(x%n_lev))
93 allocate(x%shum(x%n_lev))
94 allocate(x%pres(x%n_lev))
95 allocate(x%geop(x%n_lev))
100 write(record,
'(4a9,a11)')
'lvl',
'temp',
'shum',
'pres',
'geop'
103 if (
present(iflip) .and. iflip .eq. 1)
then
105 x%temp(n) = real(temp(k),kind=wp)
106 x%shum(n) = real(shum(k),kind=wp)
107 x%pres(n) = real(pres(k),kind=wp)
108 x%geop(n) = real(phi(k),kind=wp)
113 x%temp(k) = real(temp(k),kind=wp)
114 x%shum(k) = real(shum(k),kind=wp)
115 x%pres(k) = real(pres(k),kind=wp)
116 x%geop(k) = real(phi(k),kind=wp)
121 x%geop_sfc = real(phi_sfc,kind=wp)
122 write(record,
'("geop_sfc",f15.2)') x%geop_sfc
135 if (
associated(x%cov%d))
deallocate(x%cov%d)
136 call callocate(x%cov%d, n*(n+1)/2)
139 x%cov%d(i + i*(i-1)/2) = 1.0_wp
144 x%cov%d(j + j*(j-1)/2) = 1.0_wp
147 x%cov%d(n + n*(n-1)/2) = 1.0_wp
152 if (
associated(x%cov%e))
deallocate(x%cov%e)
153 if (
associated(x%cov%f))
deallocate(x%cov%f)
154 if (
associated(x%cov%s))
deallocate(x%cov%s)
156 x%cov%fact_chol = .false.
157 x%cov%equi_chol =
'N'
184 type(state1dfm),
intent(inout) :: x_ad
185 integer,
intent(in) :: lm
186 real(kind=kind_real),
dimension(lm),
intent(inout) :: temp_d,shum_d,pres_d,phi_d
190 integer,
optional,
intent(in) :: iflip
195 if (
present(iflip) .and. iflip .eq. 1)
then
199 temp_d(k) = temp_d(k) + real(x_ad%temp(n),kind=kind_real)
200 x_ad%temp(n) = 0.0_wp
203 shum_d(k) = shum_d(k) + real(x_ad%shum(n),kind=kind_real)
204 x_ad%shum(n) = 0.0_wp
207 pres_d(k) = pres_d(k) + real(x_ad%pres(n),kind=kind_real)
208 x_ad%pres(n) = 0.0_wp
211 phi_d(k) = phi_d(k) + real(x_ad%geop(n),kind=kind_real)
212 x_ad%geop(n) = 0.0_wp
218 temp_d(k) = temp_d(k) + real(x_ad%temp(k),kind=kind_real)
219 x_ad%temp(k) = 0.0_wp
220 shum_d(k) = shum_d(k) + real(x_ad%shum(k),kind=kind_real)
221 x_ad%shum(k) = 0.0_wp
222 pres_d(k) = pres_d(k) + real(x_ad%pres(k),kind=kind_real)
223 x_ad%pres(k) = 0.0_wp
224 phi_d(k) = phi_d(k) + real(x_ad%geop(k),kind=kind_real)
225 x_ad%geop(k) = 0.0_wp
258 type(obs1dbangle),
intent(out) :: y
260 integer,
intent(in) :: nvprof
261 integer,
dimension(nvprof),
intent(in) :: ichk
262 real(kind=kind_real),
dimension(nvprof),
intent(in) :: obs_impact
263 real(kind=kind_real),
intent(in) :: rlat, rlon
264 real(kind=kind_real),
intent(in) :: roc, undulat
265 real(kind=dp),
intent(in) :: ob_time
267 real(kind=wp) :: r8lat
268 real(kind=kind_real) :: rlon_local
269 character(len=250) :: record
272 y%time = real(ob_time,kind=wp)
273 r8lat = real(rlat,kind=wp)
276 if (rlon_local .gt. 180) rlon_local = rlon_local - 360.
277 y%lon = real(rlon_local,kind=wp)
279 y%g_sfc = gravity(r8lat, 0.0_wp)
280 y%r_curve = real(roc,kind=wp)
281 y%undulation = real(undulat,kind=wp)
282 y%r_earth = r_eff(r8lat)
287 if (
associated(y%bangle))
then
290 deallocate(y%weights)
296 allocate(y%bangle(1:nvprof))
297 allocate(y%impact(1:nvprof))
298 allocate(y%weights(1:nvprof))
301 y%impact(i) = real(obs_impact(i),kind=wp)
302 if (ichk(i) .le. 0)
then
303 y%weights(i) = 1.0_wp
305 y%weights(i) = 0.0_wp
311 write(record,
'(a9,2a11,3a15)')
'ROPPyvec:',
'lat',
'lon',
'g_sfc',
'roc',
'r_earth_eff'
312 write(record,
'(9x,2f11.2,f15.6,2f15.2)') y%lat, y%lon, y%g_sfc, y%r_curve, y%r_earth
325 rlat,rlon,roc,undulat,y,y_p)
328 type(obs1dbangle),
intent(out) :: y,y_p
330 integer,
intent(in) :: iloop
331 integer,
intent(in) :: nvprof
332 real(kind=kind_real),
dimension(nvprof),
intent(in) :: obs_impact
333 real(kind=kind_real),
intent(in) :: rlat,rlon
334 real(kind=kind_real),
intent(in) :: roc, undulat
335 real(kind=wp) :: r8lat
337 real(kind=kind_real) :: rlon_local
340 y%time = real(0.0, kind=wp)
341 r8lat = real(rlat,kind=wp)
342 y%lat = real(rlat,kind=wp)
344 if (rlon_local .gt. 180) rlon_local = rlon_local - 360.
345 y%lon = real(rlon_local,kind=wp)
347 y%g_sfc = gravity(r8lat, 0.0_wp)
348 y%r_curve = real(roc,kind=wp)
349 y%undulation = real(undulat,kind=wp)
350 y%r_earth = r_eff(r8lat)
354 allocate(y%bangle(1:nvprof))
355 allocate(y%impact(1:nvprof))
356 allocate(y%weights(1:nvprof))
357 allocate(y_p%bangle(1:nvprof))
358 allocate(y_p%impact(1:nvprof))
359 allocate(y_p%weights(1:nvprof))
366 y_p%impact(i) = real(obs_impact(i),kind=wp)
367 y%impact(i) = real(obs_impact(i),kind=wp)
383 type(state1dfm),
intent(inout) :: x
384 type(obs1dbangle),
intent(inout) :: y
386 if (
associated(x%temp))
deallocate(x%temp)
387 if (
associated(x%shum))
deallocate(x%shum)
388 if (
associated(x%pres))
deallocate(x%pres)
389 if (
associated(x%geop))
deallocate(x%geop)
391 if (
associated(y%impact))
deallocate(y%impact)
392 if (
associated(y%bangle))
deallocate(y%bangle)
400 type(state1dfm),
intent(inout) :: x,x_p
401 type(obs1dbangle),
intent(inout) :: y,y_p
415 deallocate(y_p%impact)
416 deallocate(y_p%bangle)
418 deallocate(y%weights)
419 deallocate(y_p%weights)
Fortran module to handle gnssro bending angle observations following the ROPP (2018 Aug) implementati...
subroutine, public init_ropp_1d_statevec_ad(temp_d, shum_d, pres_d, phi_d, lm, x_ad, iflip)
subroutine, public init_ropp_1d_statevec(step_time, rlon, rlat, temp, shum, pres, phi, lm, phi_sfc, x, iflip)
subroutine, public ropp_tidy_up_tlad_1d(x, x_p, y, y_p)
subroutine, public ropp_tidy_up_1d(x, y)
subroutine, public init_ropp_1d_obvec_tlad(iloop, nvprof, obs_impact, rlat, rlon, roc, undulat, y, y_p)
subroutine, public init_ropp_1d_obvec(nvprof, obs_impact, ichk, ob_time, rlat, rlon, roc, undulat, y)