FV3 Bundle
CRTM_K_Matrix_Module.f90
Go to the documentation of this file.
1 !
2 ! CRTM_K_Matrix_Module
3 !
4 ! Module containing the CRTM K-matrix model function.
5 !
6 !
7 ! CREATION HISTORY:
8 ! Written by: Paul van Delst, 28-Jan-2005
9 ! paul.vandelst@noaa.gov
10 !
11 
13 
14 
15  ! ------------
16  ! Module usage
17  ! ------------
18  USE type_kinds, ONLY: fp
20  USE crtm_parameters, ONLY: set, not_set, zero, one, &
21  max_n_layers , &
24  max_n_stokes , &
25  max_n_angles , &
28  max_n_streams , &
30  USE crtm_spccoeff, ONLY: sc, &
31  spccoeff_isinfraredsensor , &
32  spccoeff_ismicrowavesensor, &
33  spccoeff_isvisiblesensor
57  USE crtm_predictor, ONLY: crtm_pvar_type => ivar_type, &
60  USE crtm_atmabsorption, ONLY: crtm_aavar_type => ivar_type , &
72  USE crtm_atmoptics, ONLY: aovar_type , &
73  aovar_create, &
86  USE crtm_rtsolution, ONLY: crtm_rtsolution_type , &
97  USE crtm_nltecorrection, ONLY: nlte_predictor_type , &
98  nlte_predictor_isactive , &
107 
108  ! Internal variable definition modules
109  ! ...CloudScatter
110  USE csvar_define, ONLY: csvar_type, &
112  csvar_destroy , &
114  ! ...AerosolScatter
115  USE asvar_define, ONLY: asvar_type, &
117  asvar_destroy , &
119  ! ...Radiative transfer
120  USE rtv_define, ONLY: rtv_type , &
121  rtv_associated, &
122  rtv_destroy , &
123  rtv_create
124 
125 
126  ! -----------------------
127  ! Disable implicit typing
128  ! -----------------------
129  IMPLICIT NONE
130 
131 
132  ! ------------
133  ! Visibilities
134  ! ------------
135  ! Everything private by default
136  PRIVATE
137  ! Public procedures
138  PUBLIC :: crtm_k_matrix
139  PUBLIC :: crtm_k_matrix_version
140 
141 
142  ! -----------------
143  ! Module parameters
144  ! -----------------
145  ! Version Id for the module
146  CHARACTER(*), PARAMETER :: module_version_id = &
147  '$Id: CRTM_K_Matrix_Module.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
148 
149 
150 CONTAINS
151 
152 
153 !--------------------------------------------------------------------------------
154 !:sdoc+:
155 !
156 ! NAME:
157 ! CRTM_K_Matrix
158 !
159 ! PURPOSE:
160 ! Function that calculates the K-matrix of top-of-atmosphere (TOA)
161 ! radiances and brightness temperatures for an input atmospheric
162 ! profile or profile set and user specified satellites/channels.
163 !
164 ! CALLING SEQUENCE:
165 ! Error_Status = CRTM_K_Matrix( Atmosphere , &
166 ! Surface , &
167 ! RTSolution_K , &
168 ! Geometry , &
169 ! ChannelInfo , &
170 ! Atmosphere_K , &
171 ! Surface_K , &
172 ! RTSolution , &
173 ! Options = Options )
174 !
175 ! INPUTS:
176 ! Atmosphere: Structure containing the Atmosphere data.
177 ! UNITS: N/A
178 ! TYPE: CRTM_Atmosphere_type
179 ! DIMENSION: Rank-1 (n_Profiles)
180 ! ATTRIBUTES: INTENT(IN)
181 !
182 ! Surface: Structure containing the Surface data.
183 ! UNITS: N/A
184 ! TYPE: CRTM_Surface_type
185 ! DIMENSION: Same as input Atmosphere argument.
186 ! ATTRIBUTES: INTENT(IN)
187 !
188 ! RTSolution_K: Structure containing the RT solution K-matrix inputs.
189 ! **NOTE: On EXIT from this function, the contents of
190 ! this structure may be modified (e.g. set to
191 ! zero.)
192 ! UNITS: N/A
193 ! TYPE: CRTM_RTSolution_type
194 ! DIMENSION: Rank-2 (n_Channels x n_Profiles)
195 ! ATTRIBUTES: INTENT(IN OUT)
196 !
197 ! Geometry: Structure containing the view geometry
198 ! information.
199 ! UNITS: N/A
200 ! TYPE: CRTM_Geometry_type
201 ! DIMENSION: Same as input Atmosphere argument
202 ! ATTRIBUTES: INTENT(IN)
203 !
204 ! ChannelInfo: Structure returned from the CRTM_Init() function
205 ! that contains the satellite/sesnor channel index
206 ! information.
207 ! UNITS: N/A
208 ! TYPE: CRTM_ChannelInfo_type
209 ! DIMENSION: Rank-1 (n_Sensors)
210 ! ATTRIBUTES: INTENT(IN)
211 !
212 ! OPTIONAL INPUTS:
213 ! Options: Options structure containing the optional forward model
214 ! arguments for the CRTM.
215 ! UNITS: N/A
216 ! TYPE: CRTM_Options_type
217 ! DIMENSION: Same as input Atmosphere structure
218 ! ATTRIBUTES: INTENT(IN), OPTIONAL
219 !
220 ! OUTPUTS:
221 ! Atmosphere_K: Structure containing the K-matrix Atmosphere data.
222 ! **NOTE: On ENTRY to this function, the contents of
223 ! this structure should be defined (e.g.
224 ! initialized to some value based on the
225 ! position of this function in the call chain.)
226 ! UNITS: N/A
227 ! TYPE: CRTM_Atmosphere_type
228 ! DIMENSION: Same as input RTSolution_K argument
229 ! ATTRIBUTES: INTENT(IN OUT)
230 !
231 ! Surface_K: Structure containing the tangent-linear Surface data.
232 ! **NOTE: On ENTRY to this function, the contents of
233 ! this structure should be defined (e.g.
234 ! initialized to some value based on the
235 ! position of this function in the call chain.)
236 ! UNITS: N/A
237 ! TYPE: CRTM_Surface_type
238 ! DIMENSION: Same as input RTSolution_K argument
239 ! ATTRIBUTES: INTENT(IN OUT)
240 !
241 ! RTSolution: Structure containing the solution to the RT equation
242 ! for the given inputs.
243 ! UNITS: N/A
244 ! TYPE: CRTM_RTSolution_type
245 ! DIMENSION: Same as input RTSolution_K argument
246 ! ATTRIBUTES: INTENT(IN OUT)
247 !
248 ! FUNCTION RESULT:
249 ! Error_Status: The return value is an integer defining the error status.
250 ! The error codes are defined in the Message_Handler module.
251 ! If == SUCCESS the computation was sucessful
252 ! == FAILURE an unrecoverable error occurred
253 ! UNITS: N/A
254 ! TYPE: INTEGER
255 ! DIMENSION: Scalar
256 !
257 ! SIDE EFFECTS:
258 ! Note that the input K-matrix arguments are modified upon exit, and
259 ! the output K-matrix arguments must be defined upon entry. This is
260 ! a consequence of the K-matrix formulation where, effectively, the
261 ! chain rule is being used and this funtion could reside anywhere
262 ! in the chain of derivative terms.
263 !
264 ! COMMENTS:
265 ! - The Options optional structure arguments contain
266 ! spectral information (e.g. emissivity) that must have the same
267 ! spectral dimensionality (the "L" dimension) as the RTSolution
268 ! structures.
269 !
270 !:sdoc-:
271 !--------------------------------------------------------------------------------
272 
273  FUNCTION crtm_k_matrix( &
274  Atmosphere , & ! FWD Input, M
275  Surface , & ! FWD Input, M
276  RTSolution_K, & ! K Input, L x M
277  Geometry , & ! Input, M
278  ChannelInfo , & ! Input, n_Sensors
279  Atmosphere_K, & ! K Output, L x M
280  Surface_K , & ! K Output, L x M
281  RTSolution , & ! FWD Output, L x M
282  Options ) & ! Optional FWD input, M
283  result( error_status )
284  ! Arguments
285  TYPE(crtm_atmosphere_type) , INTENT(IN) :: atmosphere(:) ! M
286  TYPE(crtm_surface_type) , INTENT(IN) :: surface(:) ! M
287  TYPE(crtm_rtsolution_type) , INTENT(IN OUT) :: rtsolution_k(:,:) ! L x M
288  TYPE(crtm_geometry_type) , INTENT(IN) :: geometry(:) ! M
289  TYPE(crtm_channelinfo_type) , INTENT(IN) :: channelinfo(:) ! n_Sensors
290  TYPE(crtm_atmosphere_type) , INTENT(IN OUT) :: atmosphere_k(:,:) ! L x M
291  TYPE(crtm_surface_type) , INTENT(IN OUT) :: surface_k(:,:) ! L x M
292  TYPE(crtm_rtsolution_type) , INTENT(IN OUT) :: rtsolution(:,:) ! L x M
293  TYPE(crtm_options_type), OPTIONAL, INTENT(IN) :: options(:) ! M
294  ! Function result
295  INTEGER :: error_status
296  ! Local parameters
297  CHARACTER(*), PARAMETER :: routine_name = 'CRTM_K_Matrix'
298  ! Local variables
299  CHARACTER(256) :: message
300  LOGICAL :: options_present
301  LOGICAL :: check_input
302  LOGICAL :: user_emissivity, user_direct_reflectivity, user_n_streams
303  LOGICAL :: user_antcorr, compute_antcorr
304  LOGICAL :: apply_nlte_correction
305  LOGICAL :: atmosphere_invalid, surface_invalid, geometry_invalid, options_invalid
306  INTEGER :: rt_algorithm_id
307  INTEGER :: ifov
308  INTEGER :: nc, na
309  INTEGER :: n, n_sensors, sensorindex
310  INTEGER :: l, n_channels, channelindex
311  INTEGER :: m, n_profiles
312  INTEGER :: j, ln
313  INTEGER :: n_full_streams, mth_azi
314  REAL(fp) :: source_za
315  REAL(fp) :: wavenumber
316  REAL(fp) :: transmittance, transmittance_k
317  ! Local ancillary input structure
318  TYPE(crtm_ancillaryinput_type) :: ancillaryinput
319  ! Local options structure for default values
320  TYPE(crtm_options_type) :: default_options
321  ! Local atmosphere structure for extra layering
322  TYPE(crtm_atmosphere_type) :: atm, atm_k
323  ! Component variables
324  TYPE(crtm_geometryinfo_type) :: geometryinfo
325  TYPE(crtm_predictor_type) :: predictor, predictor_k
326  TYPE(crtm_atmoptics_type) :: atmoptics, atmoptics_k
327  TYPE(crtm_sfcoptics_type) :: sfcoptics, sfcoptics_k
328  ! Component variable internals
329  TYPE(crtm_pvar_type) :: pvar ! Predictor
330  TYPE(crtm_aavar_type) :: aavar ! AtmAbsorption
331  TYPE(csvar_type) :: csvar ! CloudScatter
332  TYPE(asvar_type) :: asvar ! AerosolScatter
333  TYPE(aovar_type) :: aovar ! AtmOptics
334  TYPE(rtv_type) :: rtv ! RTSolution
335  ! NLTE correction term predictors
336  TYPE(nlte_predictor_type) :: nlte_predictor, nlte_predictor_k
337 
338  ! ------
339  ! SET UP
340  ! ------
341  error_status = success
342 
343 
344  ! If no sensors or channels, simply return
345  n_sensors = SIZE(channelinfo)
346  n_channels = sum(crtm_channelinfo_n_channels(channelinfo))
347  IF ( n_sensors == 0 .OR. n_channels == 0 ) RETURN
348 
349 
350  ! Check spectral arrays
351  IF ( SIZE(rtsolution ,dim=1) < n_channels .OR. &
352  SIZE(atmosphere_k,dim=1) < n_channels .OR. &
353  SIZE(surface_k ,dim=1) < n_channels .OR. &
354  SIZE(rtsolution_k,dim=1) < n_channels ) THEN
355  error_status = failure
356  WRITE( message,'("RTSolution and K-matrix (Atm,Sfc,RT) structure arrays too small (",&
357  &3(i0,","),i0,") for the number of requested channels (",i0,")")') &
358  SIZE(rtsolution ,dim=1), &
359  SIZE(atmosphere_k,dim=1), &
360  SIZE(surface_k ,dim=1), &
361  SIZE(rtsolution_k,dim=1), &
362  n_channels
363  CALL display_message( routine_name, message, error_status )
364  RETURN
365  END IF
366 
367 
368  ! Check the number of profiles
369  ! ...Number of atmospheric profiles.
370  n_profiles = SIZE(atmosphere)
371  ! ...Check the profile dimensionality of the other mandatory arguments
372  IF ( SIZE(surface) /= n_profiles .OR. &
373  SIZE(rtsolution_k,dim=2) /= n_profiles .OR. &
374  SIZE(geometry) /= n_profiles .OR. &
375  SIZE(atmosphere_k,dim=2) /= n_profiles .OR. &
376  SIZE(surface_k ,dim=2) /= n_profiles .OR. &
377  SIZE(rtsolution ,dim=2) /= n_profiles ) THEN
378  error_status = failure
379  message = 'Inconsistent profile dimensionality for input arguments.'
380  CALL display_message( routine_name, message, error_status )
381  RETURN
382  END IF
383  ! ...Check the profile dimensionality of the other optional arguments
384  options_present = .false.
385  IF ( PRESENT( options ) ) THEN
386  options_present = .true.
387  IF ( SIZE( options ) /= n_profiles ) THEN
388  error_status = failure
389  message = 'Inconsistent profile dimensionality for Options optional input argument.'
390  CALL display_message( routine_name, message, error_status )
391  RETURN
392  END IF
393  END IF
394 
395 
396  ! Allocate the profile independent surface optics local structure
397  CALL crtm_sfcoptics_create( sfcoptics , max_n_angles, max_n_stokes )
398  CALL crtm_sfcoptics_create( sfcoptics_k, max_n_angles, max_n_stokes )
399  IF ( (.NOT. crtm_sfcoptics_associated(sfcoptics )) .OR. &
400  (.NOT. crtm_sfcoptics_associated(sfcoptics_k)) ) THEN
401  error_status = failure
402  message = 'Error allocating SfcOptics data structures'
403  CALL display_message( routine_name, message, error_status )
404  RETURN
405  END IF
406 
407 
408  ! ------------
409  ! PROFILE LOOP
410  ! ------------
411  profile_loop: DO m = 1, n_profiles
412 
413 
414  ! Check the cloud and aerosol coeff. data for cases with clouds and aerosol
415  IF( atmosphere(m)%n_Clouds > 0 .AND. .NOT. crtm_cloudcoeff_isloaded() )THEN
416  error_status = failure
417  WRITE( message,'("The CloudCoeff data must be loaded (with CRTM_Init routine) ", &
418  &"for the cloudy case profile #",i0)' ) m
419  CALL display_message( routine_name, message, error_status )
420  RETURN
421  END IF
422  IF( atmosphere(m)%n_Aerosols > 0 .AND. .NOT. crtm_aerosolcoeff_isloaded() )THEN
423  error_status = failure
424  WRITE( message,'("The AerosolCoeff data must be loaded (with CRTM_Init routine) ", &
425  &"for the aerosol case profile #",i0)' ) m
426  CALL display_message( routine_name, message, error_status )
427  RETURN
428  END IF
429 
430 
431  ! Copy over forward "non-variable" inputs to K-matrix outputs
432  DO l = 1, n_channels
433  ! ...Atmosphere
434  atmosphere_k(l,m)%Climatology = atmosphere(m)%Climatology
435  ! Loop over absorbers
436  DO j = 1, atmosphere(m)%n_Absorbers
437  atmosphere_k(l,m)%Absorber_ID(j) = atmosphere(m)%Absorber_ID(j)
438  atmosphere_k(l,m)%Absorber_Units(j) = atmosphere(m)%Absorber_Units(j)
439  END DO
440  ! Loop over and assign cloud types
441  DO nc = 1, atmosphere(m)%n_Clouds
442  atmosphere_k(l,m)%Cloud(nc)%Type = atmosphere(m)%Cloud(nc)%Type
443  END DO
444  ! Loop over and assign aerosol types
445  DO na = 1, atmosphere(m)%n_Aerosols
446  atmosphere_k(l,m)%Aerosol(na)%Type = atmosphere(m)%Aerosol(na)%Type
447  END DO
448  ! ...Surface
449  surface_k(l,m)%Land_Coverage = surface(m)%Land_Coverage
450  surface_k(l,m)%Water_Coverage = surface(m)%Water_Coverage
451  surface_k(l,m)%Snow_Coverage = surface(m)%Snow_Coverage
452  surface_k(l,m)%Ice_Coverage = surface(m)%Ice_Coverage
453  surface_k(l,m)%Land_Type = surface(m)%Land_Type
454  surface_k(l,m)%Water_Type = surface(m)%Water_Type
455  surface_k(l,m)%Snow_Type = surface(m)%Snow_Type
456  surface_k(l,m)%Ice_Type = surface(m)%Ice_Type
457  END DO
458 
459 
460  ! Check the optional Options structure argument
461  ! ...Specify default actions
462  check_input = default_options%Check_Input
463  user_emissivity = default_options%Use_Emissivity
464  user_antcorr = default_options%Use_Antenna_Correction
465  apply_nlte_correction = default_options%Apply_NLTE_Correction
466  rt_algorithm_id = default_options%RT_Algorithm_Id
467  user_n_streams = default_options%Use_N_Streams
468  ! ...Check the Options argument
469  IF (options_present) THEN
470  ! Override input checker with option
471  check_input = options(m)%Check_Input
472  ! Check if the supplied emissivity should be used
473  user_emissivity = options(m)%Use_Emissivity
474  IF ( options(m)%Use_Emissivity ) THEN
475  ! Are the channel dimensions consistent
476  IF ( options(m)%n_Channels < n_channels ) THEN
477  error_status = failure
478  WRITE( message,'( "Input Options channel dimension (", i0, ") is less ", &
479  &"than the number of requested channels (",i0, ")" )' ) &
480  options(m)%n_Channels, n_channels
481  CALL display_message( routine_name, message, error_status )
482  RETURN
483  END IF
484  ! Check if the supplied direct reflectivity should be used
485  user_direct_reflectivity = options(m)%Use_Direct_Reflectivity
486  END IF
487  ! Check if antenna correction should be attempted
488  user_antcorr = options(m)%Use_Antenna_Correction
489  ! Set NLTE correction option
490  apply_nlte_correction = options(m)%Apply_NLTE_Correction
491 
492  ! Copy over ancillary input
493  ancillaryinput%SSU = options(m)%SSU
494  ancillaryinput%Zeeman = options(m)%Zeeman
495  ! Copy over surface optics input
496  sfcoptics%Use_New_MWSSEM = .NOT. options(m)%Use_Old_MWSSEM
497  ! Specify the RT algorithm
498  rt_algorithm_id = options(m)%RT_Algorithm_ID
499  ! Check if n_Streams should be used
500  user_n_streams = options(m)%Use_N_Streams
501  ! Check value for nstreams
502  IF ( user_n_streams ) THEN
503  IF ( options(m)%n_Streams <= 0 .OR. mod(options(m)%n_Streams,2) /= 0 .OR. &
504  options(m)%n_Streams > max_n_streams ) THEN
505  error_status = failure
506  WRITE( message,'( "Input Options n_Streams (", i0, ") is invalid" )' ) &
507  options(m)%n_Streams
508  CALL display_message( routine_name, message, error_status )
509  RETURN
510  END IF
511  END IF
512  END IF
513 
514 
515  ! Check the input data if required
516  IF ( check_input ) THEN
517  ! ...Mandatory inputs
518  atmosphere_invalid = .NOT. crtm_atmosphere_isvalid( atmosphere(m) )
519  surface_invalid = .NOT. crtm_surface_isvalid( surface(m) )
520  geometry_invalid = .NOT. crtm_geometry_isvalid( geometry(m) )
521  IF ( atmosphere_invalid .OR. surface_invalid .OR. geometry_invalid ) THEN
522  error_status = failure
523  WRITE( message,'("Input data check failed for profile #",i0)' ) m
524  CALL display_message( routine_name, message, error_status )
525  RETURN
526  END IF
527  ! ...Optional input
528  IF ( options_present ) THEN
529  options_invalid = .NOT. crtm_options_isvalid( options(m) )
530  IF ( options_invalid ) THEN
531  error_status = failure
532  WRITE( message,'("Options data check failed for profile #",i0)' ) m
533  CALL display_message( routine_name, message, error_status )
534  RETURN
535  END IF
536  END IF
537  END IF
538 
539 
540  ! Process geometry
541  ! ...Compute derived geometry
542  CALL crtm_geometryinfo_setvalue( geometryinfo, geometry=geometry(m) )
543  CALL crtm_geometryinfo_compute( geometryinfo )
544  ! ...Retrieve components into local variable
546  geometryinfo, &
547  ifov = ifov, &
548  source_zenith_angle = source_za )
549 
550 
551  ! Average surface skin temperature for multi-surface types
552  CALL crtm_compute_surfacet( surface(m), sfcoptics )
553 
554 
555  ! Add extra layers to current atmosphere profile
556  ! if necessary to handle upper atmosphere
557  error_status = crtm_atmosphere_addlayers( atmosphere(m), atm )
558  IF ( error_status /= success ) THEN
559  error_status = failure
560  WRITE( message,'("Error adding FWD extra layers to profile #",i0)' ) m
561  CALL display_message( routine_name, message, error_status )
562  RETURN
563  END IF
564  ! ...Check the total number of Atm layers
565  IF ( atm%n_Layers > max_n_layers ) THEN
566  error_status = failure
567  WRITE( message,'("Added layers [",i0,"] cause total [",i0,"] to exceed the ",&
568  &"maximum allowed [",i0,"] for profile #",i0)' ) &
569  atm%n_Added_Layers, atm%n_Layers, max_n_layers, m
570  CALL display_message( routine_name, message, error_status )
571  RETURN
572  END IF
573  ! ...Allocate the atmospheric optics structures based on Atm extension
574  CALL crtm_atmoptics_create( atmoptics, &
575  atm%n_Layers , &
578  CALL crtm_atmoptics_create( atmoptics_k, &
579  atm%n_Layers , &
582  IF ( .NOT. crtm_atmoptics_associated( atmoptics ) .OR. &
583  .NOT. crtm_atmoptics_associated( atmoptics_k ) ) THEN
584  error_status = failure
585  WRITE( message,'("Error allocating AtmOptics data structures for profile #",i0)' ) m
586  CALL display_message( routine_name, message, error_status )
587  RETURN
588  END IF
589  IF (options_present) THEN
590  ! Set Scattering Switch
591  atmoptics%Include_Scattering = options(m)%Include_Scattering
592  atmoptics_k%Include_Scattering = options(m)%Include_Scattering
593  END IF
594  ! ...Allocate the atmospheric optics internal structure
595  CALL aovar_create( aovar, atm%n_Layers )
596 
597 
598  ! Allocate the scattering internal variables if necessary
599  ! ...Cloud
600  IF ( atm%n_Clouds > 0 ) THEN
601  CALL csvar_create( csvar, &
604  atm%n_Layers , &
605  atm%n_Clouds )
606  END IF
607  ! ...Aerosol
608  IF ( atm%n_Aerosols > 0 ) THEN
609  CALL asvar_create( asvar, &
612  atm%n_Layers , &
613  atm%n_Aerosols )
614  END IF
615 
616 
617  ! -----------
618  ! SENSOR LOOP
619  ! -----------
620  ! Initialise channel counter for sensor(n)/channel(l) count
621  ln = 0
622 
623  sensor_loop: DO n = 1, n_sensors
624 
625 
626  ! Shorter name
627  sensorindex = channelinfo(n)%Sensor_Index
628 
629 
630  ! Check if antenna correction to be applied for current sensor
631  IF ( user_antcorr .AND. &
632  accoeff_associated( sc(sensorindex)%AC ) .AND. &
633  ifov /= 0 ) THEN
634  compute_antcorr = .true.
635  ELSE
636  compute_antcorr = .false.
637  END IF
638 
639 
640  ! Allocate the AtmAbsorption predictor structures
641  CALL crtm_predictor_create( &
642  predictor , &
643  atm%n_Layers, &
644  sensorindex , &
645  savefwv = 1 )
646  CALL crtm_predictor_create( &
647  predictor_k , &
648  atm%n_Layers, &
649  sensorindex )
650  IF ( (.NOT. crtm_predictor_associated(predictor)) .OR. &
651  (.NOT. crtm_predictor_associated(predictor_k)) ) THEN
652  error_status=failure
653  WRITE( message,'("Error allocating predictor structures for profile #",i0, &
654  &" and ",a," sensor.")' ) m, sc(sensorindex)%Sensor_Id
655  CALL display_message( routine_name, message, error_status )
656  RETURN
657  END IF
658 
659 
660  ! ...Compute forward predictors
661  CALL crtm_compute_predictors( sensorindex , & ! Input
662  atm , & ! Input
663  geometryinfo , & ! Input
664  ancillaryinput, & ! Input
665  predictor , & ! Output
666  pvar ) ! Internal variable output
667 
668 
669  ! Allocate the RTV structure if necessary
670  IF( (atm%n_Clouds > 0 .OR. &
671  atm%n_Aerosols > 0 .OR. &
672  spccoeff_isvisiblesensor( sc(sensorindex) ) ) .and. atmoptics%Include_Scattering ) THEN
673  CALL rtv_create( rtv, max_n_angles, max_n_legendre_terms, atm%n_Layers )
674  IF ( .NOT. rtv_associated(rtv) ) THEN
675  error_status=failure
676  WRITE( message,'("Error allocating RTV structure for profile #",i0, &
677  &" and ",a," sensor.")' ) m, trim(sc(sensorindex)%Sensor_Id)
678  CALL display_message( routine_name, message, error_status )
679  RETURN
680  END IF
681  ! Assign algorithm selector
682  rtv%RT_Algorithm_Id = rt_algorithm_id
683  END IF
684 
685 
686  ! Compute NLTE predictors
687  IF ( apply_nlte_correction ) THEN
688  CALL compute_nlte_predictor( &
689  sc(sensorindex)%NC, & ! Input
690  atm , & ! Input
691  geometryinfo , & ! Input
692  nlte_predictor ) ! Output
693  END IF
694 
695 
696  ! ------------
697  ! CHANNEL LOOP
698  ! ------------
699  channel_loop: DO l = 1, channelinfo(n)%n_Channels
700 
701 
702  ! Channel setup
703  ! ...Skip channel if requested
704  IF ( .NOT. channelinfo(n)%Process_Channel(l) ) cycle channel_loop
705  ! ...Shorter name
706  channelindex = channelinfo(n)%Channel_Index(l)
707  ! ...Increment the processed channel counter
708  ln = ln + 1
709  ! ...Assign sensor+channel information to output
710  rtsolution(ln,m)%Sensor_Id = channelinfo(n)%Sensor_Id
711  rtsolution(ln,m)%WMO_Satellite_Id = channelinfo(n)%WMO_Satellite_Id
712  rtsolution(ln,m)%WMO_Sensor_Id = channelinfo(n)%WMO_Sensor_Id
713  rtsolution(ln,m)%Sensor_Channel = channelinfo(n)%Sensor_Channel(l)
714  rtsolution_k(ln,m)%Sensor_Id = rtsolution(ln,m)%Sensor_Id
715  rtsolution_k(ln,m)%WMO_Satellite_Id = rtsolution(ln,m)%WMO_Satellite_Id
716  rtsolution_k(ln,m)%WMO_Sensor_Id = rtsolution(ln,m)%WMO_Sensor_Id
717  rtsolution_k(ln,m)%Sensor_Channel = rtsolution(ln,m)%Sensor_Channel
718 
719 
720  ! Initialisations
721  CALL crtm_atmoptics_zero( atmoptics )
722  transmittance_k = zero
723 
724 
725  ! Copy the input K-matrix atmosphere with extra layers if necessary
726  atm_k = crtm_atmosphere_addlayercopy( atmosphere_k(ln,m), atm%n_Added_Layers )
727 
728 
729  ! Determine the number of streams (n_Full_Streams) in up+downward directions
730  IF ( user_n_streams ) THEN
731  n_full_streams = options(m)%n_Streams
732  rtsolution(ln,m)%n_Full_Streams = n_full_streams + 2
733  rtsolution(ln,m)%Scattering_Flag = .true.
734  ELSE
735  n_full_streams = crtm_compute_nstreams( atm , & ! Input
736  sensorindex , & ! Input
737  channelindex , & ! Input
738  rtsolution(ln,m) ) ! Output
739  END IF
740  ! ...Transfer stream count to scattering structures
741  atmoptics%n_Legendre_Terms = n_full_streams
742  atmoptics_k%n_Legendre_Terms = n_full_streams
743 
744 
745  ! Compute the gas absorption
746  CALL crtm_compute_atmabsorption( sensorindex , & ! Input
747  channelindex , & ! Input
748  ancillaryinput, & ! Input
749  predictor , & ! Input
750  atmoptics , & ! Output
751  aavar ) ! Internal variable output
752 
753 
754  ! Compute the clear-sky atmospheric transmittance
755  ! for use in FASTEM-X reflection correction
756  CALL crtm_compute_transmittance(atmoptics,transmittance)
757 
758 
759  ! Compute the molecular scattering properties
760  ! ...Solar radiation
761  IF( sc(sensorindex)%Solar_Irradiance(channelindex) > zero .AND. &
762  source_za < max_source_zenith_angle) THEN
763  rtv%Solar_Flag_true = .true.
764  END IF
765  ! ...Visible channel with solar radiation
766  IF( spccoeff_isvisiblesensor( sc(sensorindex) ) .AND. rtv%Solar_Flag_true ) THEN
767  rtv%Visible_Flag_true = .true.
768  ! Rayleigh phase function has 0, 1, 2 components.
769  IF( atmoptics%n_Legendre_Terms < 4 ) THEN
770  atmoptics%n_Legendre_Terms = 4
771  atmoptics_k%n_Legendre_Terms = atmoptics%n_Legendre_Terms
772  rtsolution(ln,m)%Scattering_FLAG = .true.
773  rtsolution(ln,m)%n_Full_Streams = atmoptics%n_Legendre_Terms + 2
774  END IF
775  rtv%n_Azi = min( atmoptics%n_Legendre_Terms - 1, max_n_azimuth_fourier )
776  ! Get molecular scattering and extinction
777  wavenumber = sc(sensorindex)%Wavenumber(channelindex)
778  error_status = crtm_compute_moleculescatter( &
779  wavenumber, &
780  atm , &
781  atmoptics )
782  IF ( error_status /= success ) THEN
783  WRITE( message,'("Error computing MoleculeScatter for ",a,&
784  &", channel ",i0,", profile #",i0)') &
785  trim(channelinfo(n)%Sensor_ID), &
786  channelinfo(n)%Sensor_Channel(l), &
787  m
788  CALL display_message( routine_name, message, error_status )
789  RETURN
790  END IF
791  ELSE
792  rtv%Visible_Flag_true = .false.
793  rtv%n_Azi = 0
794  END IF
795 
796 
797  ! Compute the cloud particle absorption/scattering properties
798  IF( atm%n_Clouds > 0 ) THEN
799  error_status = crtm_compute_cloudscatter( atm , & ! Input
800  sensorindex , & ! Input
801  channelindex, & ! Input
802  atmoptics , & ! Output
803  csvar ) ! Internal variable output
804  IF (error_status /= success) THEN
805  WRITE( message,'("Error computing CloudScatter for ",a,&
806  &", channel ",i0,", profile #",i0)' ) &
807  trim(channelinfo(n)%Sensor_ID), channelinfo(n)%Sensor_Channel(l), m
808  CALL display_message( routine_name, message, error_status )
809  RETURN
810  END IF
811  END IF
812 
813 
814  ! Compute the aerosol absorption/scattering properties
815  IF ( atm%n_Aerosols > 0 ) THEN
816  error_status = crtm_compute_aerosolscatter( atm , & ! Input
817  sensorindex , & ! Input
818  channelindex, & ! Input
819  atmoptics , & ! In/Output
820  asvar ) ! Internal variable output
821  IF ( error_status /= success ) THEN
822  WRITE( message,'("Error computing AerosolScatter for ",a,&
823  &", channel ",i0,", profile #",i0)' ) &
824  trim(channelinfo(n)%Sensor_ID), channelinfo(n)%Sensor_Channel(l), m
825  CALL display_message( routine_name, message, error_status )
826  RETURN
827  END IF
828  END IF
829 
830 
831  ! Compute the combined atmospheric optical properties
832  IF( atmoptics%Include_Scattering ) THEN
833  CALL crtm_combine_atmoptics( atmoptics, aovar )
834  END IF
835  ! ...Save vertically integrated scattering optical depth for output
836  rtsolution(ln,m)%SOD = atmoptics%Scattering_Optical_Depth
837 
838 
839  ! Turn off FASTEM-X reflection correction for scattering conditions
840  IF ( crtm_include_scattering(atmoptics) .AND. spccoeff_ismicrowavesensor( sc(sensorindex) ) ) THEN
841  sfcoptics%Transmittance = -one
842  ELSE
843  sfcoptics%Transmittance = transmittance
844  END IF
845 
846 
847  ! Fill the SfcOptics structure for the optional emissivity input case.
848  ! ...Indicate SfcOptics ARE to be computed
849  sfcoptics%Compute = .true.
850  ! Change SfcOptics emissivity/reflectivity contents/computation status
851  IF ( user_emissivity ) THEN
852  sfcoptics%Compute = .false.
853  sfcoptics%Emissivity(1,1) = options(m)%Emissivity(ln)
854  sfcoptics%Reflectivity(1,1,1,1) = one - options(m)%Emissivity(ln)
855  IF ( user_direct_reflectivity ) THEN
856  sfcoptics%Direct_Reflectivity(1,1) = options(m)%Direct_Reflectivity(ln)
857  ELSE
858  sfcoptics%Direct_Reflectivity(1,1) = sfcoptics%Reflectivity(1,1,1,1)
859  END IF
860 
861  END IF
862 
863 
864  ! Fourier component loop for azimuth angles (VIS).
865  ! mth_Azi = 0 is for an azimuth-averaged value (IR, MW)
866  ! ...Initialise radiance
867  rtsolution(ln,m)%Radiance = zero
868  ! ...Initialise K-matrix atmospheric optics
869  CALL crtm_atmoptics_zero( atmoptics_k )
870 
871 
872 
873  ! ###################################################
874  ! TEMPORARY FIX : SENSOR-DEPENDENT AZIMUTH ANGLE LOOP
875  ! ###################################################
876  sensor_dependent_rtsolution: &
877  IF ( spccoeff_isinfraredsensor( sc(sensorindex) ) .OR. &
878  spccoeff_ismicrowavesensor( sc(sensorindex) ) ) THEN
879  ! ------------------------------
880  ! INFRARED and MICROWAVE sensors
881  ! ------------------------------
882 
883  ! Set dependent component counters
884  rtv%mth_Azi = 0
885  sfcoptics%mth_Azi = 0
886 
887  ! Solve the forward radiative transfer problem
888  error_status = crtm_compute_rtsolution( &
889  atm , & ! Input
890  surface(m) , & ! Input
891  atmoptics , & ! Input
892  sfcoptics , & ! Input
893  geometryinfo , & ! Input
894  sensorindex , & ! Input
895  channelindex , & ! Input
896  rtsolution(ln,m), & ! Output
897  rtv ) ! Internal variable output
898  IF ( error_status /= success ) THEN
899  WRITE( message,'( "Error computing RTSolution for ", a, &
900  &", channel ", i0,", profile #",i0)' ) &
901  trim(channelinfo(n)%Sensor_ID), channelinfo(n)%Sensor_Channel(l), m
902  CALL display_message( routine_name, message, error_status )
903  RETURN
904  END IF
905 
906  ! Compute non-LTE correction to radiance if required
907  IF ( apply_nlte_correction .AND. nlte_predictor_isactive(nlte_predictor) ) &
909  sc(sensorindex)%NC , & ! Input
910  channelindex , & ! Input
911  nlte_predictor , & ! Input
912  rtsolution(ln,m)%Radiance ) ! In/Output
913 
914  ! Convert the radiance to brightness temperature
916  sensorindex , & ! Input
917  channelindex , & ! Input
918  rtsolution(ln,m)%Radiance , & ! Input
919  rtsolution(ln,m)%Brightness_Temperature ) ! Output
920 
921  ! Compute Antenna correction to brightness temperature if required
922  IF ( compute_antcorr ) THEN
923  CALL crtm_compute_antcorr( &
924  geometryinfo , & ! Input
925  sensorindex , & ! Input
926  channelindex , & ! Input
927  rtsolution(ln,m) ) ! Output
929  geometryinfo , & ! Input
930  sensorindex , & ! Input
931  channelindex , & ! Input
932  rtsolution_k(ln,m) ) ! Output
933  END IF
934 
935  ! Compute the Planck temperature adjoijnt
937  sensorindex , & ! Input
938  channelindex , & ! Input
939  rtsolution(ln,m)%Radiance , & ! Input
940  rtsolution_k(ln,m)%Brightness_Temperature, & ! Input
941  rtsolution_k(ln,m)%Radiance ) ! Output
942  rtsolution_k(ln,m)%Brightness_Temperature = zero
943 
944  ! Compute non-LTE correction adjoint if required
945  IF ( apply_nlte_correction .AND. nlte_predictor_isactive(nlte_predictor) ) &
947  sc(sensorindex)%NC , & ! Input
948  channelindex , & ! Input
949  rtsolution_k(ln,m)%Radiance, & ! Input
950  nlte_predictor_k ) ! Output
951 
952  ! The adjoint of the radiative transfer
953  error_status = crtm_compute_rtsolution_ad( &
954  atm , & ! FWD Input
955  surface(m) , & ! FWD Input
956  atmoptics , & ! FWD Input
957  sfcoptics , & ! FWD Input
958  rtsolution(ln,m) , & ! FWD Input
959  rtsolution_k(ln,m), & ! K Input
960  geometryinfo , & ! Input
961  sensorindex , & ! Input
962  channelindex , & ! Input
963  atm_k , & ! K Output
964  surface_k(ln,m) , & ! K Output
965  atmoptics_k , & ! K Output
966  sfcoptics_k , & ! K Output
967  rtv ) ! Internal variable input
968  IF ( error_status /= success ) THEN
969  WRITE( message,'( "Error computing RTSolution_K for ", a, &
970  &", channel ", i0,", profile #",i0)' ) &
971  trim(channelinfo(n)%Sensor_ID), channelinfo(n)%Sensor_Channel(l), m
972  CALL display_message( routine_name, message, error_status )
973  RETURN
974  END IF
975 
976 
977  ELSE sensor_dependent_rtsolution
978  ! --------------
979  ! VISIBLE sensor
980  ! --------------
981  ! ...Fourier expansion over azimuth angle
982  azimuth_fourier_loop: DO mth_azi = 0, rtv%n_Azi
983 
984  ! Set dependent component counters
985  rtv%mth_Azi = mth_azi
986  sfcoptics%mth_Azi = mth_azi
987 
988  ! Solve the forward radiative transfer problem
989  error_status = crtm_compute_rtsolution( &
990  atm , & ! Input
991  surface(m) , & ! Input
992  atmoptics , & ! Input
993  sfcoptics , & ! Input
994  geometryinfo , & ! Input
995  sensorindex , & ! Input
996  channelindex , & ! Input
997  rtsolution(ln,m), & ! Output
998  rtv ) ! Internal variable output
999  IF ( error_status /= success ) THEN
1000  WRITE( message,'( "Error computing RTSolution for ", a, &
1001  &", channel ", i0,", profile #",i0)' ) &
1002  trim(channelinfo(n)%Sensor_ID), channelinfo(n)%Sensor_Channel(l), m
1003  CALL display_message( routine_name, message, error_status )
1004  RETURN
1005  END IF
1006 
1007  ! The adjoint of the radiative transfer
1008  error_status = crtm_compute_rtsolution_ad( &
1009  atm , & ! FWD Input
1010  surface(m) , & ! FWD Input
1011  atmoptics , & ! FWD Input
1012  sfcoptics , & ! FWD Input
1013  rtsolution(ln,m) , & ! FWD Input
1014  rtsolution_k(ln,m), & ! K Input
1015  geometryinfo , & ! Input
1016  sensorindex , & ! Input
1017  channelindex , & ! Input
1018  atm_k , & ! K Output
1019  surface_k(ln,m) , & ! K Output
1020  atmoptics_k , & ! K Output
1021  sfcoptics_k , & ! K Output
1022  rtv ) ! Internal variable input
1023  IF ( error_status /= success ) THEN
1024  WRITE( message,'( "Error computing RTSolution_K for ", a, &
1025  &", channel ", i0,", profile #",i0)' ) &
1026  trim(channelinfo(n)%Sensor_ID), channelinfo(n)%Sensor_Channel(l), m
1027  CALL display_message( routine_name, message, error_status )
1028  RETURN
1029  END IF
1030  END DO azimuth_fourier_loop
1031 
1032  ! Still want to convert the final FORWARD radiance to brightness temperature
1033  CALL crtm_planck_temperature( &
1034  sensorindex , & ! Input
1035  channelindex , & ! Input
1036  rtsolution(ln,m)%Radiance , & ! Input
1037  rtsolution(ln,m)%Brightness_Temperature ) ! Output
1038 
1039  END IF sensor_dependent_rtsolution
1040  ! ###################################################
1041  ! TEMPORARY FIX : SENSOR-DEPENDENT AZIMUTH ANGLE LOOP
1042  ! ###################################################
1043 
1044 
1045  ! Compute the adjoint of the combined atmospheric optical properties
1046  IF( atmoptics%Include_Scattering ) THEN
1047  CALL crtm_combine_atmoptics_ad( atmoptics, atmoptics_k, aovar )
1048  END IF
1049 
1050 
1051  ! Compute the adjoint aerosol absorption/scattering properties
1052  IF ( atm%n_Aerosols > 0 ) THEN
1053  error_status = crtm_compute_aerosolscatter_ad( atm , & ! FWD Input
1054  atmoptics , & ! FWD Input
1055  atmoptics_k , & ! K Input
1056  sensorindex , & ! Input
1057  channelindex, & ! Input
1058  atm_k , & ! K Output
1059  asvar ) ! Internal variable input
1060  IF ( error_status /= success ) THEN
1061  WRITE( message,'("Error computing AerosolScatter_K for ",a,&
1062  &", channel ",i0,", profile #",i0)' ) &
1063  trim(channelinfo(n)%Sensor_ID), channelinfo(n)%Sensor_Channel(l), m
1064  CALL display_message( routine_name, message, error_status )
1065  RETURN
1066  END IF
1067  END IF
1068 
1069 
1070  ! Compute the adjoint cloud absorption/scattering properties
1071  IF ( atm%n_Clouds > 0 ) THEN
1072  error_status = crtm_compute_cloudscatter_ad( atm , & ! FWD Input
1073  atmoptics , & ! FWD Input
1074  atmoptics_k , & ! K Input
1075  sensorindex , & ! Input
1076  channelindex, & ! Input
1077  atm_k , & ! K Output
1078  csvar ) ! Internal variable input
1079  IF ( error_status /= success ) THEN
1080  WRITE( message,'("Error computing CloudScatter_K for ",a,&
1081  &", channel ",i0,", profile #",i0)' ) &
1082  trim(channelinfo(n)%Sensor_ID), channelinfo(n)%Sensor_Channel(l), m
1083  CALL display_message( routine_name, message, error_status )
1084  RETURN
1085  END IF
1086  END IF
1087 
1088 
1089  ! Compute the adjoint molecular scattering properties
1090  IF( rtv%Visible_Flag_true ) THEN
1091  wavenumber = sc(sensorindex)%Wavenumber(channelindex)
1092  error_status = crtm_compute_moleculescatter_ad( &
1093  wavenumber , &
1094  atmoptics_k, &
1095  atm_k )
1096  IF ( error_status /= success ) THEN
1097  WRITE( message,'("Error computing MoleculeScatter_K for ",a,&
1098  &", channel ",i0,", profile #",i0)' ) &
1099  trim(channelinfo(n)%Sensor_ID), &
1100  channelinfo(n)%Sensor_Channel(l), &
1101  m
1102  CALL display_message( routine_name, message, error_status )
1103  RETURN
1104  END IF
1105  END IF
1106 
1107 
1108  ! Compute the adjoint of the total atmospheric transmittance
1109  IF ( crtm_no_scattering(atmoptics) .AND. spccoeff_ismicrowavesensor(sc(sensorindex)) ) THEN
1110  transmittance_k = sfcoptics_k%transmittance
1111  sfcoptics_k%transmittance = zero
1112  CALL crtm_compute_transmittance_ad(atmoptics,transmittance_k,atmoptics_k)
1113  END IF
1114 
1115 
1116  ! Compute the adjoint gaseous absorption
1117  CALL crtm_compute_atmabsorption_ad( sensorindex , & ! Input
1118  channelindex, & ! Input
1119  predictor , & ! FWD Input
1120  atmoptics_k , & ! K Input
1121  predictor_k , & ! K Output
1122  aavar ) ! Internal variable input
1123 
1124 
1125  ! K-matrix of the NLTE correction predictor calculations
1126  IF ( apply_nlte_correction ) THEN
1128  nlte_predictor , & ! Input
1129  nlte_predictor_k , & ! Input
1130  atm_k ) ! Output
1131  END IF
1132 
1133 
1134  ! K-matrix of the predictor calculations
1135  CALL crtm_compute_predictors_ad( sensorindex , & ! Input
1136  atm , & ! FWD Input
1137  predictor , & ! FWD Input
1138  predictor_k , & ! K Input
1139  ancillaryinput, & ! Input
1140  atm_k , & ! K Output
1141  pvar ) ! Internal variable input
1142 
1143 
1144  ! Postprocess some input data
1145  ! ...K-matrix of average surface skin temperature for multi-surface types
1146  CALL crtm_compute_surfacet_ad( surface(m), sfcoptics_k, surface_k(ln,m) )
1147  ! ...K-matrix of the atmosphere layer addition
1148  error_status = crtm_atmosphere_addlayers_ad( atmosphere(m), atm_k, atmosphere_k(ln,m) )
1149  IF ( error_status /= success ) THEN
1150  error_status = failure
1151  WRITE( message,'("Error adding AD extra layers to profile #",i0)' ) m
1152  CALL display_message( routine_name, message, error_status )
1153  RETURN
1154  END IF
1155 
1156  END DO channel_loop
1157 
1158 
1159  ! Deallocate local sensor dependent data structures
1160  ! ...RTV structure
1161  IF ( rtv_associated(rtv) ) CALL rtv_destroy(rtv)
1162  ! ...Predictor structures
1163  CALL crtm_predictor_destroy( predictor )
1164  CALL crtm_predictor_destroy( predictor_k )
1165 
1166  END DO sensor_loop
1167 
1168 
1169  ! Deallocate local sensor independent data structures
1170  ! ...Atmospheric optics
1171  CALL crtm_atmoptics_destroy( atmoptics )
1172  CALL crtm_atmoptics_destroy( atmoptics_k )
1173 
1174  END DO profile_loop
1175 
1176 
1177  ! Destroy any remaining structures
1178  CALL crtm_sfcoptics_destroy( sfcoptics )
1179  CALL crtm_sfcoptics_destroy( sfcoptics_k )
1180  CALL crtm_atmosphere_destroy( atm_k )
1181  CALL crtm_atmosphere_destroy( atm )
1182 
1183  END FUNCTION crtm_k_matrix
1184 
1185 
1186 !--------------------------------------------------------------------------------
1187 !:sdoc+:
1188 !
1189 ! NAME:
1190 ! CRTM_K_Matrix_Version
1191 !
1192 ! PURPOSE:
1193 ! Subroutine to return the module version information.
1194 !
1195 ! CALLING SEQUENCE:
1196 ! CALL CRTM_K_Matrix_Version( Id )
1197 !
1198 ! OUTPUTS:
1199 ! Id: Character string containing the version Id information
1200 ! for the module.
1201 ! UNITS: N/A
1202 ! TYPE: CHARACTER(*)
1203 ! DIMENSION: Scalar
1204 ! ATTRIBUTES: INTENT(OUT)
1205 !
1206 !:sdoc-:
1207 !--------------------------------------------------------------------------------
1208 
1209  SUBROUTINE crtm_k_matrix_version( Id )
1210  CHARACTER(*), INTENT(OUT) :: id
1211  id = module_version_id
1212  END SUBROUTINE crtm_k_matrix_version
1213 
1214 
1215 END MODULE crtm_k_matrix_module
integer function, public crtm_compute_aerosolscatter_ad(Atm, AScat, AScat_AD, SensorIndex, ChannelIndex, Atm_AD, ASV)
subroutine, public crtm_compute_transmittance(atmoptics, transmittance)
logical function, public crtm_aerosolcoeff_isloaded()
integer, parameter, public max_n_azimuth_fourier
elemental type(crtm_atmosphere_type) function, public crtm_atmosphere_addlayercopy(atm, n_Added_Layers)
logical function, public crtm_cloudcoeff_isloaded()
integer, parameter, public failure
integer function, public crtm_k_matrix(Atmosphere, Surface, RTSolution_K, Geometry, ChannelInfo, Atmosphere_K, Surface_K, RTSolution, Options)
integer, parameter, public set
real(fp), parameter, public zero
integer, parameter, public warning
integer, parameter, public max_n_phase_elements
subroutine, public crtm_combine_atmoptics(AtmOptics, AOvar)
logical function, public crtm_options_isvalid(self)
integer, parameter, public fp
Definition: Type_Kinds.f90:124
elemental subroutine, public crtm_atmosphere_destroy(Atm)
integer, parameter, public max_n_angles
real(fp), parameter, public scattering_albedo_threshold
integer function, public crtm_compute_moleculescatter_ad(Wavenumber, AtmOptics_AD, Atmosphere_AD, Message_Log)
elemental subroutine, public crtm_geometryinfo_setvalue(gInfo, Geometry, iFOV, Longitude, Latitude, Surface_Altitude, Sensor_Scan_Angle, Sensor_Zenith_Angle, Sensor_Azimuth_Angle, Source_Zenith_Angle, Source_Azimuth_Angle, Flux_Zenith_Angle, Year, Month, Day, Distance_Ratio, Sensor_Scan_Radian, Sensor_Zenith_Radian, Sensor_Azimuth_Radian, Secant_Sensor_Zenith, Cosine_Sensor_Zenith, Source_Zenith_Radian, Source_Azimuth_Radian, Secant_Source_Zenith, Flux_Zenith_Radian, Secant_Flux_Zenith, Trans_Zenith_Radian, Secant_Trans_Zenith, AU_ratio2)
logical function, public crtm_atmosphere_isvalid(Atm)
subroutine, public crtm_combine_atmoptics_ad(AtmOptics, AtmOptics_AD, AOvar)
elemental subroutine, public crtm_atmoptics_destroy(self)
elemental subroutine, public csvar_create(self, n_Legendre_Terms, n_Phase_Elements, n_Layers, n_Clouds)
elemental subroutine, public crtm_geometryinfo_compute(gInfo)
elemental subroutine, public crtm_predictor_create(self, n_Layers, SensorIndex, SaveFWV)
pure logical function, public crtm_include_scattering(atmoptics)
integer, parameter, public max_n_legendre_terms
elemental subroutine, public crtm_sfcoptics_create(SfcOptics, n_Angles, n_Stokes)
character(*), parameter module_version_id
integer function, public crtm_compute_rtsolution(Atmosphere, Surface, AtmOptics, SfcOptics, GeometryInfo, SensorIndex, ChannelIndex, RTSolution, RTV)
elemental logical function, public crtm_atmoptics_associated(self)
real(fp), parameter, public max_source_zenith_angle
elemental subroutine, public rtv_create(RTV, n_Angles, n_Legendre_Terms, n_Layers)
Definition: RTV_Define.f90:408
elemental subroutine, public crtm_atmoptics_zero(self)
integer, parameter, public max_n_streams
pure logical function, public crtm_no_scattering(atmoptics)
integer, parameter, public max_n_stokes
integer function, public crtm_compute_aerosolscatter(Atm, SensorIndex, ChannelIndex, AScat, ASV)
subroutine, public crtm_compute_surfacet_ad(Surface, SfcOptics_AD, Surface_AD)
subroutine, public crtm_planck_temperature_ad(n, l, Radiance, Temperature_AD, Radiance_AD)
integer function, public crtm_compute_cloudscatter(Atm, SensorIndex, ChannelIndex, CScat, CSV)
integer, parameter, public not_set
real(fp), parameter, public one
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
integer function, public crtm_compute_moleculescatter(Wavenumber, Atmosphere, AtmOptics, Message_Log)
elemental logical function, public csvar_associated(self)
integer function, public crtm_atmosphere_addlayers_ad(Atm_In, Atm_Out_AD, Atm_In_AD)
subroutine, public crtm_compute_surfacet(Surface, SfcOptics)
subroutine, public compute_nlte_predictor_ad(NLTE_Predictor, NLTE_Predictor_AD, Atm_AD)
subroutine, public crtm_compute_antcorr(gI, n, l, RT)
elemental subroutine, public asvar_destroy(self)
elemental logical function, public crtm_sfcoptics_associated(SfcOptics)
elemental subroutine, public csvar_destroy(self)
integer function, public crtm_compute_nstreams(Atmosphere, SensorIndex, ChannelIndex, RTSolution)
elemental subroutine, public crtm_atmoptics_create(self, n_Layers, n_Legendre_Terms, n_Phase_Elements)
logical function, public crtm_surface_isvalid(Sfc)
logical function, public crtm_geometry_isvalid(geo)
integer function, public crtm_compute_cloudscatter_ad(Atm, CScat, CScat_AD, SensorIndex, ChannelIndex, Atm_AD, CSV)
elemental subroutine, public crtm_predictor_destroy(self)
subroutine, public crtm_compute_transmittance_ad(atmoptics, transmittance_AD, atmoptics_AD)
subroutine, public crtm_compute_predictors(SensorIndex, Atmosphere, GeometryInfo, AncillaryInput, Predictor, iVar)
subroutine, public compute_nlte_correction_ad(NLTECoeff, ChannelIndex, Radiance_AD, NLTE_Predictor_AD)
integer function, public crtm_compute_rtsolution_ad(Atmosphere, Surface, AtmOptics, SfcOptics, RTSolution, RTSolution_AD, GeometryInfo, SensorIndex, ChannelIndex, Atmosphere_AD, Surface_AD, AtmOptics_AD, SfcOptics_AD, RTV)
type(spccoeff_type), dimension(:), allocatable, save, public sc
elemental logical function, public asvar_associated(self)
integer, parameter, public max_n_layers
subroutine, public compute_nlte_correction(NLTECoeff, ChannelIndex, NLTE_Predictor, Radiance)
subroutine, public crtm_k_matrix_version(Id)
subroutine, public crtm_compute_atmabsorption_ad(SensorIndex, ChannelIndex, Predictor, AtmOptics_AD, Predictor_AD, iVar)
subroutine, public crtm_compute_atmabsorption(SensorIndex, ChannelIndex, AncillaryInput, Predictor, AtmOptics, iVar)
elemental subroutine, public crtm_sfcoptics_destroy(SfcOptics)
subroutine, public crtm_compute_predictors_ad(SensorIndex, Atmosphere, Predictor, Predictor_AD, AncillaryInput, Atmosphere_AD, iVar)
integer function, public crtm_atmosphere_addlayers(Atm_In, Atm_Out)
subroutine, public crtm_planck_temperature(n, l, Radiance, Temperature)
elemental integer function, public crtm_channelinfo_n_channels(ChannelInfo)
subroutine, public compute_nlte_predictor(NLTECoeff, Atm, gInfo, NLTE_Predictor)
elemental logical function, public crtm_predictor_associated(self)
#define min(a, b)
Definition: mosaic_util.h:32
elemental logical function, public rtv_associated(RTV)
Definition: RTV_Define.f90:314
elemental subroutine, public asvar_create(self, n_Legendre_Terms, n_Phase_Elements, n_Layers, n_Aerosols)
subroutine, public crtm_compute_antcorr_ad(gI, n, l, RT_AD)
integer, parameter, public success
elemental subroutine, public crtm_geometryinfo_getvalue(gInfo, Geometry, iFOV, Longitude, Latitude, Surface_Altitude, Sensor_Scan_Angle, Sensor_Zenith_Angle, Sensor_Azimuth_Angle, Source_Zenith_Angle, Source_Azimuth_Angle, Flux_Zenith_Angle, Year, Month, Day, Distance_Ratio, Sensor_Scan_Radian, Sensor_Zenith_Radian, Sensor_Azimuth_Radian, Secant_Sensor_Zenith, Cosine_Sensor_Zenith, Source_Zenith_Radian, Source_Azimuth_Radian, Secant_Source_Zenith, Flux_Zenith_Radian, Secant_Flux_Zenith, Trans_Zenith_Radian, Secant_Trans_Zenith, AU_ratio2)
elemental logical function, public accoeff_associated(ACCoeff)
elemental subroutine, public rtv_destroy(RTV)
Definition: RTV_Define.f90:348
integer function, public crtm_get_pressurelevelidx(Atm, Level_Pressure)
elemental logical function, public nltecoeff_associated(NLTECoeff)