10 use,
intrinsic :: iso_c_binding
11 use fckit_configuration_module,
only: fckit_configuration
12 use fckit_log_module,
only : fckit_log
15 use missing_values_mod
17 use oops_variables_mod
35 character(len=800) :: qcname
37 type(fckit_configuration) :: conf
38 integer(c_int) :: onedvarflag
39 logical :: capsupersat
40 real(kind_real) :: cost_funct_test
41 real(kind_real) :: delta_ct2
42 real(kind_real) :: delta_factor
43 integer :: n_iteration_test
44 real(kind_real) :: ob_test
45 real(kind_real) :: y_test
46 character(len=800) :: bmatrix_filename
48 logical :: vert_interp_ops
49 real(kind_real) :: min_temp_grad
64 capsupersat, cost_funct_test, &
65 Delta_ct2, Delta_factor, min_temp_grad, &
66 n_iteration_test, OB_test, pseudo_ops, &
67 vert_interp_ops, y_test, onedvarflag)
71 type(c_ptr),
value,
intent(in) :: obsspace
72 character(len=*),
intent(in) :: bmatrix_filename
73 logical(c_bool),
intent(in) :: capsupersat
74 real(c_float),
intent(in) :: cost_funct_test
75 real(c_float),
intent(in) :: delta_ct2
76 real(c_float),
intent(in) :: delta_factor
77 real(c_float),
intent(in) :: min_temp_grad
78 integer(c_int),
intent(in) :: n_iteration_test
79 real(c_float),
intent(in) :: ob_test
80 logical(c_bool),
intent(in) :: pseudo_ops
81 logical(c_bool),
intent(in) :: vert_interp_ops
82 real(c_float),
intent(in) :: y_test
83 integer(c_int),
intent(in) :: onedvarflag
85 character(len=800) :: message
87 self % obsdb = obsspace
88 self % onedvarflag = onedvarflag
90 self % bmatrix_filename = bmatrix_filename
91 self % capsupersat = capsupersat
92 self % cost_funct_test = cost_funct_test
93 self % Delta_ct2 = delta_ct2
94 self % Delta_factor = delta_factor
95 self % min_temp_grad = min_temp_grad
96 self % n_iteration_test = n_iteration_test
97 self % OB_test = ob_test
98 self % pseudo_ops = pseudo_ops
99 self % vert_interp_ops = vert_interp_ops
100 self % y_test = y_test
102 write(message,
'(A)')
'GNSS-RO 1D-Var check: input parameters are:'
103 call fckit_log % debug(message)
104 write(message,
'(2A)')
'bmatrix_filename = ', bmatrix_filename
105 call fckit_log % debug(message)
106 write(message,
'(A,L1)')
'capsupersat = ', capsupersat
107 call fckit_log % debug(message)
108 write(message,
'(A,F16.8)')
'cost_funct_test = ', cost_funct_test
109 call fckit_log % debug(message)
110 write(message,
'(A,F16.8)')
'Delta_ct2 = ', delta_ct2
111 call fckit_log % debug(message)
112 write(message,
'(A,F16.8)')
'Delta_factor = ', delta_factor
113 call fckit_log % debug(message)
114 write(message,
'(A,F16.8)')
'min_temp_grad = ', min_temp_grad
115 call fckit_log % debug(message)
116 write(message,
'(A,I7)')
'n_iteration_test = ', n_iteration_test
117 call fckit_log % debug(message)
118 write(message,
'(A,F16.8)')
'OB_test = ', ob_test
119 call fckit_log % debug(message)
120 write(message,
'(A,L1)')
'pseudo_ops = ', pseudo_ops
121 call fckit_log % debug(message)
122 write(message,
'(A,L1)')
'vert_interp_ops = ', vert_interp_ops
123 call fckit_log % debug(message)
124 write(message,
'(A,F16.8)')
'y_test = ', y_test
125 call fckit_log % debug(message)
161 logical,
intent(in) :: apply(:)
171 real(kind_real),
allocatable :: obslat(:)
172 real(kind_real),
allocatable :: obslon(:)
173 real(kind_real),
allocatable :: impact_param(:)
174 real(kind_real),
allocatable :: radius_curv(:)
175 real(kind_real),
allocatable :: undulation(:)
176 real(kind_real),
allocatable :: obs_bending_angle(:)
177 real(kind_real),
allocatable :: obs_err(:)
178 integer,
allocatable :: qc_flags(:)
179 integer,
allocatable :: obssatid(:)
180 integer,
allocatable :: obsorigc(:)
181 integer(c_size_t),
allocatable :: record_number(:)
182 real(kind_real),
allocatable :: sort_key(:)
183 integer,
allocatable :: index_vals(:)
184 integer,
allocatable :: unique(:)
185 integer :: start_point
186 integer :: current_point
188 integer :: nobs_profile
189 character(len=800) :: message
194 real(kind_real) :: dfs
195 real(kind_real) :: o_bdiff
196 real(kind_real),
allocatable :: tb(:)
197 real(kind_real),
allocatable :: ts(:)
200 nobs = obsspace_get_nlocs(self % obsdb)
201 allocate(obslon(nobs))
202 allocate(obslat(nobs))
203 allocate(impact_param(nobs))
204 allocate(radius_curv(nobs))
205 allocate(undulation(nobs))
206 allocate(obs_bending_angle(nobs))
207 allocate(record_number(nobs))
208 allocate(obssatid(nobs))
209 allocate(obsorigc(nobs))
210 allocate(qc_flags(nobs))
211 allocate(obs_err(nobs))
213 call obsspace_get_db(self % obsdb,
"MetaData",
"longitude", obslon)
214 call obsspace_get_db(self % obsdb,
"MetaData",
"latitude", obslat)
215 call obsspace_get_db(self % obsdb,
"MetaData",
"impact_parameter", impact_param)
216 call obsspace_get_db(self % obsdb,
"MetaData",
"earth_radius_of_curvature", radius_curv)
217 call obsspace_get_db(self % obsdb,
"MetaData",
"geoid_height_above_reference_ellipsoid", undulation)
218 call obsspace_get_db(self % obsdb,
"ObsValue",
"bending_angle", obs_bending_angle)
219 call obsspace_get_recnum(self % obsdb, record_number)
220 call obsspace_get_db(self % obsdb,
"MetaData",
"occulting_sat_id", obssatid)
221 call obsspace_get_db(self % obsdb,
"MetaData",
"originating_center", obsorigc)
222 call obsspace_get_db(self % obsdb,
"FortranQC",
"bending_angle", qc_flags)
223 call obsspace_get_db(self % obsdb,
"FortranERR",
"bending_angle", obs_err)
234 allocate(tb(q % nval), ts(q % nval))
238 allocate(sort_key(nobs))
239 sort_key = record_number + (impact_param / maxval(impact_param))
245 do iprofile = 1,
size(unique)
246 start_point = current_point
247 WRITE (message,
'(A,I0)')
'ObNumber ', iprofile
248 call fckit_log % info(message)
249 WRITE (message,
'(A,F12.2)')
'Latitude ', obslat(index_vals(start_point))
250 call fckit_log % info(message)
251 WRITE (message,
'(A,F12.2)')
'Longitude ', obslon(index_vals(start_point))
252 call fckit_log % info(message)
253 WRITE (message,
'(A,I0)')
'Processing centre ', obsorigc(index_vals(start_point))
254 call fckit_log % info(message)
255 WRITE (message,
'(A,I0)')
'Sat ID ', obssatid(index_vals(start_point))
256 call fckit_log % info(message)
259 do current_point = start_point, nobs
260 if (unique(iprofile) /= record_number(index_vals(current_point)))
exit
264 back % za(:) = rho_heights % vals(:, index_vals(start_point))
265 back % zb(:) = theta_heights % vals(:, index_vals(start_point))
266 back % p(:) = prs % vals(:, index_vals(start_point))
267 back % q(:) = q % vals(:, index_vals(start_point))
270 nobs_profile = current_point - start_point
274 ob % id = record_number(index_vals(start_point))
275 ob % latitude = obslat(index_vals(start_point))
276 ob % longitude = obslon(index_vals(start_point))
278 ob % jcost = missing_value(ob % jcost)
279 ob % bendingangle(:) % value = obs_bending_angle(index_vals(start_point:current_point-1))
280 ob % bendingangle(:) % oberr = obs_err(index_vals(start_point:current_point-1))
281 ob % impactparam(:) % value = impact_param(index_vals(start_point:current_point-1))
282 ob % qc_flags(:) = qc_flags(index_vals(start_point:current_point-1))
283 ob % ro_rad_curv % value = radius_curv(index_vals(start_point))
284 ob % ro_geoid_und % value = undulation(index_vals(start_point))
290 IF (b_matrix % band_up_lim(iband) > ob % latitude .OR. &
291 iband == b_matrix % nband)
EXIT
298 b_matrix % inverse(iseason,iband,:,:), &
299 b_matrix % sigma(iseason,iband,:), &
303 self % vert_interp_ops, &
304 self % min_temp_grad, &
305 self % cost_funct_test, &
307 self % n_iteration_test, &
308 self % Delta_factor, &
311 self % capsupersat, &
319 do ipoint = 0, nobs_profile-1
320 if (qc_flags(start_point + ipoint) > 0)
then
322 else if (ob % bendingangle(ipoint+1) % PGEFinal > 0.5)
then
323 qc_flags(start_point + ipoint) = self % onedvarflag
324 ob % qc_flags(ipoint+1) = self % onedvarflag
328 write(message,
'(A,2I5,2F10.3,I5,F16.6)')
'Profile stats: ', obssatid(index_vals(start_point)), &
329 obsorigc(index_vals(start_point)), ob % latitude, ob % longitude, &
330 ob % niter, ob % jcost
331 call fckit_log % debug(message)
332 do ipoint = 0, nobs_profile-1, 100
333 write(message,
'(100I5)') qc_flags(index_vals(start_point+ipoint: &
334 min(start_point+ipoint+99, current_point-1)))
335 call fckit_log % debug(message)
340 call obsspace_put_db(self % obsdb,
"FortranQC",
"bending_angle", qc_flags)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
Fortran module for gnssro bending angle Met Office forward operator.
Fortran module for gnssro bending angle Met Office forward operator.
subroutine, public ops_gpsro_do1dvar_ba(nlevp, nlevq, BM1, Bsig, Back, Ob, GPSRO_pseudo_ops, GPSRO_vert_interp_ops, GPSRO_min_temp_grad, GPSRO_cost_funct_test, GPSRO_y_test, GPSRO_n_iteration_test, GPSRO_Delta_factor, GPSRO_Delta_ct2, GPSRO_OB_test, capsupersat, BAerr, Tb, Ts, O_Bdiff, DFS)
Set up the background error covariance matrix (B matrix).
subroutine, public ops_gpsro_getbmatrix(filename, cx_nlevp, cx_nlevq, Bmatrix)
The main Fortran module for implementing the GNSS-RO onedvar check.
subroutine, public ufo_gnssroonedvarcheck_create(self, obsspace, bmatrix_filename, capsupersat, cost_funct_test, Delta_ct2, Delta_factor, min_temp_grad, n_iteration_test, OB_test, pseudo_ops, vert_interp_ops, y_test, onedvarflag)
Setup the main GNSS-RO onedvar object in Fortran.
subroutine, public ufo_gnssroonedvarcheck_delete(self)
Delete the main GNSS-RO onedvar object in Fortran.
subroutine, public ufo_gnssroonedvarcheck_apply(self, geovals, apply)
The main routine that applys the GNSS-RO onedvar filter.
subroutine, public allocate_singleob(singleob, nobs, nlevp, nlevq)
Allocate the singleob_type structure, given a certain number of observations,.
subroutine, public deallocate_singleob(singleob)
Deallocate the singleob_type structure.
subroutine, public ops_realsortquick(key, index)
Generates a index array pointing to the elements of the array 'key'.
subroutine, public deallocate_singlebg(singlebg)
Dealloate the singlebg_type structure.
subroutine, public find_unique(input, output)
Find the unique entries in the input list.
subroutine, public allocate_singlebg(singlebg, nlevp, nlevq)
Allocate the structure to hold background information from a single profile.
character(len=maxvarlen), parameter, public var_prsi
character(len=maxvarlen), parameter, public var_q
character(len=maxvarlen), parameter, public var_zi
character(len=maxvarlen), parameter, public var_z
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators