10 USE fckit_configuration_module,
ONLY: fckit_configuration
13 USE missing_values_mod
21 USE crtm_spccoeff,
ONLY: sc
24 USE fv3_mieobs_mod,
ONLY: get_fv3_aod
32 CHARACTER(len=maxvarlen),
PUBLIC,
ALLOCATABLE :: varin(:)
33 INTEGER,
ALLOCATABLE :: channels(:)
34 REAL(kind_real),
ALLOCATABLE :: wavelenghts(:)
55 TYPE(fckit_configuration),
INTENT(in) :: f_confoper
56 INTEGER(c_int),
INTENT(in) :: channels(:)
58 INTEGER :: nvars_in, rc
59 CHARACTER(len=max_string) :: err_msg
60 TYPE(fckit_configuration) :: f_confopts
62 CHARACTER(len=maxvarlen),
ALLOCATABLE :: var_aerosols(:)
64 CALL f_confoper%get_or_die(
"obs options",f_confopts)
70 self%n_aerosols=
SIZE(var_aerosols)
73 ALLOCATE(self%varin(nvars_in))
77 ALLOCATE(self%channels(
SIZE(channels)))
78 ALLOCATE(self%wavelenghts(
SIZE(channels)))
80 self%channels(:) = channels(:)
82 DEALLOCATE(var_aerosols)
95 IF (
ALLOCATED(self%varin))
DEALLOCATE(self%varin)
96 IF (
ALLOCATED(self%channels))
DEALLOCATE(self%channels)
97 IF (
ALLOCATED(self%wavelenghts))
DEALLOCATE(self%wavelenghts)
108 INTEGER,
INTENT(in) :: nvars, nlocs
109 REAL(c_double),
INTENT(inout) :: hofx(nvars, nlocs)
110 TYPE(c_ptr),
VALUE,
INTENT(in) :: obss
113 CHARACTER(*),
PARAMETER :: program_name =
'ufo_aodluts_mod.f90'
114 CHARACTER(255) :: message, version
115 INTEGER :: err_stat, alloc_stat
116 INTEGER :: l, m, n, i
118 REAL(c_double) :: missing
120 INTEGER :: n_profiles
122 INTEGER :: n_channels
123 INTEGER :: n_aerosols
126 TYPE(crtm_channelinfo_type) :: chinfo(self%conf%n_sensors)
128 REAL(kind_real),
ALLOCATABLE :: wavelenghts_all(:)
129 REAL(kind_real),
ALLOCATABLE :: aero_layers(:,:,:),rh(:,:)
131 CHARACTER(len=maxvarlen),
ALLOCATABLE :: var_aerosols(:)
137 n_profiles = geovals%nlocs
142 n_aerosols=self%n_aerosols
144 ALLOCATE(aero_layers(n_aerosols,n_layers,n_profiles),&
145 &rh(n_layers,n_profiles))
147 err_stat = crtm_init( self%conf%sensor_id, &
149 file_path=trim(self%conf%coefficient_path), &
152 IF ( err_stat /= success )
THEN
153 message =
'error initializing crtm'
154 CALL display_message( program_name, message, failure )
158 sensor_loop:
DO n = 1, self%conf%n_sensors
160 n_channels = crtm_channelinfo_n_channels(chinfo(n))
162 IF (
ALLOCATED(wavelenghts_all))
DEALLOCATE(wavelenghts_all)
164 ALLOCATE(wavelenghts_all(n_channels), stat = alloc_stat)
166 IF ( alloc_stat /= 0 )
THEN
167 message =
'error allocating wavelenghts_all'
168 CALL display_message( program_name, message, failure )
172 wavelenghts_all=1.e7/sc(chinfo(n)%sensor_index)%wavenumber(:)
174 self%wavelenghts=wavelenghts_all(self%channels)
177 &n_aerosols, n_profiles, n_layers,&
178 &geovals, aero_layers=aero_layers, rh=rh)
180 CALL get_fv3_aod(n_layers, n_profiles, nvars, n_aerosols, &
182 &self%wavelenghts, var_aerosols, aero_layers, rh, &
183 &aod_tot = hofx, rc = rc)
185 DEALLOCATE(aero_layers,rh,wavelenghts_all)
188 message =
'error on exit from get_fv3_aod'
189 CALL display_message( program_name, message, failure )
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 )