24 real(kind_real),
allocatable :: wf(:)
25 integer,
allocatable :: wi(:)
26 real(kind_real),
allocatable :: prs(:), t(:), q(:)
27 real(kind_real),
allocatable :: obsh(:)
43 class(ufo_gnssro_Ref_tlad),
intent(inout) :: self
44 type(ufo_geovals),
intent(in) :: geovals
45 type(c_ptr),
value,
intent(in) :: obss
47 character(len=*),
parameter :: myname_=
"ufo_gnssro_ref_tlad_settraj" 48 character(max_string) :: err_msg
50 type(ufo_geoval),
pointer :: t,q,prs,gph
52 real(kind_real),
allocatable :: obsZ(:), obsLat(:)
53 real(kind_real) :: Tv, Tv0
59 write(err_msg,*) myname_, trim(
var_prs),
' doesnt exist' 60 call abor1_ftn(err_msg)
64 write(err_msg,*) myname_, trim(
var_t),
' doesnt exist' 65 call abor1_ftn(err_msg)
69 write(err_msg,*) myname_, trim(
var_q),
' doesnt exist' 70 call abor1_ftn(err_msg)
74 write(err_msg,*) myname_, trim(
var_z),
' doesnt exist' 75 call abor1_ftn(err_msg)
85 allocate(self%wi(self%nobs))
86 allocate(self%wf(self%nobs))
87 allocate(self%t(self%nobs))
88 allocate(self%q(self%nobs))
89 allocate(self%prs(self%nobs))
90 allocate(self%obsH(self%nobs))
92 allocate(obsz(self%nobs))
93 allocate(obslat(self%nobs))
100 do iobs = 1, self%nobs
104 call vert_interp_weights(self%nval, self%obsH(iobs), gph%vals(:,iobs),self%wi(iobs),self%wf(iobs))
106 call vert_interp_apply(t%nval, t%vals(:,iobs), self%t(iobs), self%wi(iobs),self%wf(iobs))
107 call vert_interp_apply(q%nval, q%vals(:,iobs), self%q(iobs), self%wi(iobs),self%wf(iobs))
112 tv0 = t%vals(wi0,iobs)*(
one + (
rv_over_rd-
one)*q%vals(wi0,iobs)/(1.0-q%vals(wi0,iobs) ))
113 self%prs(iobs) = prs%vals(wi0,iobs)/exp(
two*
grav*(self%obsH(iobs)-gph%vals(wi0,iobs))/(
rd*(tv+tv0)))
128 class(ufo_gnssro_Ref_tlad),
intent(in) :: self
129 type(ufo_geovals),
intent(in) :: geovals
130 real(kind_real),
intent(inout) :: hofx(:)
131 type(c_ptr),
value,
intent(in) :: obss
132 logical,
parameter :: use_compress=.true.
134 character(len=*),
parameter :: myname_=
"ufo_gnssro_ref_tlad_tl" 135 character(max_string) :: err_msg
138 type(ufo_geoval),
pointer :: t_d, q_d
139 real(kind_real) :: t_coeff, q_coeff
140 real(kind_real) :: gesT_d, gesQ_d, gesTv_d, gesTv0_d
143 if (.not. self%ltraj)
then 144 write(err_msg,*) myname_,
' trajectory wasnt set!' 145 call abor1_ftn(err_msg)
149 if (geovals%nobs /=
size(hofx))
then 150 write(err_msg,*) myname_,
' error: nobs inconsistent!' 151 call abor1_ftn(err_msg)
157 write(err_msg,*) myname_, trim(
var_t),
' doesnt exist' 158 call abor1_ftn(err_msg)
162 write(err_msg,*) myname_, trim(
var_q),
' doesnt exist' 163 call abor1_ftn(err_msg)
170 do iobs = 1, geovals%nobs
177 t_coeff = -
n_a*self%prs(iobs)/self%t(iobs)**2 &
178 -
n_b*
two*self%prs(iobs)*self%q(iobs)/ &
180 -
n_c*self%prs(iobs)*self%q(iobs)/ &
186 hofx(iobs) = t_coeff*gest_d + q_coeff*gesq_d
197 class(ufo_gnssro_Ref_tlad),
intent(in) :: self
198 type(ufo_geovals),
intent(inout) :: geovals
199 real(kind_real),
intent(in) :: hofx(:)
200 type(c_ptr),
value,
intent(in) :: obss
201 logical,
parameter :: use_compress=.true.
203 character(len=*),
parameter :: myname_=
"ufo_gnssro_ref_tlad_ad" 204 character(max_string) :: err_msg
207 type(ufo_geoval),
pointer :: t_d, q_d, prs_d, gph_d
208 real(kind_real) :: t_coeff, q_coeff
209 real(kind_real) :: gesT_d, gesQ_d
212 if (.not. self%ltraj)
then 213 write(err_msg,*) myname_,
' trajectory wasnt set!' 214 call abor1_ftn(err_msg)
218 if (geovals%nobs /=
size(hofx))
then 219 write(err_msg,*) myname_,
' error: nobs inconsistent!' 220 call abor1_ftn(err_msg)
226 write(err_msg,*) myname_, trim(
var_prs),
' doesnt exist' 227 call abor1_ftn(err_msg)
232 write(err_msg,*) myname_, trim(
var_t),
' doesnt exist' 233 call abor1_ftn(err_msg)
238 write(err_msg,*) myname_, trim(
var_q),
' doesnt exist' 239 call abor1_ftn(err_msg)
243 write(err_msg,*) myname_, trim(
var_z),
' doesnt exist' 244 call abor1_ftn(err_msg)
247 if (.not.
allocated(t_d%vals))
then 250 allocate(t_d%vals(t_d%nval,t_d%nobs))
252 t_d%vals = 0.0_kind_real
254 if (.not.
allocated(prs_d%vals))
then 255 prs_d%nobs = self%nobs
256 prs_d%nval = self%nval
257 allocate(prs_d%vals(prs_d%nval,prs_d%nobs))
259 prs_d%vals = 0.0_kind_real
261 if (.not.
allocated(q_d%vals))
then 264 allocate(q_d%vals(q_d%nval,q_d%nobs))
266 q_d%vals = 0.0_kind_real
268 if (.not.
allocated(gph_d%vals))
then 269 gph_d%nobs = self%nobs
270 gph_d%nval = self%nval
271 allocate(gph_d%vals(gph_d%nval,gph_d%nobs))
273 gph_d%vals = 0.0_kind_real
275 if (.not. geovals%linit ) geovals%linit=.true.
280 do iobs = 1, geovals%nobs
283 t_coeff = -
n_a*self%prs(iobs)/self%t(iobs)**2 &
284 -
n_b*
two*self%prs(iobs)*self%q(iobs)/ &
286 -
n_c*self%prs(iobs)*self%q(iobs)/ &
293 gest_d = 0.0_kind_real
294 gesq_d = 0.0_kind_real
295 gest_d = gest_d + hofx(iobs)*t_coeff
296 gesq_d = gesq_d + hofx(iobs)*q_coeff
308 class(ufo_gnssro_Ref_tlad),
intent(inout) :: self
309 character(len=*),
parameter :: myname_=
"ufo_gnssro_ref_tlad_delete" 312 if (
allocated(self%wi))
deallocate(self%wi)
313 if (
allocated(self%wf))
deallocate(self%wf)
314 if (
allocated(self%prs))
deallocate(self%prs)
315 if (
allocated(self%t))
deallocate(self%t)
316 if (
allocated(self%q))
deallocate(self%q)
317 if (
allocated(self%obsH))
deallocate(self%obsH)
subroutine, public ufo_geovals_get_var(self, varname, geoval, status)
subroutine vert_interp_apply(nlev, fvec, f, wi, wf)
integer, parameter max_string
subroutine vert_interp_apply_ad(nlev, fvec_ad, f_ad, wi, wf)
integer function, public obsspace_get_nobs(c_dom)
Return the number of observations.
real(kind_real), parameter, public rd
Fortran module for gnssro refractivity tangent linear and adjoint.
real(kind_real), parameter, public rd_over_rv
subroutine vert_interp_apply_tl(nlev, fvec_tl, f_tl, wi, wf)
real(kind_real), parameter, public rv_over_rd
character(len=maxvarlen), public var_z
Fortran module to perform linear interpolation.
real(fp), parameter, public one
character(len=maxvarlen), public var_q
real(kind_real), public n_c
subroutine, public gnssro_ref_constants(use_compress)
real(fp), parameter, public two
character(len=maxvarlen), public var_prs
subroutine ufo_gnssro_ref_simobs_tl(self, geovals, hofx, obss)
type(registry_t), public ufo_geovals_registry
Linked list interface - defines registry_t type.
subroutine ufo_gnssro_ref_tlad_delete(self)
Fortran derived type for gnssro trajectory.
real(kind_real), parameter, public grav
real(kind_real), public n_b
character(len=maxvarlen), public var_t
Fortran interface to ObsSpace.
subroutine vert_interp_weights(nlev, obl, vec, wi, wf)
real(kind_real), public n_a
subroutine ufo_gnssro_ref_tlad_settraj(self, geovals, obss)
subroutine ufo_gnssro_ref_simobs_ad(self, geovals, hofx, obss)
subroutine, public delete(self)