10 use oops_variables_mod
23 type(oops_variables),
public :: geovars
24 type(oops_variables),
public :: obsvars
25 logical,
public :: ltraj = .false.
30 real (kind=kind_real),
allocatable :: depth(:,:)
31 real (kind=kind_real),
allocatable :: deptho(:)
32 real(kind_real),
allocatable :: wf(:)
33 integer,
allocatable :: wi(:)
49 integer :: ivar, nvars
51 nvars = self%obsvars%nvars()
53 call self%geovars%push_back(self%obsvars%variable(ivar))
63 if (
allocated(self%wi))
deallocate(self%wi)
64 if (
allocated(self%wf))
deallocate(self%wf)
65 if (
allocated(self%deptho))
deallocate(self%deptho)
66 if (
allocated(self%depth))
deallocate(self%depth)
67 if (
allocated(self%var%vals))
deallocate(self%var%vals)
68 if (
allocated(self%h%vals))
deallocate(self%h%vals)
82 type(c_ptr),
value,
intent(in) :: obss
84 character(len=*),
parameter :: myname_=
"ufo_marinevertinterp_tlad_settraj"
85 character(max_string) :: err_msg
88 integer :: nlocs, nlev, iobs, ilev
90 real(kind_real),
allocatable :: obs_depth(:)
108 allocate(self%deptho(nlocs))
110 obss_nlocs = obsspace_get_nlocs(obss)
111 allocate(obs_depth(obss_nlocs))
112 call obsspace_get_db(obss,
"MetaData",
"depth", obs_depth)
114 self%deptho = obs_depth
117 allocate(self%depth(nlev,nlocs))
119 self%depth(1,iobs)=0.5*self%h%vals(1,iobs)
121 self%depth(ilev,iobs)=sum(self%h%vals(1:ilev-1,iobs))+0.5*self%h%vals(ilev,iobs)
126 allocate(self%wi(nlocs),self%wf(nlocs))
128 call vert_interp_weights(nlev,self%deptho(iobs),self%depth(:,iobs),self%wi(iobs),self%wf(iobs))
132 deallocate(obs_depth)
142 use missing_values_mod
147 real(c_double),
intent(inout) :: hofx(:)
148 type(c_ptr),
value,
intent(in) :: obss
150 character(len=*),
parameter :: myname_=
"ufo_marinevertinterp_simobs_tl"
151 character(max_string) :: err_msg
152 integer :: iobs, ilev, nlev, nlocs
156 if (.not. self%ltraj)
then
157 write(err_msg,*) myname_,
' trajectory wasnt set!'
158 call abor1_ftn(err_msg)
162 if (geovals%nlocs /=
size(hofx,1))
then
163 write(err_msg,*) myname_,
' error: nlocs inconsistent!'
164 call abor1_ftn(err_msg)
176 call vert_interp_apply(nlev, var_d%vals(:,iobs), hofx(iobs), self%wi(iobs), self%wf(iobs))
187 use missing_values_mod
192 real(c_double),
intent(in) :: hofx(:)
193 type(c_ptr),
value,
intent(in) :: obss
195 character(len=*),
parameter :: myname_=
"ufo_marinevertinterp_simobs_ad"
196 character(max_string) :: err_msg
198 real (kind=kind_real) :: deptho
200 integer :: iobs, nlocs, ilev, nlev
202 real(c_double) :: missing
205 missing = missing_value(missing)
208 if (.not. self%ltraj)
then
209 write(err_msg,*) myname_,
' trajectory wasnt set!'
210 call abor1_ftn(err_msg)
214 if (geovals%nlocs /=
size(hofx,1))
then
215 write(err_msg,*) myname_,
' error: nlocs inconsistent!'
216 call abor1_ftn(err_msg)
219 if (.not. geovals%linit ) geovals%linit=.true.
228 do iobs = 1,
size(hofx,1)
229 if (hofx(iobs) /= missing)
then
230 deptho = self%deptho(iobs)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
Fortran marinevertinterp module for tl/ad observation operator.
subroutine ufo_marinevertinterp_simobs_tl(self, geovals, hofx, obss)
subroutine ufo_marinevertinterp_tlad_settraj(self, geovals, obss)
subroutine ufo_marinevertinterp_tlad_setup(self)
integer, parameter max_string
subroutine ufo_marinevertinterp_tlad_delete(self)
subroutine ufo_marinevertinterp_simobs_ad(self, geovals, hofx, obss)
character(len=maxvarlen), public var_ocn_salt
character(len=maxvarlen), public var_ocn_lay_thick
Fortran module to perform linear interpolation.
subroutine vert_interp_apply_ad(nlev, fvec_ad, f_ad, wi, wf)
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
Fortran derived type for the tl/ad observation operator.