12 use missing_values_mod
13 use,
intrinsic :: iso_c_binding
14 use kinds,
only: kind_real
15 use missing_values_mod
21 type(oops_variables),
public :: obsvars
22 type(oops_variables),
public :: geovars
23 integer :: nval, nlocs
25 real(kind_real),
dimension(:),
allocatable :: toppressure, botpressure
26 integer,
allocatable :: nlevels(:)
27 real,
allocatable :: coefficients(:)
28 real(kind_real),
allocatable :: modelpressures(:,:)
42 use fckit_configuration_module,
only: fckit_configuration
45 type(fckit_configuration),
intent(in) :: grid_conf
47 character(kind=c_char,len=:),
allocatable :: coord_name
48 character(kind=c_char,len=:),
allocatable :: gvars(:)
49 real(kind=c_double),
allocatable :: coefficients(:)
50 integer(kind=c_int),
allocatable :: nlevels(:)
52 integer :: ivar, nlevs=0, nvars=0, ngvars=0, ncoefs=0
54 if (grid_conf%has(
"geovals"))
then
55 ngvars = grid_conf%get_size(
"geovals")
56 call grid_conf%get_or_die(
"geovals", gvars)
59 call self%geovars%push_back(gvars(ivar))
62 nvars = self%obsvars%nvars()
63 if (ngvars == 0 .and. nvars > 0)
then
64 allocate(self%coefficients(nvars))
66 call self%geovars%push_back(self%obsvars%variable(ivar))
67 self%coefficients(ivar) = 1.0
70 if (grid_conf%has(
"coefficients"))
then
71 ncoefs = grid_conf%get_size(
"coefficients")
72 call grid_conf%get_or_die(
"coefficients", coefficients)
73 allocate(self%coefficients(ncoefs))
74 self%coefficients(1:ncoefs) = coefficients(1:ncoefs)
76 if (grid_conf%has(
"nlevels"))
then
77 nlevs = grid_conf%get_size(
"nlevels")
78 call grid_conf%get_or_die(
"nlevels", nlevels)
79 allocate(self%nlevels(nlevs))
80 self%nlevels(1:nlevs) = nlevels(1:nlevs)
93 type(c_ptr),
value,
intent(in) :: obss
94 integer :: iobs,nlevs,nsig,ilev
99 character(len=MAXVARLEN) :: var_zdir
100 character(len=MAXVARLEN) :: geovar
101 real(kind_real),
dimension(:),
allocatable :: airpressure
106 self%nlocs = obsspace_get_nlocs(obss)
108 allocate(self%toppressure(self%nlocs))
109 allocate(self%botpressure(self%nlocs))
110 allocate(airpressure(self%nlocs))
116 if( p_temp%vals(1,1) < p_temp%vals(p_temp%nval,1) )
then
118 self%flip_it = .true.
120 self%flip_it = .false.
125 nlevs = self%nlevels(1)
126 nsig = modelpres%nval - 1
127 self%nval = modelpres%nval
128 call obsspace_get_db(obss,
"MetaData",
"air_pressure", airpressure)
130 allocate(self%modelpressures(modelpres%nval,self%nlocs))
131 self%modelpressures(1:nsig+1,1:self%nlocs) = modelpres%vals(1:nsig+1,1:self%nlocs)
132 call get_integral_limits(airpressure(:), self%botpressure(:), self%toppressure(:), self%modelpressures(:,:), nlevs, self%nlocs, nsig)
136 deallocate(airpressure)
146 integer,
intent(in) :: nvars, nlocs
147 real(c_double),
intent(inout) :: hofx(nvars, nlocs)
148 type(c_ptr),
value,
intent(in) :: obss
150 integer :: iobs, ivar
153 character(len=MAXVARLEN) :: geovar
154 character(len=MAXVARLEN) :: var_zdir
160 geovar = self%geovars%variable(ivar)
164 if(self%flip_it) profile%vals(1:profile%nval,iobs) = profile%vals(profile%nval:1:-1,iobs)
165 call vert_interp_lay_apply_tl(profile%vals(:,iobs), hofx(ivar,iobs), self%coefficients(ivar), self%modelpressures(:,iobs), self%botpressure(iobs), self%toppressure(iobs), nsig)
177 integer,
intent(in) :: nvars, nlocs
178 real(c_double),
intent(in) :: hofx(nvars, nlocs)
179 type(c_ptr),
value,
intent(in) :: obss
181 integer :: iobs, ivar
184 character(len=MAXVARLEN) :: geovar
185 character(len=MAXVARLEN) :: var_zdir
191 geovar = self%geovars%variable(ivar)
195 call vert_interp_lay_apply_ad(profile%vals(:,iobs), hofx(ivar,iobs), self%coefficients(ivar), self%modelpressures(:,iobs), self%botpressure(iobs), self%toppressure(iobs), nsig)
197 if(self%flip_it) profile%vals(1:profile%nval,iobs) = profile%vals(profile%nval:1:-1,iobs)
211 if (
allocated(self%toppressure))
deallocate(self%toppressure)
212 if (
allocated(self%botpressure))
deallocate(self%botpressure)
213 if (
allocated(self%modelpressures))
deallocate(self%modelpressures)
subroutine atmvertinterplay_simobs_tl_(self, geovals_in, obss, nvars, nlocs, hofx)
subroutine atmvertinterplay_simobs_ad_(self, geovals, obss, nvars, nlocs, hofx)
subroutine atmvertinterplay_tlad_setup_(self, grid_conf)
subroutine destructor(self)
subroutine atmvertinterplay_tlad_settraj_(self, geovals_in, obss)
subroutine atmvertinterplay_tlad_cleanup_(self)
subroutine, public ufo_geovals_reorderzdir(self, varname, zdir)
subroutine, public ufo_geovals_copy(self, other)
Copy one GeoVaLs object into another.
subroutine, public ufo_geovals_delete(self)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
character(len=maxvarlen), parameter, public var_prsi
Fortran module to perform linear interpolation.
subroutine vert_interp_lay_apply_tl(modelozoned, layer_ozd, coefficient, modelpressure, botpressure, toppressure, nsig)
subroutine get_integral_limits(airpressure, botpressure, toppressure, modelpressure, nlevs, nlocs, nsig)
subroutine vert_interp_lay_apply_ad(modelozoneb, layer_ozb, coefficient, modelpressure, botpressure, toppressure, nsig)
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators