10 USE fckit_configuration_module,
ONLY: fckit_configuration
13 USE missing_values_mod
21 USE crtm_spccoeff,
ONLY: sc
24 USE cf_mieobs_mod,
ONLY: get_cf_aod
25 USE geos_mieobs_mod,
ONLY: get_geos_aod_tl, get_geos_aod_ad
33 CHARACTER(len=maxvarlen),
PUBLIC,
ALLOCATABLE :: varin(:)
34 INTEGER,
ALLOCATABLE :: channels(:)
35 REAL(kind_real),
ALLOCATABLE :: wavelengths(:)
41 REAL(kind_real),
ALLOCATABLE :: bext(:,:,:,:)
42 REAL(kind_real),
ALLOCATABLE :: layer_factors(:,:)
60 TYPE(fckit_configuration),
INTENT(in) :: f_confoper
61 INTEGER(c_int),
INTENT(in) :: channels(:)
63 TYPE(fckit_configuration) :: f_confopts
65 CHARACTER(len=maxvarlen),
ALLOCATABLE :: var_aerosols(:)
66 CHARACTER(len=:),
ALLOCATABLE :: str
68 CALL f_confoper%get_or_die(
"obs options",f_confopts)
74 self%n_aerosols=
SIZE(var_aerosols)
75 ALLOCATE(self%varin(self%n_aerosols))
76 self%varin(1:self%n_aerosols) = var_aerosols
78 ALLOCATE(self%channels(
SIZE(channels)))
79 ALLOCATE(self%wavelengths(
SIZE(channels)))
81 self%channels(:) = channels(:)
83 DEALLOCATE(var_aerosols)
99 IF (
ALLOCATED(self%bext))
DEALLOCATE(self%bext)
100 IF (
ALLOCATED(self%layer_factors))
DEALLOCATE(self%layer_factors)
101 IF (
ALLOCATED(self%varin))
DEALLOCATE(self%varin)
102 IF (
ALLOCATED(self%channels))
DEALLOCATE(self%channels)
103 IF (
ALLOCATED(self%wavelengths))
DEALLOCATE(self%wavelengths)
115 TYPE(c_ptr),
VALUE,
INTENT(in) :: obss
118 CHARACTER(*),
PARAMETER :: program_name =
'ufo_aodluts_tlad_mod.f90'
119 CHARACTER(255) :: message, version
120 INTEGER :: err_stat, alloc_stat
125 TYPE(crtm_channelinfo_type) :: chinfo(self%conf%n_sensors)
127 CHARACTER(len=maxvarlen),
ALLOCATABLE :: var_aerosols(:)
128 REAL(kind_real),
ALLOCATABLE :: aero_layers(:,:,:),rh(:,:)
129 REAL(kind_real),
ALLOCATABLE :: wavelengths_all(:)
137 self%n_profiles = geovals%nlocs
139 self%n_layers = temp%nval
142 err_stat = crtm_init( self%conf%sensor_id, &
144 file_path=trim(self%conf%coefficient_path), &
146 IF ( err_stat /= success )
THEN
147 message =
'error initializing crtm (settraj)'
148 CALL display_message( program_name, message, failure )
152 ALLOCATE(aero_layers(self%n_aerosols,self%n_layers,self%n_profiles),&
153 &rh(self%n_layers,self%n_profiles))
155 ALLOCATE(self%layer_factors(self%n_layers,self%n_profiles))
157 nvars=
SIZE(self%channels)
159 sensor_loop:
DO n = 1, self%conf%n_sensors
161 self%n_channels = crtm_channelinfo_n_channels(chinfo(n))
163 IF (
ALLOCATED(wavelengths_all))
DEALLOCATE(wavelengths_all)
165 ALLOCATE(wavelengths_all(self%n_channels), stat = alloc_stat)
167 wavelengths_all=1.e7/sc(chinfo(n)%sensor_index)%wavenumber(:)
169 self%wavelengths=wavelengths_all(self%channels)
172 &self%n_aerosols, self%n_profiles, self%n_layers,&
173 &geovals, aero_layers=aero_layers, rh=rh, &
174 &layer_factors=self%layer_factors)
176 ALLOCATE(self%bext(self%n_layers, nvars, self%n_aerosols, self%n_profiles))
178 CALL get_cf_aod(self%n_layers, self%n_profiles, nvars, &
179 &self%n_aerosols, self%conf%rcfile, &
180 &self%wavelengths, var_aerosols, aero_layers, rh, &
181 &ext=self%bext, rc = rc)
184 message =
'error on exit from get_cf_aod'
185 CALL display_message( program_name, message, failure )
190 DEALLOCATE(aero_layers)
191 DEALLOCATE(wavelengths_all)
195 err_stat = crtm_destroy( chinfo )
196 IF ( err_stat /= success )
THEN
197 message =
'error destroying crtm (settraj)'
198 CALL display_message( program_name, message, failure )
216 TYPE(c_ptr),
VALUE,
INTENT(in) :: obss
217 INTEGER,
INTENT(in) :: nvars, nlocs
218 REAL(c_double),
INTENT(inout) :: hofx(nvars, nlocs)
220 CHARACTER(len=*),
PARAMETER :: myname_=
"ufo_aodluts_simobs_tl"
221 CHARACTER(max_string) :: err_msg
225 CHARACTER(len=maxvarlen),
ALLOCATABLE :: var_aerosols(:)
227 REAL(kind_real),
ALLOCATABLE :: aero_layers(:,:,:)
232 IF (.NOT. self%ltraj)
THEN
233 WRITE(err_msg,*) myname_,
' trajectory wasnt set!'
234 CALL abor1_ftn(err_msg)
238 IF (geovals%nlocs /= self%n_profiles)
THEN
239 WRITE(err_msg,*) myname_,
' error: nlocs inconsistent!'
240 CALL abor1_ftn(err_msg)
248 IF (var_p%nval /= self%n_layers)
THEN
249 WRITE(err_msg,*) myname_,
' error: layers inconsistent!'
250 CALL abor1_ftn(err_msg)
253 ALLOCATE(aero_layers(self%n_aerosols,self%n_layers,self%n_profiles))
255 DO jaero=1,self%n_aerosols
257 aero_layers(jaero,:,:)=var_p%vals*self%layer_factors
260 CALL get_geos_aod_tl(self%n_layers,self%n_profiles, nvars,&
261 &self%n_aerosols, self%bext, aero_layers, aod_tot_tl=hofx)
265 DEALLOCATE(aero_layers)
266 DEALLOCATE(var_aerosols)
277 TYPE(c_ptr),
VALUE,
INTENT(in) :: obss
278 INTEGER,
INTENT(in) :: nvars, nlocs
279 REAL(c_double),
INTENT(in) :: hofx(nvars, nlocs)
281 CHARACTER(len=*),
PARAMETER :: myname_=
"ufo_aodluts_simobs_ad"
282 CHARACTER(max_string) :: err_msg
286 REAL(kind_real),
DIMENSION(:,:,:),
ALLOCATABLE :: qm_ad
287 CHARACTER(len=maxvarlen),
ALLOCATABLE :: var_aerosols(:)
288 REAL(kind_real),
DIMENSION(:,:),
ALLOCATABLE :: layer_factors
294 IF (.NOT. self%ltraj)
THEN
295 WRITE(err_msg,*) myname_,
' trajectory wasnt set!'
296 CALL abor1_ftn(err_msg)
300 IF (geovals%nlocs /= self%n_profiles)
THEN
301 WRITE(err_msg,*) myname_,
' error: nlocs inconsistent!'
302 CALL abor1_ftn(err_msg)
307 ALLOCATE(qm_ad(self%n_aerosols, self%n_layers, nlocs))
309 CALL get_geos_aod_ad(self%n_layers, nlocs, nvars, self%n_aerosols, &
310 &self%bext, hofx, qm_ad)
312 DO jaero=self%n_aerosols,1,-1
316 qm_ad(jaero,:,:) = qm_ad(jaero,:,:) * self%layer_factors
317 var_p%vals=qm_ad(jaero,:,:)
324 DEALLOCATE(var_aerosols)
326 IF (.NOT. geovals%linit ) geovals%linit=.true.
fortran module to handle tl/ad for aod observations
subroutine ufo_aodluts_tlad_delete(self)
subroutine ufo_aodluts_simobs_ad(self, geovals, obss, nvars, nlocs, hofx)
subroutine ufo_aodluts_simobs_tl(self, geovals, obss, nvars, nlocs, hofx)
subroutine ufo_aodluts_tlad_settraj(self, geovals, obss)
subroutine ufo_aodluts_tlad_setup(self, f_confoper, channels)
Fortran module to provide code shared between nonlinear and tlm/adm radiance calculations.
integer, parameter, public max_string
subroutine, public assign_aerosol_names(aerosol_option, var_aerosols)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
fortran module to provide code shared between nonlinear and tlm/adm radiance calculations
subroutine, public luts_conf_delete(conf)
subroutine, public calculate_aero_layers(aerosol_option, n_aerosols, n_profiles, n_layers, geovals, aero_layers, rh, layer_factors)
subroutine, public luts_conf_setup(conf, f_confopts, f_confoper)
fortran derived type for aod trajectory
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators