10 use fckit_configuration_module,
only: fckit_configuration
18 use missing_values_mod
19 use oops_variables_mod
30 type(oops_variables),
public :: obsvars
31 character(max_string) :: thickness_sim_option
35 real(kind=kind_real) :: rho_ice = 905.0
36 real(kind=kind_real) :: rho_snow = 330.0
37 real(kind=kind_real) :: rho_water= 1000.0
53 type(fckit_configuration),
intent(in) :: f_conf
54 real(kind=kind_real) :: rho_ice, rho_snow, rho_water
55 integer :: ivar, nvars
56 character(max_string) :: err_msg
58 nvars = self%obsvars%nvars()
60 write(err_msg,*)
'ufo_seaicethickness_tlad_setup error: only variables size 1 supported!'
61 call abor1_ftn(err_msg)
83 type(c_ptr),
value,
intent(in) :: obss
85 character(len=*),
parameter :: myname_=
"ufo_seaicethick_tlad_settraj"
87 type(
ufo_geoval),
pointer :: icethick, icefrac, snowthick
95 if (
cmp_strings(self%obsvars%variable(1),
"sea_ice_freeboard"))
then
97 self%snowthick= snowthick
100 self%icethick = icethick
101 self%icefrac = icefrac
111 real(c_double),
intent(inout) :: hofx(:)
112 type(c_ptr),
value,
intent(in) :: obss
114 character(len=*),
parameter :: myname_=
"ufo_seaicethick_simobs_tl"
115 character(max_string) :: err_msg
117 integer :: iobs, icat, ncat
118 type(
ufo_geoval),
pointer :: icethick_d, icefrac_d, snowthick
119 real(kind=kind_real) :: rho_wiw, rho_wsw
122 if (.not. self%ltraj)
then
123 write(err_msg,*) myname_,
' trajectory wasnt set!'
124 call abor1_ftn(err_msg)
128 if (geovals%nlocs /=
size(hofx,1))
then
129 write(err_msg,*) myname_,
' error: nlocs inconsistent!'
130 call abor1_ftn(err_msg)
139 if (
cmp_strings(self%obsvars%variable(1),
"sea_ice_freeboard"))
then
140 rho_wiw = (self%rho_water-self%rho_ice)/self%rho_water
141 rho_wsw = (-self%rho_snow)/self%rho_water
145 ncat = icefrac_d%nval
148 select case (trim(self%obsvars%variable(1)))
149 case (
"sea_ice_freeboard")
150 do iobs = 1,
size(hofx,1)
152 hofx(iobs) = hofx(iobs) + &
153 rho_wiw * self%icefrac%vals(icat,iobs) * icethick_d%vals(icat,iobs) + &
154 rho_wiw * icefrac_d%vals(icat,iobs) * self%icethick%vals(icat,iobs) + &
155 rho_wsw * icefrac_d%vals(icat,iobs) * self%snowthick%vals(icat,iobs)
158 case (
"sea_ice_thickness")
159 do iobs = 1,
size(hofx,1)
161 hofx(iobs) = hofx(iobs) + &
162 self%icefrac%vals(icat,iobs) * icethick_d%vals(icat,iobs) + &
163 icefrac_d%vals(icat,iobs) * self%icethick%vals(icat,iobs)
167 write(err_msg,*) myname_,
' error: no match seaice thickness_option!'
168 call abor1_ftn(err_msg)
178 real(c_double),
intent(in) :: hofx(:)
179 type(c_ptr),
value,
intent(in) :: obss
181 character(len=*),
parameter :: myname_=
"ufo_seaicethick_simobs_ad"
182 character(max_string) :: err_msg
184 integer :: iobs, icat, ncat
185 type(
ufo_geoval),
pointer :: icefrac_d, icethick_d
186 real(c_double) :: missing
187 real(kind=kind_real) :: rho_wiw, rho_wsw
190 missing = missing_value(missing)
193 if (.not. self%ltraj)
then
194 write(err_msg,*) myname_,
' trajectory wasnt set!'
195 call abor1_ftn(err_msg)
199 if (geovals%nlocs /=
size(hofx,1))
then
200 write(err_msg,*) myname_,
' error: nlocs inconsistent!'
201 call abor1_ftn(err_msg)
204 if (
cmp_strings(self%obsvars%variable(1),
"sea_ice_freeboard"))
then
205 rho_wiw = (self%rho_water-self%rho_ice)/self%rho_water
206 rho_wsw = (-self%rho_snow)/self%rho_water
209 if (.not. geovals%linit ) geovals%linit=.true.
215 ncat = self%icethick%nval
217 write(err_msg,*) myname_,
' unknown number of categories'
218 call abor1_ftn(err_msg)
223 select case (trim(self%obsvars%variable(1)))
224 case (
"sea_ice_freeboard")
225 do iobs = 1,
size(hofx,1)
226 if (hofx(iobs) /= missing)
then
228 icefrac_d%vals(icat,iobs) = icefrac_d%vals(icat,iobs)&
229 + rho_wiw*self%icethick%vals(icat,iobs) * hofx(iobs)&
230 + rho_wsw*self%snowthick%vals(icat,iobs) * hofx(iobs)
231 icethick_d%vals(icat,iobs) = icethick_d%vals(icat,iobs)&
232 + rho_wiw*self%icefrac%vals(icat,iobs) * hofx(iobs)
236 case (
"sea_ice_thickness")
237 do iobs = 1,
size(hofx,1)
238 if (hofx(iobs) /= missing)
then
240 icefrac_d%vals(icat,iobs) = icefrac_d%vals(icat,iobs) + self%icethick%vals(icat,iobs) * hofx(iobs)
241 icethick_d%vals(icat,iobs) = icethick_d%vals(icat,iobs) + self%icefrac%vals(icat,iobs) * hofx(iobs)
246 write(err_msg,*) myname_,
' error: no match seaice thickness_option!'
247 call abor1_ftn(err_msg)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
Fortran module for seaicethickness tl/ad observation operator.
subroutine ufo_seaicethickness_tlad_setup(self, f_conf)
subroutine ufo_seaicethickness_simobs_ad(self, geovals, hofx, obss)
subroutine ufo_seaicethickness_tlad_delete(self)
subroutine ufo_seaicethickness_tlad_settraj(self, geovals, obss)
subroutine ufo_seaicethickness_simobs_tl(self, geovals, hofx, obss)
integer, parameter max_string
Fortran module with various useful routines.
logical function, public cmp_strings(str1, str2)
character(len=maxvarlen), public var_seaicesnowthick
character(len=maxvarlen), public var_seaicethick
character(len=maxvarlen), public var_seaicefrac
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators
Fortran derived type for the tl/ad observation operator.