11 use fckit_configuration_module,
only: fckit_configuration
21 use missing_values_mod
27 use fckit_log_module,
only : fckit_log
35 real(kind_real),
allocatable :: obslon2d(:), obslat2d(:)
48 type(fckit_configuration),
intent(in) :: f_conf
49 integer,
intent(in) :: c_size
53 allocate(self%obsLon2d(c_size*self%roconf%n_horiz))
54 allocate(self%obsLat2d(c_size*self%roconf%n_horiz))
63 use ropp_fm_types,
only: state2dfm, state1dfm
64 use ropp_fm_types,
only: obs1dbangle
65 use typesizes,
only: wp => eightbytereal
66 use datetimetypes,
only: dp
71 real(kind_real),
intent(inout) :: hofx(:)
72 type(c_ptr),
value,
intent(in) :: obss
73 real(c_double) :: missing
76 type(state1dfm) :: x1d
77 type(obs1dbangle) :: y
79 character(len=*),
parameter :: myname_=
"ufo_gnssro_bndropp2d_simobs"
80 integer,
parameter :: max_string = 800
81 character(max_string) :: err_msg
82 integer :: nlev, nlocs, iobs, nvprof
84 type(
ufo_geoval),
pointer :: t, q, prs, gph, gph_sfc
85 real(kind_real),
allocatable :: obsImpP(:),obsLocR(:),obsGeoid(:),obsAzim(:)
86 real(kind_real),
allocatable :: obsLat(:),obsLon(:)
87 real(kind_real),
allocatable :: obsLonnh(:),obsLatnh(:)
89 real(kind_real) :: dtheta
90 real(kind_real) :: ob_time
91 integer,
allocatable,
dimension(:) :: ichk
93 n_horiz = self%roconf%n_horiz
94 dtheta = self%roconf%dtheta
96 write(err_msg,*)
"TRACE: ufo_gnssro_bndropp2d_simobs: begin"
97 call fckit_log%info(err_msg)
99 if (geovals%nlocs /=
size(hofx)*n_horiz)
then
100 write(err_msg,*) myname_,
' error: 2d nlocs inconsistent! geovals%nlocs, size(hofx), &
101 and n_horiz are', geovals%nlocs,
size(hofx), n_horiz
102 call abor1_ftn(err_msg)
112 missing = missing_value(missing)
114 nlocs = obsspace_get_nlocs(obss)
117 if (prs%vals(1,1) .lt. prs%vals(prs%nval,1) )
then
119 write(err_msg,
'(a)')
' ufo_gnssro_bndropp2d_simobs:'//new_line(
'a')// &
120 ' Model vertical height profile is in descending order,'//new_line(
'a')// &
121 ' but ROPP requires it to be ascending order, need flip'
122 call fckit_log%info(err_msg)
126 allocate(obslon(nlocs))
127 allocate(obslat(nlocs))
128 allocate(obsimpp(nlocs))
129 allocate(obslocr(nlocs))
130 allocate(obsgeoid(nlocs))
131 allocate(obsazim(nlocs))
132 allocate(obslatnh(n_horiz))
133 allocate(obslonnh(n_horiz))
135 call obsspace_get_db(obss,
"MetaData",
"longitude", obslon)
136 call obsspace_get_db(obss,
"MetaData",
"latitude", obslat)
137 call obsspace_get_db(obss,
"MetaData",
"impact_parameter", obsimpp)
138 call obsspace_get_db(obss,
"MetaData",
"earth_radius_of_curvature", obslocr)
139 call obsspace_get_db(obss,
"MetaData",
"geoid_height_above_reference_ellipsoid", obsgeoid)
140 call obsspace_get_db(obss,
"MetaData",
"sensor_azimuth_angle", obsazim)
144 allocate(ichk(nvprof))
146 write(err_msg,*)
"TRACE: ufo_gnssro_bndropp2d_simobs: begin observation loop, nlocs = ", nlocs
147 call fckit_log%info(err_msg)
150 obs_loop:
do iobs = 1, nlocs
152 if ( ( obsimpp(iobs)-obslocr(iobs)-obsgeoid(iobs) ) <= self%roconf%top_2d .and. &
153 obsazim(iobs) /= missing )
then
155 obslatnh = self%obsLat2d( (iobs-1)*n_horiz+1:iobs*n_horiz )
156 obslonnh = self%obsLon2d( (iobs-1)*n_horiz+1:iobs*n_horiz )
158 t%vals(:,(iobs-1)*n_horiz+1:iobs*n_horiz), &
159 q%vals(:,(iobs-1)*n_horiz+1:iobs*n_horiz), &
160 prs%vals(:,(iobs-1)*n_horiz+1:iobs*n_horiz), &
161 gph%vals(:,(iobs-1)*n_horiz+1:iobs*n_horiz), &
162 nlev,x,n_horiz,dtheta,iflip)
172 call ropp_fm_bangle_2d(x,y)
179 t%vals(:,(iobs-1)*n_horiz+1+(n_horiz-1)/2), &
180 q%vals(:,(iobs-1)*n_horiz+1+(n_horiz-1)/2), &
181 prs%vals(:,(iobs-1)*n_horiz+1+(n_horiz-1)/2), &
182 gph%vals(:,(iobs-1)*n_horiz+1+(n_horiz-1)/2), &
184 gph_sfc%vals(1,(iobs-1)*n_horiz+1+(n_horiz-1)/2), &
196 call ropp_fm_bangle_1d(x1d,y)
201 if (y%bangle(nvprof) .lt. -900.0_wp )
then
203 y%bangle(nvprof) = missing
205 hofx(iobs) = y%bangle(nvprof)
210 if ( ( obsimpp(iobs)-obslocr(iobs)-obsgeoid(iobs) ) <= self%roconf%top_2d )
then
228 write(err_msg,*)
"TRACE: ufo_gnssro_bndropp2d_simobs: completed"
229 call fckit_log%info(err_msg)