10 use fckit_configuration_module,
only: fckit_configuration
39 type(fckit_configuration),
intent(in) :: f_conf
58 real(c_double),
intent(inout) :: hofx(:)
59 type(c_ptr),
value,
intent(in) :: obss
61 character(len=*),
parameter :: myname_=
"ufo_insitutemperature_simobs"
62 character(max_string) :: err_msg
64 integer :: iobs, ilev, nlev, nlocs
66 real (kind_real),
allocatable :: depth(:,:)
67 real(kind_real) :: lono, lato, deptho
68 real(kind_real),
allocatable :: obs_lon(:)
69 real(kind_real),
allocatable :: obs_lat(:)
70 real(kind_real),
allocatable :: obs_depth(:)
72 real(kind_real) :: wf, tp, sp, prs, max_depth
76 if (geovals%nlocs /=
size(hofx,1))
then
77 write(err_msg,*) myname_,
' error: nlocs inconsistent!'
78 call abor1_ftn(err_msg)
87 obss_nlocs = obsspace_get_nlocs(obss)
88 allocate(obs_lon(obss_nlocs))
89 allocate(obs_lat(obss_nlocs))
90 allocate(obs_depth(obss_nlocs))
91 call obsspace_get_db(obss,
"MetaData",
"longitude", obs_lon)
92 call obsspace_get_db(obss,
"MetaData",
"latitude", obs_lat)
93 call obsspace_get_db(obss,
"MetaData",
"depth", obs_depth)
97 allocate(depth(nlev,nlocs))
98 do iobs = 1,
size(hofx,1)
100 depth(1,iobs)=0.5*h%vals(1,iobs)
102 depth(ilev,iobs)=sum(h%vals(1:ilev-1,iobs))+0.5*h%vals(ilev,iobs)
105 max_depth=maxval(depth)
111 do iobs = 1,
size(hofx,1)
115 deptho = obs_depth(iobs)
119 if (deptho >= max_depth)
then
129 call insitu_t_nl(hofx(iobs), tp, sp, lono, lato, deptho)
136 deallocate(obs_depth)