12 use missing_values_mod
19 type(oops_variables),
public :: obsvars
20 type(oops_variables),
public :: geovars
21 integer :: nval, nlocs
22 real(kind_real),
allocatable :: wf(:)
23 integer,
allocatable :: wi(:)
24 character(len=MAXVARLEN),
public :: v_coord
25 logical,
public :: use_ln
40 use fckit_configuration_module,
only: fckit_configuration
43 type(fckit_configuration),
intent(in) :: grid_conf
45 character(kind=c_char,len=:),
allocatable :: coord_name
46 integer :: ivar, nvars
49 nvars = self%obsvars%nvars()
51 call self%geovars%push_back(self%obsvars%variable(ivar))
56 if( grid_conf%has(
"vertical coordinate") )
then
57 call grid_conf%get_or_die(
"vertical coordinate",coord_name)
58 self%v_coord = coord_name
59 if( trim(self%v_coord) .eq.
var_prs ) self%use_ln = .true.
74 type(c_ptr),
value,
intent(in) :: obss
76 real(kind_real),
allocatable :: obsvcoord(:)
79 real(kind_real),
allocatable :: tmp(:)
80 real(kind_real) :: tmp2
87 self%nval = vcoordprofile%nval
90 self%nlocs = obsspace_get_nlocs(obss)
91 allocate(obsvcoord(self%nlocs))
92 call obsspace_get_db(obss,
"MetaData", self%v_coord, obsvcoord)
95 allocate(self%wi(self%nlocs))
96 allocate(self%wf(self%nlocs))
99 allocate(tmp(vcoordprofile%nval))
100 do iobs = 1, self%nlocs
101 if (self%use_ln)
then
102 tmp = log(vcoordprofile%vals(:,iobs))
103 tmp2 = log(obsvcoord(iobs))
105 tmp = vcoordprofile%vals(:,iobs)
106 tmp2 = obsvcoord(iobs)
112 deallocate(obsvcoord)
123 integer,
intent(in) :: nvars, nlocs
124 real(c_double),
intent(inout) :: hofx(nvars, nlocs)
125 type(c_ptr),
value,
intent(in) :: obss
127 integer :: iobs, ivar
129 character(len=MAXVARLEN) :: geovar
133 geovar = self%geovars%variable(ivar)
141 & hofx(ivar,iobs), self%wi(iobs), self%wf(iobs))
152 integer,
intent(in) :: nvars, nlocs
153 real(c_double),
intent(in) :: hofx(nvars, nlocs)
154 type(c_ptr),
value,
intent(in) :: obss
156 integer :: iobs, ivar
158 character(len=MAXVARLEN) :: geovar
159 real(c_double) :: missing
161 missing = missing_value(missing)
165 geovar = self%geovars%variable(ivar)
171 if (.not.
allocated(profile%vals))
then
172 profile%nlocs = self%nlocs
173 profile%nval = self%nval
174 allocate(profile%vals(profile%nval, profile%nlocs))
175 profile%vals(:,:) = 0.0_kind_real
177 if (.not. geovals%linit ) geovals%linit=.true.
180 do iobs = 1, self%nlocs
181 if (hofx(ivar,iobs) /= missing)
then
183 & hofx(ivar,iobs), self%wi(iobs), self%wf(iobs))
196 if (
allocated(self%wi))
deallocate(self%wi)
197 if (
allocated(self%wf))
deallocate(self%wf)