10 use fckit_configuration_module,
only: fckit_configuration
18 use missing_values_mod
29 real(c_double) :: r_miss_val
45 type(fckit_configuration),
intent(in) :: f_conf
63 type(c_ptr),
value,
intent(in) :: obss
65 character(len=*),
parameter :: myname_=
"ufo_adt_tlad_settraj"
68 self%nlocs = obsspace_get_nlocs(obss)
73 self%geoval_adt = geoval_adt
77 self%r_miss_val = missing_value(self%r_miss_val)
83 use fckit_mpi_module,
only: fckit_mpi_comm, fckit_mpi_sum
87 real(c_double),
intent(inout) :: hofx(:)
88 type(c_ptr),
value,
intent(in) :: obss
90 character(len=*),
parameter :: myname_=
"ufo_adt_simobs_tl"
91 character(max_string) :: err_msg
92 integer :: iobs, nlocs, cnt, cnt_glb
94 real(kind_real) :: offset_hofx, pe_offset_hofx
95 type(fckit_mpi_comm) :: f_comm
97 call obsspace_get_comm(obss, f_comm)
100 if (.not. self%ltraj)
then
101 write(err_msg,*) myname_,
' trajectory wasnt set!'
102 call abor1_ftn(err_msg)
108 if (geovals%nlocs /= nlocs)
then
109 write(err_msg,*) myname_,
' error: nlocs inconsistent!'
110 call abor1_ftn(err_msg)
119 do iobs = 1, self%nlocs
120 if (hofx(iobs)/=self%r_miss_val)
then
121 pe_offset_hofx = pe_offset_hofx + geoval_adt%vals(1,iobs)
127 call f_comm%allreduce(pe_offset_hofx, offset_hofx, fckit_mpi_sum())
128 call f_comm%allreduce(cnt, cnt_glb, fckit_mpi_sum())
129 offset_hofx = offset_hofx/cnt_glb
133 do iobs = 1, self%nlocs
134 hofx(iobs) = geoval_adt%vals(1,iobs) - offset_hofx
141 use fckit_mpi_module,
only: fckit_mpi_comm, fckit_mpi_sum
145 real(c_double),
intent(in) :: hofx(:)
146 type(c_ptr),
value,
intent(in) :: obss
148 character(len=*),
parameter :: myname_=
"ufo_adt_simobs_ad"
149 character(max_string) :: err_msg
151 integer :: iobs, nlocs, cnt, cnt_glb
153 real(kind_real) :: offset_hofx, pe_offset_hofx
154 type(fckit_mpi_comm) :: f_comm
156 call obsspace_get_comm(obss, f_comm)
159 if (.not. self%ltraj)
then
160 write(err_msg,*) myname_,
' trajectory wasnt set!'
161 call abor1_ftn(err_msg)
166 if (geovals%nlocs /= nlocs)
then
167 write(err_msg,*) myname_,
' error: nlocs inconsistent!'
168 call abor1_ftn(err_msg)
171 if (.not. geovals%linit ) geovals%linit=.true.
179 do iobs = 1, self%nlocs
180 if (hofx(iobs)/=self%r_miss_val)
then
181 pe_offset_hofx = pe_offset_hofx + hofx(iobs)
187 call f_comm%allreduce(pe_offset_hofx, offset_hofx, fckit_mpi_sum())
188 call f_comm%allreduce(cnt, cnt_glb, fckit_mpi_sum())
189 offset_hofx = offset_hofx/cnt_glb
192 if (hofx(iobs)/=self%r_miss_val)
then
193 geoval_adt%vals(1,iobs) = geoval_adt%vals(1,iobs) + hofx(iobs) - offset_hofx
Fortran adt module for tl/ad observation operator.
subroutine ufo_adt_simobs_ad(self, geovals, hofx, obss)
subroutine ufo_adt_tlad_delete(self)
integer, parameter max_string
subroutine ufo_adt_tlad_setup(self, f_conf)
subroutine ufo_adt_tlad_settraj(self, geovals, obss)
subroutine ufo_adt_simobs_tl(self, geovals, hofx, obss)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
character(len=maxvarlen), public var_abs_topo
Fortran derived type for the tl/ad observation operator.
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators