34 real (kind=kind_real),
allocatable :: depth(:,:)
35 real (kind=kind_real),
allocatable :: lono(:)
36 real (kind=kind_real),
allocatable :: lato(:)
37 real (kind=kind_real),
allocatable :: deptho(:)
38 real (kind=kind_real),
allocatable :: tempo(:)
39 real (kind=kind_real),
allocatable :: salto(:)
40 real(kind_real),
allocatable :: wf(:)
41 integer,
allocatable :: wi(:)
42 real (kind=kind_real),
allocatable :: jac(:,:)
43 logical :: ltraj = .false.
56 if (
allocated(self%jac))
deallocate(self%jac)
57 if (
allocated(self%wi))
deallocate(self%wi)
58 if (
allocated(self%wf))
deallocate(self%wf)
59 if (
allocated(self%deptho))
deallocate(self%deptho)
60 if (
allocated(self%lato))
deallocate(self%lato)
61 if (
allocated(self%lono))
deallocate(self%lono)
62 if (
allocated(self%depth))
deallocate(self%depth)
63 if (
allocated(self%temp%vals))
deallocate(self%temp%vals)
64 if (
allocated(self%salt%vals))
deallocate(self%salt%vals)
65 if (
allocated(self%h%vals))
deallocate(self%h%vals)
66 if (
allocated(self%tempo))
deallocate(self%tempo)
67 if (
allocated(self%salto))
deallocate(self%salto)
81 type(c_ptr),
value,
intent(in) :: obss
83 character(len=*),
parameter :: myname_=
"ufo_insitutemperature_tlad_settraj" 84 character(max_string) :: err_msg
87 integer :: nobs, nlev, iobs, ilev
89 real(kind_real),
allocatable :: obs_lat(:)
90 real(kind_real),
allocatable :: obs_lon(:)
91 real(kind_real),
allocatable :: obs_depth(:)
115 allocate(traj%lono(nobs))
116 allocate(traj%lato(nobs))
117 allocate(traj%deptho(nobs))
120 allocate(obs_lat(obss_nobs))
121 allocate(obs_lon(obss_nobs))
122 allocate(obs_depth(obss_nobs))
130 traj%deptho = obs_depth
133 allocate(traj%depth(nlev,nobs))
135 traj%depth(1,iobs)=0.5*traj%h%vals(1,iobs)
137 traj%depth(ilev,iobs)=sum(traj%h%vals(1:ilev-1,iobs))+0.5*traj%h%vals(ilev,iobs)
142 allocate(traj%wi(nobs),traj%wf(nobs))
144 call vert_interp_weights(nlev,traj%deptho(iobs),traj%depth(:,iobs),traj%wi(iobs),traj%wf(iobs))
145 if (traj%deptho(iobs).ge.maxval(traj%depth(:,iobs)))
then 153 allocate(traj%jac(2,nobs),traj%tempo(nobs),traj%salto(nobs))
156 call vert_interp_apply(nlev, traj%temp%vals(:,iobs), traj%tempo(iobs), traj%wi(iobs), traj%wf(iobs))
157 call vert_interp_apply(nlev, traj%salt%vals(:,iobs), traj%salto(iobs), traj%wi(iobs), traj%wf(iobs))
160 call insitu_t_jac(traj%jac(:,iobs), traj%tempo(iobs), traj%salto(iobs), traj%lono(iobs), traj%lato(iobs), traj%deptho(iobs))
165 deallocate(obs_depth)
179 real(c_double),
intent(inout) :: hofx(:)
181 character(len=*),
parameter :: myname_=
"ufo_insitutemperature_simobs_tl" 182 character(max_string) :: err_msg
184 integer :: iobs, ilev, nlev, nobs
186 type(
ufo_geoval),
pointer :: temp_d, salt_d, dlayerthick
187 real (kind=kind_real) :: lono, lato, deptho
190 real(kind_real) :: dtp, dsp
193 if (.not. traj%ltraj)
then 194 write(err_msg,*) myname_,
' trajectory wasnt set!' 195 call abor1_ftn(err_msg)
199 if (geovals%nobs /=
size(hofx,1))
then 200 write(err_msg,*) myname_,
' error: nobs inconsistent!' 201 call abor1_ftn(err_msg)
222 lono = traj%lono(iobs)
223 lato = traj%lato(iobs)
224 deptho = traj%deptho(iobs)
227 call vert_interp_apply(nlev, temp_d%vals(:,iobs), dtp, traj%wi(iobs), traj%wf(iobs))
228 call vert_interp_apply(nlev, salt_d%vals(:,iobs), dsp, traj%wi(iobs), traj%wf(iobs))
231 call insitu_t_tl(hofx(iobs),dtp,dsp,traj%tempo(iobs),traj%salto(iobs),lono,lato,deptho,traj%jac(:,iobs))
248 real(c_double),
intent(in) :: hofx(:)
250 character(len=*),
parameter :: myname_=
"ufo_insitutemperature_simobs_ad" 251 character(max_string) :: err_msg
253 real (kind=kind_real) :: lono, lato, deptho
255 integer :: iobs, nobs, ilev, nlev
256 type(
ufo_geoval),
pointer :: dtemp, dsalt, dlayerthick
257 real (kind_real) :: dtp, dsp
260 if (.not. traj%ltraj)
then 261 write(err_msg,*) myname_,
' trajectory wasnt set!' 262 call abor1_ftn(err_msg)
266 if (geovals%nobs /=
size(hofx,1))
then 267 write(err_msg,*) myname_,
' error: nobs inconsistent!' 268 call abor1_ftn(err_msg)
271 if (.not. geovals%linit ) geovals%linit=.true.
285 if (.not.
allocated(dtemp%vals))
allocate(dtemp%vals(nlev,
size(hofx,1)))
286 if (.not.
allocated(dsalt%vals))
allocate(dsalt%vals(nlev,
size(hofx,1)))
287 if (.not.
allocated(dlayerthick%vals))
allocate(dlayerthick%vals(nlev,
size(hofx,1)))
292 do iobs = 1,
size(hofx,1)
294 lono = traj%lono(iobs)
295 lato = traj%lato(iobs)
296 deptho = traj%deptho(iobs)
301 call insitu_t_tlad(hofx(iobs),dtp,dsp,traj%tempo(iobs),traj%salto(iobs),lono,lato,deptho,traj%jac(:,iobs))
subroutine, public ufo_geovals_get_var(self, varname, geoval, status)
subroutine vert_interp_apply(nlev, fvec, f, wi, wf)
subroutine, public insitu_t_jac(jac, temp_p, salt_p, lono, lato, deptho)
subroutine, public ufo_insitutemperature_tlad_settraj(traj, geovals, obss)
subroutine, public ufo_insitutemperature_simobs_tl(traj, geovals, hofx)
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.
character(len=maxvarlen), public var_ocn_lay_thick
subroutine, public insitu_t_tl(dtemp_i, dtemp_p, dsalt_p, temp_p, salt_p, lono, lato, deptho, Jacobian)
subroutine, public insitu_t_tlad(dtemp_i, dtemp_p, dsalt_p, temp_p, salt_p, lono, lato, deptho, Jacobian)
Fortran module to perform linear interpolation.
character(len=maxvarlen), public var_ocn_salt
character(len=maxvarlen), public var_ocn_pot_temp
type to hold interpolated fields required by the obs operators
subroutine, public ufo_insitutemperature_simobs_ad(traj, geovals, hofx)
Fortran derived type to hold trajectory for ocean insitu temperature observation operator.
Fortran module to handle ice concentration observations.
subroutine, public ufo_insitutemperature_tlad_delete(self)
Fortran module handling observation locations.
Fortran interface to ObsSpace.
subroutine vert_interp_weights(nlev, obl, vec, wi, wf)
type to hold interpolated field for one variable, one observation