8 use iso_c_binding,
only: c_ptr
9 use oops_variables_mod,
only: oops_variables
18 geovals, obsspace, nlocs, obsvars, obsdiags)
19 use kinds,
only: kind_real
20 use obsspace_mod,
only: obsspace_get_db
27 character(len=*),
intent(in) :: obs_vcoord_name
30 character(len=*),
intent(in) :: vcoord_name
32 type(c_ptr),
value,
intent(in) :: obsspace
33 integer,
intent(in) :: nlocs
34 type(oops_variables),
intent(in) :: obsvars
39 real(kind_real) :: obs_vcoord(nlocs)
40 type(
ufo_geoval),
pointer :: vcoord_profile, background_error_profile
41 real(kind_real) :: wf(nlocs)
43 character(len=MAXVARLEN) :: varstr
45 real(kind_real),
allocatable :: interp_nodes(:)
46 real(kind_real) :: interp_point
48 character(len=*),
parameter :: suffix =
"_background_error"
54 call obsspace_get_db(obsspace,
"MetaData", obs_vcoord_name, obs_vcoord)
58 use_ln = (obs_vcoord_name .eq.
var_prs) .or. (obs_vcoord_name .eq.
var_prsi)
61 allocate(interp_nodes(vcoord_profile%nval))
64 interp_nodes = log(vcoord_profile%vals(:,iobs))
65 interp_point = log(obs_vcoord(iobs))
67 interp_nodes = vcoord_profile%vals(:,iobs)
68 interp_point = obs_vcoord(iobs)
74 do ivar = 1, obsdiags%nvar
75 varstr = obsdiags%variables(ivar)
76 lenvarstr = len_trim(varstr)
80 if (lenvarstr <= len(suffix)) cycle
82 if (varstr(lenvarstr - len(suffix)+1:lenvarstr) /= suffix) cycle
84 if (.not. obsvars%has(varstr(:lenvarstr - len(suffix)))) cycle
92 if (
allocated(obsdiags%geovals(ivar)%vals))
deallocate(obsdiags%geovals(ivar)%vals)
93 obsdiags%geovals(ivar)%nval = 1
94 allocate(obsdiags%geovals(ivar)%vals(obsdiags%geovals(ivar)%nval, nlocs))
99 background_error_profile%vals(:,iobs), &
100 obsdiags%geovals(ivar)%vals(1,iobs), &
106 deallocate(interp_nodes)
subroutine ufo_backgrounderrorvertinterp_fillobsdiags(obs_vcoord_name, vcoord_name, geovals, obsspace, nlocs, obsvars, obsdiags)
For each obs diagnostic called _background_error, where belongs to the set of variable names obsvars...
subroutine, public ufo_geovals_get_var(self, varname, geoval)
character(len=maxvarlen), parameter, public var_prsi
character(len=maxvarlen), parameter, public var_prs
integer, parameter, public maxvarlen
Fortran module to perform linear interpolation.
subroutine vert_interp_weights(nlev, obl, vec, wi, wf)
subroutine vert_interp_apply(nlev, fvec, f, wi, wf)
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators