4 use fckit_log_module,
only : fckit_log
5 use kinds,
only : kind_real
21 type(
ufo_locs),
intent(inout) :: locs
23 type(c_ptr),
value,
intent(in) :: obss
24 type(datetime),
intent(in) :: t1, t2
26 character(len=*),
parameter :: myname =
"ufo_gnssro_2d_locs_init"
28 character(max_string) :: err_msg
30 integer :: i, j, tw_nlocs,nlocs
31 integer,
dimension(:),
allocatable :: tw_indx
32 real(kind_real),
dimension(:),
allocatable :: lon, lat
33 type(datetime),
dimension(:),
allocatable :: date_time
36 real(kind_real),
dimension(:),
allocatable :: obsazim
37 real(kind_real),
dimension(self%roconf%n_horiz) :: plat_2d, plon_2d
38 integer :: kerror, n_horiz
39 real(kind_real) :: dtheta
41 dtheta = self%roconf%dtheta
42 n_horiz = self%roconf%n_horiz
44 nlocs = obsspace_get_nlocs(obss)
46 allocate(date_time(nlocs), lon(nlocs), lat(nlocs))
48 call obsspace_get_db(obss,
"MetaData",
"datetime", date_time)
49 call obsspace_get_db(obss,
"MetaData",
"longitude", lon)
50 call obsspace_get_db(obss,
"MetaData",
"latitude", lat)
53 allocate(tw_indx(nlocs))
56 if (date_time(i) > t1 .and. date_time(i) <= t2)
then
57 tw_nlocs = tw_nlocs + 1
62 allocate(obsazim(nlocs))
63 if (obsspace_has(obss,
"ObsValue",
"bending_angle"))
then
64 if (obsspace_has(obss,
"MetaData",
"sensor_azimuth_angle"))
then
65 call obsspace_get_db(obss,
"MetaData",
"sensor_azimuth_angle", obsazim)
67 write(err_msg,*) myname,
' error: sensor_azimuth_angle not found'
68 call abor1_ftn(err_msg)
75 call ropp_fm_2d_plane(lat(tw_indx(i)),lon(tw_indx(i)),obsazim(tw_indx(i)),dtheta,n_horiz,plat_2d,plon_2d,kerror)
76 locs%lon( (i-1)*n_horiz+1 : i*n_horiz) = plon_2d
77 locs%lat( (i-1)*n_horiz+1 : i*n_horiz) = plat_2d
79 self%obsLat2d( (i-1)*n_horiz+1 : i*n_horiz) = locs%lat( (i-1)*n_horiz+1 : i*n_horiz)
80 self%obsLon2d( (i-1)*n_horiz+1 : i*n_horiz) = locs%lon( (i-1)*n_horiz+1 : i*n_horiz)
82 locs%indx((i-1)*n_horiz+j) = (tw_indx(i)-1)*n_horiz+j
83 locs%time((i-1)*n_horiz+j) = date_time(tw_indx(i))
88 call datetime_delete(date_time(i))
90 deallocate(date_time, lon, lat, tw_indx, obsazim)