FV3 Bundle
ODSSU_AtmAbsorption.f90
Go to the documentation of this file.
1 !
2 ! ODSSU_AtmAbsorption
3 !
4 ! Module containing routines to compute the optical depth profile for SSUs
5 !
6 !
7 ! CREATION HISTORY:
8 ! Based on CRTM_AtmAbsorption_ssu by: Quanhua Liu, JCSDA, Dec 1, 2007
9 ! Rewritten for CRTMv2.0 by: Yong Han, NOAA/NESDIS, Oct 6, 2009
10 ! Revised by: Paul van Delst, , JCSDA, Oct 26, 2009
11 ! Revised by: Quanhua Liu, JCSDA, Oct 29, 2009
12 ! Revised by: Yong Chen, JCSDA, Nov 9, 2009
13 !
14 
16 
17  ! -----------------
18  ! Environment setup
19  ! -----------------
20  ! Module use
21  USE type_kinds, ONLY: fp
24  USE crtm_parameters, ONLY: zero, one
27  USE ssu_input_define, ONLY: ssu_input_type, &
30  USE odssu_taucoeff, ONLY: tc
31  ! ...ODAS modules
33  USE odas_atmabsorption, ONLY: odas_aavar_type => ivar_type , &
37  ! ...ODPS modules
42  ! Disable implicit typing
43  IMPLICIT NONE
44 
45  ! ------------
46  ! Visibilities
47  ! ------------
48  ! Everything private by default
49  PRIVATE
50  ! Datatypes
51  PUBLIC :: ivar_type
52  ! Procedures
53  PUBLIC :: odssu_compute_weights
57 
58 
59  ! -------------------
60  ! Procedure overloads
61  ! -------------------
63  MODULE PROCEDURE compute_odas_atmabsorption
64  MODULE PROCEDURE compute_odps_atmabsorption
65  END INTERFACE odssu_compute_atmabsorption
66 
68  MODULE PROCEDURE compute_odas_atmabsorption_tl
69  MODULE PROCEDURE compute_odps_atmabsorption_tl
70  END INTERFACE odssu_compute_atmabsorption_tl
71 
73  MODULE PROCEDURE compute_odas_atmabsorption_ad
74  MODULE PROCEDURE compute_odps_atmabsorption_ad
75  END INTERFACE odssu_compute_atmabsorption_ad
76 
77 
78  ! ----------
79  ! Parameters
80  ! ----------
81  CHARACTER(*), PARAMETER :: module_version_id = &
82  '$Id: ODSSU_AtmAbsorption.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
83  ! Message string length
84  INTEGER, PARAMETER :: ml = 256
85 
86 
87  ! ------------------------------------------
88  ! Structure definition to hold forward model
89  ! variables across FWD, TL, and AD calls
90  ! ------------------------------------------
91  TYPE :: ivar_type
92  PRIVATE
93  TYPE(odas_aavar_type) :: odas(2)
94  REAL(fp) :: weight(2) = zero
95  REAL(fp) :: co2_cell = zero
96  INTEGER :: index_low = 1
97  END TYPE ivar_type
98 
99 
100 
101 CONTAINS
102 
103 
104 !################################################################################
105 !################################################################################
106 !## ##
107 !## ## PUBLIC MODULE ROUTINES ## ##
108 !## ##
109 !################################################################################
110 !################################################################################
111 
112 !------------------------------------------------------------------------------
113 !
114 ! NAME:
115 ! ODSSU_Compute_Weights
116 !
117 ! PURPOSE:
118 ! Subroutine to calculate ODSSU algorithm linear interpolation weighting
119 ! factors for the SSU CO2 cell pressure.
120 !
121 ! CALLING SEQUENCE:
122 ! CALL ODSSU_Compute_Weights( SSU_Input , &
123 ! SensorIndex , &
124 ! ChannelIndex, &
125 ! iVar )
126 !
127 ! INPUTS:
128 ! SSU_Input: Structure containing the SSU input data.
129 ! UNITS: N/A
130 ! TYPE: SSU_Input_type
131 ! DIMENSION: Scalar
132 ! ATTRIBUTES: INTENT(IN)
133 !
134 ! SensorIndex: Sensor index id. This is a unique index associated
135 ! with a (supported) sensor used to access the
136 ! shared coefficient data for a particular sensor.
137 ! See the ChannelIndex argument.
138 ! UNITS: N/A
139 ! TYPE: INTEGER
140 ! DIMENSION: Scalar
141 ! ATTRIBUTES: INTENT(IN)
142 !
143 ! ChannelIndex: Channel index id. This is a unique index associated
144 ! with a (supported) sensor channel used to access the
145 ! shared coefficient data for a particular sensor's
146 ! channel.
147 ! See the SensorIndex argument.
148 ! UNITS: N/A
149 ! TYPE: INTEGER
150 ! DIMENSION: Scalar
151 ! ATTRIBUTES: INTENT(IN)
152 !
153 ! OUTPUTS:
154 ! iVar: Structure containing internal variables required for
155 ! subsequent tangent-linear or adjoint model calls.
156 ! The contents of this structure are NOT accessible
157 ! outside of this module.
158 ! UNITS: N/A
159 ! TYPE: iVar_type
160 ! DIMENSION: Scalar
161 ! ATTRIBUTES: INTENT(IN OUT)
162 !
163 !:sdoc-:
164 !------------------------------------------------------------------------------
165 
166  SUBROUTINE odssu_compute_weights( &
167  SSU_Input , & ! Input
168  SensorIndex , & ! Input
169  ChannelIndex, & ! Input
170  iVar ) ! Internal variable output
171  ! Arguments
172  TYPE(ssu_input_type), INTENT(IN) :: ssu_input
173  INTEGER , INTENT(IN) :: sensorindex
174  INTEGER , INTENT(IN) :: channelindex
175  TYPE(ivar_type) , INTENT(IN OUT) :: ivar
176  ! Parameters
177  CHARACTER(*), PARAMETER :: routine_name = 'ODSSU_Compute_Weights'
178  ! Variables
179  CHARACTER(ML) :: msg
180  REAL(fp) :: time, cell_pressure
181 
182  ! Compute the CO2 cell pressure
183  IF( ssu_input_cellpressureisset(ssu_input) ) THEN
184  ! ...Interpolate the cell pressure data
185  CALL ssu_input_getvalue( ssu_input, &
186  channel = channelindex, &
187  cell_pressure = cell_pressure )
188  ivar%CO2_Cell = cell_pressure
189  ivar%Index_low = bisection_search( tc(sensorindex)%TC_CellPressure(:,channelindex), ivar%CO2_Cell )
190  ELSE
191  ! ...Get the mission time
192  CALL ssu_input_getvalue( ssu_input, time=time )
193  IF( time < tc(sensorindex)%Ref_Time(1) )THEN
194  time = tc(sensorindex)%Ref_Time(1)
195  WRITE( msg,'("Invalid time. Reset to ",f8.2)' ) time
196  CALL display_message( routine_name, trim(msg), warning )
197  END IF
198  ! ...Obtain CO2 cell pressure for given time
199  CALL get_co2_cell_p( sensorindex, channelindex, time, ivar%CO2_Cell )
200  ivar%Index_low = bisection_search( tc(sensorindex)%TC_CellPressure(:,channelindex), ivar%CO2_Cell )
201  END IF
202 
203 
204  ! Compute the interpolation weights
205  ivar%Weight(1) = (ivar%CO2_Cell - tc(sensorindex)%TC_CellPressure(ivar%Index_low,channelindex))/ &
206  (tc(sensorindex)%TC_CellPressure(ivar%Index_low+1,channelindex) - &
207  tc(sensorindex)%TC_CellPressure(ivar%Index_low ,channelindex) )
208  ivar%Weight(2) = one - ivar%Weight(1)
209 
210  END SUBROUTINE odssu_compute_weights
211 
212 
213 !------------------------------------------------------------------------------
214 !:sdoc+:
215 !
216 ! NAME:
217 ! ODSSU_Compute_AtmAbsorption
218 !
219 ! PURPOSE:
220 ! Subroutine to calculate the layer optical depths due to gaseous
221 ! absorption for the SSU sensor for a given channel and atmospheric
222 ! profile.
223 !
224 ! CALLING SEQUENCE:
225 ! CALL ODSSU_Compute_AtmAbsorption( SensorIndex , &
226 ! ChannelIndex, &
227 ! Predictor , &
228 ! AtmOptics , &
229 ! iVar )
230 !
231 ! INPUTS:
232 ! SensorIndex: Sensor index id. This is a unique index associated
233 ! with a (supported) sensor used to access the
234 ! shared coefficient data for a particular sensor.
235 ! See the ChannelIndex argument.
236 ! UNITS: N/A
237 ! TYPE: INTEGER
238 ! DIMENSION: Scalar
239 ! ATTRIBUTES: INTENT(IN)
240 !
241 ! ChannelIndex: Channel index id. This is a unique index associated
242 ! with a (supported) sensor channel used to access the
243 ! shared coefficient data for a particular sensor's
244 ! channel.
245 ! See the SensorIndex argument.
246 ! UNITS: N/A
247 ! TYPE: INTEGER
248 ! DIMENSION: Scalar
249 ! ATTRIBUTES: INTENT(IN)
250 !
251 ! *********** INTENT NEEDS TO BE CORRECTED TO JUST (IN) ***********
252 ! *********** PREDICTOR CAN BE MODIFIED IN ODPS_AtmAbsorption MODULE ************
253 ! Predictor: Structure containing the integrated absorber and
254 ! predictor profile data.
255 ! UNITS: N/A
256 ! TYPE: ODAS_Predictor_type
257 ! or
258 ! ODPS_Predictor_type
259 ! DIMENSION: Scalar
260 ! ATTRIBUTES: INTENT(IN OUT)
261 ! *********** INTENT NEEDS TO BE CORRECTED TO JUST (IN) ***********
262 ! *********** PREDICTOR CAN BE MODIFIED IN ODPS_AtmAbsorption MODULE ************
263 !
264 ! iVar: Structure containing internal variables required for
265 ! subsequent tangent-linear or adjoint model calls.
266 ! The contents of this structure are NOT accessible
267 ! outside of this module.
268 ! UNITS: N/A
269 ! TYPE: iVar_type
270 ! DIMENSION: Scalar
271 ! ATTRIBUTES: INTENT(IN)
272 !
273 ! OUTPUTS:
274 ! AtmOptics: Structure containing the computed optical depth
275 ! profile.
276 ! UNITS: N/A
277 ! TYPE: CRTM_AtmOptics_type
278 ! DIMENSION: Scalar
279 ! ATTRIBUTES: INTENT(IN OUT)
280 !
281 ! COMMENTS:
282 ! Note the INTENT on the output structure arguments are IN OUT rather
283 ! than just OUT. This is to prevent default reinitialisation upon entry.
284 !
285 !:sdoc-:
286 !------------------------------------------------------------------------------
287 
288  SUBROUTINE compute_odas_atmabsorption( &
289  SensorIndex , & ! Input
290  ChannelIndex , & ! Input
291  Predictor , & ! Input
292  AtmOptics , & ! Output
293  iVar ) ! Internal variable In/output
294  ! Arguments
295  INTEGER , INTENT(IN) :: SensorIndex
296  INTEGER , INTENT(IN) :: ChannelIndex
297  TYPE(ODAS_Predictor_type), INTENT(IN) :: Predictor
298  TYPE(CRTM_AtmOptics_type), INTENT(IN OUT) :: AtmOptics
299  TYPE(iVar_type) , INTENT(IN OUT) :: iVar
300  ! Variables
301  REAL(fp) :: optical_depth( AtmOptics%n_Layers )
302 
303 
304  ! Compute the optical depths
305  ! ...At cell pressure 1
307  tc(sensorindex)%ODAS(ivar%Index_low), &
308  channelindex , &
309  predictor , &
310  atmoptics , &
311  ivar%ODAS(1) )
312  optical_depth = atmoptics%Optical_Depth
313  ! ...At cell pressure 2
315  tc(sensorindex)%ODAS(ivar%Index_low+1), &
316  channelindex , &
317  predictor , &
318  atmoptics , &
319  ivar%ODAS(2) )
320  ! ...Weighted average
321  atmoptics%Optical_Depth = ivar%Weight(1)*atmoptics%Optical_Depth + &
322  ivar%Weight(2)*optical_depth
323 
324  END SUBROUTINE compute_odas_atmabsorption
325 
326 
327  SUBROUTINE compute_odps_atmabsorption( &
328  SensorIndex , & ! Input
329  ChannelIndex, & ! Input
330  Predictor , & ! Input
331  AtmOptics , & ! Output
332  iVar ) ! Internal variable In/output
333  ! Arguments
334  INTEGER , INTENT(IN) :: SensorIndex
335  INTEGER , INTENT(IN) :: ChannelIndex
336  TYPE(ODPS_Predictor_type), INTENT(IN OUT) :: Predictor ! INTENT! PREDICTOR CAN BE MODIFIED IN ODPS_AtmAbsorption MODULE
337  TYPE(CRTM_AtmOptics_type), INTENT(IN OUT) :: AtmOptics
338  TYPE(iVar_type) , INTENT(IN OUT) :: iVar
339  ! Variables
340  REAL(fp) :: optical_depth( AtmOptics%n_Layers )
341 
342  ! Compute the optical depths
343  ! ...At cell pressure 1
345  tc(sensorindex)%ODPS(ivar%Index_low), &
346  channelindex , &
347  predictor , &
348  atmoptics )
349  optical_depth = atmoptics%Optical_Depth
350  ! ...At cell pressure 2
352  tc(sensorindex)%ODPS(ivar%Index_low+1), &
353  channelindex , &
354  predictor , &
355  atmoptics )
356  ! ...Weighted average
357  atmoptics%Optical_Depth = ivar%Weight(1)*atmoptics%Optical_Depth + &
358  ivar%Weight(2)*optical_depth
359 
360  END SUBROUTINE compute_odps_atmabsorption
361 
362 
363 !------------------------------------------------------------------------------
364 !:sdoc+:
365 !
366 ! NAME:
367 ! ODSSU_Compute_AtmAbsorption_TL
368 !
369 ! PURPOSE:
370 ! Subroutine to calculate the tangent-linear layer optical depths due
371 ! to gaseous absorption for the SSU sensor for a given channel and
372 ! atmospheric profile.
373 !
374 ! CALLING SEQUENCE:
375 ! CALL ODSSU_Compute_AtmAbsorption_TL( SensorIndex , &
376 ! ChannelIndex, &
377 ! Predictor , &
378 ! Predictor_TL, &
379 ! AtmOptics_TL, &
380 ! iVar )
381 !
382 ! INPUTS:
383 ! SensorIndex: Sensor index id. This is a unique index associated
384 ! with a (supported) sensor used to access the
385 ! shared coefficient data for a particular sensor.
386 ! See the ChannelIndex argument.
387 ! UNITS: N/A
388 ! TYPE: INTEGER
389 ! DIMENSION: Scalar
390 ! ATTRIBUTES: INTENT(IN)
391 !
392 ! ChannelIndex: Channel index id. This is a unique index associated
393 ! with a (supported) sensor channel used to access the
394 ! shared coefficient data for a particular sensor's
395 ! channel.
396 ! See the SensorIndex argument.
397 ! UNITS: N/A
398 ! TYPE: INTEGER
399 ! DIMENSION: Scalar
400 ! ATTRIBUTES: INTENT(IN)
401 !
402 ! Predictor: Structure containing the integrated absorber and
403 ! predictor profile data.
404 ! UNITS: N/A
405 ! TYPE: ODAS_Predictor_type
406 ! or
407 ! ODPS_Predictor_type
408 ! DIMENSION: Scalar
409 ! ATTRIBUTES: INTENT(IN)
410 !
411 ! *********** INTENT NEEDS TO BE CORRECTED TO JUST (IN) ***********
412 ! *********** PREDICTOR_TL IS SPECIFIED AS INTENT(IN OUT) IN ODPS_AtmAbsorption MODULE ************
413 ! Predictor_TL: Structure containing the tangent-linear integrated
414 ! absorber and predictor profile data.
415 ! UNITS: N/A
416 ! TYPE: ODAS_Predictor_type
417 ! or
418 ! ODPS_Predictor_type
419 ! DIMENSION: Scalar
420 ! ATTRIBUTES: INTENT(IN OUT)
421 ! *********** PREDICTOR_TL IS SPECIFIED AS INTENT(IN OUT) IN ODPS_AtmAbsorption MODULE ************
422 !
423 ! iVar: Structure containing internal variables required for
424 ! subsequent tangent-linear or adjoint model calls.
425 ! The contents of this structure are NOT accessible
426 ! outside of this module.
427 ! UNITS: N/A
428 ! TYPE: iVar_type
429 ! DIMENSION: Scalar
430 ! ATTRIBUTES: INTENT(IN)
431 !
432 ! OUTPUTS:
433 ! AtmOptics_TL: Structure containing the computed tangent-linear
434 ! optical depth profile.
435 ! UNITS: N/A
436 ! TYPE: CRTM_AtmOptics_type
437 ! DIMENSION: Scalar
438 ! ATTRIBUTES: INTENT(IN OUT)
439 !
440 ! COMMENTS:
441 ! Note the INTENT on the output structure arguments are IN OUT rather
442 ! than just OUT. This is to prevent default reinitialisation upon entry.
443 !
444 !:sdoc-:
445 !------------------------------------------------------------------------------
446 
447  SUBROUTINE compute_odas_atmabsorption_tl( &
448  SensorIndex , & ! Input
449  ChannelIndex, & ! Input
450  Predictor , & ! FWD Input
451  Predictor_TL, & ! TL Input
452  AtmOptics_TL, & ! TL Output
453  iVar ) ! Internal variable input
454  ! Arguments
455  INTEGER , INTENT(IN) :: SensorIndex
456  INTEGER , INTENT(IN) :: ChannelIndex
457  TYPE(ODAS_Predictor_type), INTENT(IN) :: Predictor
458  TYPE(ODAS_Predictor_type), INTENT(IN) :: Predictor_TL
459  TYPE(CRTM_AtmOptics_type), INTENT(IN OUT) :: AtmOptics_TL
460  TYPE(iVar_type) , INTENT(IN) :: iVar
461  ! Variables
462  REAL(fp) :: optical_depth_TL(AtmOptics_TL%n_Layers)
463 
464  ! Compute the tangent-linear optical depths
465  ! ...At cell pressure 1
467  tc(sensorindex)%ODAS(ivar%Index_low), &
468  channelindex , &
469  predictor , &
470  predictor_tl , &
471  atmoptics_tl , &
472  ivar%ODAS(1) )
473  optical_depth_tl = atmoptics_tl%Optical_Depth
474  ! ...At cell pressure 2
476  tc(sensorindex)%ODAS(ivar%Index_low+1), &
477  channelindex , &
478  predictor , &
479  predictor_tl , &
480  atmoptics_tl , &
481  ivar%ODAS(2) )
482  ! ...Weighted average
483  atmoptics_tl%Optical_Depth = ivar%Weight(1)*atmoptics_tl%Optical_Depth + &
484  ivar%Weight(2)*optical_depth_tl
485 
486  END SUBROUTINE compute_odas_atmabsorption_tl
487 
488 
489  SUBROUTINE compute_odps_atmabsorption_tl( &
490  SensorIndex , & ! Input
491  ChannelIndex, & ! Input
492  Predictor , & ! FWD Input
493  Predictor_TL, & ! TL Input
494  AtmOptics_TL, & ! TL Output
495  iVar ) ! Internal variable input
496  ! Arguments
497  INTEGER , INTENT(IN) :: SensorIndex
498  INTEGER , INTENT(IN) :: ChannelIndex
499  TYPE(ODPS_Predictor_type), INTENT(IN) :: Predictor
500  TYPE(ODPS_Predictor_type), INTENT(IN OUT) :: Predictor_TL ! INTENT! IS SPECIFIED AS (IN OUT) IN ODPS_AtmAbsorption MODULE
501  TYPE(CRTM_AtmOptics_type), INTENT(IN OUT) :: AtmOptics_TL
502  TYPE(iVar_type) , INTENT(IN) :: iVar
503  ! Variables
504  REAL(fp) :: optical_depth_TL(AtmOptics_TL%n_Layers)
505 
506  ! Compute the tangent-linear optical depths
507  ! ...At cell pressure 1
509  tc(sensorindex)%ODPS(ivar%Index_low), &
510  channelindex , &
511  predictor , &
512  predictor_tl , &
513  atmoptics_tl )
514  optical_depth_tl = atmoptics_tl%Optical_Depth
515  ! ...At cell pressure 2
517  tc(sensorindex)%ODPS(ivar%Index_low+1), &
518  channelindex , &
519  predictor , &
520  predictor_tl , &
521  atmoptics_tl )
522  ! ...Weighted average
523  atmoptics_tl%Optical_Depth = ivar%Weight(1)*atmoptics_tl%Optical_Depth + &
524  ivar%Weight(2)*optical_depth_tl
525 
526  END SUBROUTINE compute_odps_atmabsorption_tl
527 
528 
529 !------------------------------------------------------------------------------
530 !:sdoc+:
531 !
532 ! NAME:
533 ! ODSSU_Compute_AtmAbsorption_AD
534 !
535 ! PURPOSE:
536 ! Subroutine to calculate the adjoint of the layer optical depths due
537 ! to gaseous absorption for the SSU sensor for a given channel and
538 ! atmospheric profile.
539 !
540 ! CALLING SEQUENCE:
541 ! CALL ODSSU_Compute_AtmAbsorption_AD( SensorIndex , &
542 ! ChannelIndex, &
543 ! Predictor , &
544 ! AtmOptics_AD, &
545 ! Predictor_AD, &
546 ! iVar )
547 !
548 ! INPUTS:
549 ! SensorIndex: Sensor index id. This is a unique index associated
550 ! with a (supported) sensor used to access the
551 ! shared coefficient data for a particular sensor.
552 ! See the ChannelIndex argument.
553 ! UNITS: N/A
554 ! TYPE: INTEGER
555 ! DIMENSION: Scalar
556 ! ATTRIBUTES: INTENT(IN)
557 !
558 ! ChannelIndex: Channel index id. This is a unique index associated
559 ! with a (supported) sensor channel used to access the
560 ! shared coefficient data for a particular sensor's
561 ! channel.
562 ! See the SensorIndex argument.
563 ! UNITS: N/A
564 ! TYPE: INTEGER
565 ! DIMENSION: Scalar
566 ! ATTRIBUTES: INTENT(IN)
567 !
568 ! Predictor: Structure containing the integrated absorber and
569 ! predictor profile data.
570 ! UNITS: N/A
571 ! TYPE: ODAS_Predictor_type
572 ! or
573 ! ODPS_Predictor_type
574 ! DIMENSION: Scalar
575 ! ATTRIBUTES: INTENT(IN)
576 !
577 ! AtmOptics_AD: Structure containing the adjoint optical
578 ! depth profile.
579 ! *** NOTE: Optical depth component may be set to
580 ! zero upon exit.
581 ! UNITS: N/A
582 ! TYPE: CRTM_AtmOptics_type
583 ! DIMENSION: Scalar
584 ! ATTRIBUTES: INTENT(IN OUT)
585 !
586 ! iVar: Structure containing internal variables required for
587 ! subsequent tangent-linear or adjoint model calls.
588 ! The contents of this structure are NOT accessible
589 ! outside of this module.
590 ! UNITS: N/A
591 ! TYPE: iVar_type
592 ! DIMENSION: Scalar
593 ! ATTRIBUTES: INTENT(IN)
594 !
595 ! OUTPUTS:
596 ! Predictor_AD: Structure containing the adjoint integrated
597 ! absorber and predictor profile data.
598 ! *** NOTE: Must be defined upon entry.
599 ! UNITS: N/A
600 ! TYPE: Same as Predictor input argument.
601 ! DIMENSION: Scalar
602 ! ATTRIBUTES: INTENT(IN OUT)
603 !
604 ! COMMENTS:
605 ! The contents of the input adjoint arguments are modified upon exit.
606 !
607 !:sdoc-:
608 !------------------------------------------------------------------------------
609 
610  SUBROUTINE compute_odas_atmabsorption_ad( &
611  SensorIndex , & ! Input
612  ChannelIndex, & ! Input
613  Predictor , & ! FWD Input
614  AtmOptics_AD, & ! AD Input
615  Predictor_AD, & ! AD Output
616  iVar ) ! Internal variable input
617  ! Arguments
618  INTEGER , INTENT(IN) :: SensorIndex
619  INTEGER , INTENT(IN) :: ChannelIndex
620  TYPE(ODAS_Predictor_type), INTENT(IN) :: Predictor
621  TYPE(CRTM_AtmOptics_type), INTENT(IN OUT) :: AtmOptics_AD
622  TYPE(ODAS_Predictor_type), INTENT(IN OUT) :: Predictor_AD
623  TYPE(iVar_type) , INTENT(IN) :: iVar
624  ! Variables
625  REAL(fp) :: optical_depth_AD( AtmOptics_AD%n_Layers)
626 
627  ! Adjoint of weighted average optical depth
628  optical_depth_ad = ivar%Weight(2)*atmoptics_ad%Optical_Depth
629  atmoptics_ad%Optical_Depth = ivar%Weight(1)*atmoptics_ad%Optical_Depth
630 
631  ! Compute the adjoint of the optical depths
632  ! ...At cell pressure #2
634  tc(sensorindex)%ODAS(ivar%Index_low+1), &
635  channelindex , &
636  predictor , &
637  atmoptics_ad , &
638  predictor_ad , &
639  ivar%ODAS(2) )
640  atmoptics_ad%Optical_Depth = atmoptics_ad%Optical_Depth + optical_depth_ad
641  ! ...At cell pressure #1
643  tc(sensorindex)%ODAS(ivar%Index_low), &
644  channelindex , &
645  predictor , &
646  atmoptics_ad , &
647  predictor_ad , &
648  ivar%ODAS(1) )
649 
650  END SUBROUTINE compute_odas_atmabsorption_ad
651 
652 
653  SUBROUTINE compute_odps_atmabsorption_ad( &
654  SensorIndex , &
655  ChannelIndex, &
656  Predictor , &
657  AtmOptics_AD, &
658  Predictor_AD, &
659  iVar )
660  ! Arguments
661  INTEGER , INTENT(IN) :: SensorIndex
662  INTEGER , INTENT(IN) :: ChannelIndex
663  TYPE(ODPS_Predictor_type), INTENT(IN) :: Predictor
664  TYPE(CRTM_AtmOptics_type), INTENT(IN OUT) :: AtmOptics_AD
665  TYPE(ODPS_Predictor_type), INTENT(IN OUT) :: Predictor_AD
666  TYPE(iVar_type) , INTENT(IN) :: iVar
667  ! Variables
668  REAL(fp) :: optical_depth_AD( AtmOptics_AD%n_Layers)
669 
670  ! Adjoint of weighted average optical depth
671  optical_depth_ad = ivar%Weight(2)*atmoptics_ad%Optical_Depth
672  atmoptics_ad%Optical_Depth = ivar%Weight(1)*atmoptics_ad%Optical_Depth
673 
674  ! Compute the adjoint of the optical depths
675  ! ...At cell pressure #2
677  tc(sensorindex)%ODPS(ivar%Index_low+1), &
678  channelindex , &
679  predictor , &
680  atmoptics_ad , &
681  predictor_ad )
682  atmoptics_ad%Optical_Depth = atmoptics_ad%Optical_Depth + optical_depth_ad
683  ! ...At cell pressure #1
685  tc(sensorindex)%ODPS(ivar%Index_low), &
686  channelindex , &
687  predictor , &
688  atmoptics_ad , &
689  predictor_ad )
690 
691  END SUBROUTINE compute_odps_atmabsorption_ad
692 
693 
694 
695  SUBROUTINE get_co2_cell_p(SensorIndex,ChannelIndex,u,y0)
696 ! -------------------------------------------------------------------
697 ! Using an sensor "SensorIndex" and time "u" to find CO2 cell pressure "y0".
698 ! -------------------------------------------------------------------
699  INTEGER, INTENT( IN ) :: SensorIndex, ChannelIndex
700  REAL(fp), INTENT( IN ) :: u
701  REAL(fp), INTENT( OUT ) :: y0
702  INTEGER :: n, jLower, jUpper, indx
703 
704  n = SIZE(tc(sensorindex)%Ref_Time)
705  jlower = 1
706  jupper = n
707 
708  if(u.ge.tc(sensorindex)%Ref_Time(n)) then
709  y0 = tc(sensorindex)%Ref_CellPressure(n,channelindex)
710  return
711  else if(u.le.tc(sensorindex)%Ref_Time(1)) then
712  y0 = tc(sensorindex)%Ref_CellPressure(1,channelindex)
713  return
714  endif
715 
716  indx = bisection_search( tc(sensorindex)%Ref_Time, u )
717 
718  y0 = tc(sensorindex)%Ref_CellPressure(indx,channelindex) + &
719  (tc(sensorindex)%Ref_CellPressure(indx+1,channelindex)- &
720  tc(sensorindex)%Ref_CellPressure(indx,channelindex))/ &
721  (tc(sensorindex)%Ref_Time(indx+1)-tc(sensorindex)%Ref_Time(indx))* &
722  (u-tc(sensorindex)%Ref_Time(indx))
723  RETURN
724  END SUBROUTINE get_co2_cell_p
725 !
726 
727 END MODULE odssu_atmabsorption
728 
integer, parameter ml
subroutine compute_odas_atmabsorption(SensorIndex, ChannelIndex, Predictor, AtmOptics, iVar)
integer, parameter, public failure
real(fp), parameter, public zero
integer, parameter, public warning
subroutine, public odssu_compute_weights(SSU_Input, SensorIndex, ChannelIndex, iVar)
integer, parameter, public fp
Definition: Type_Kinds.f90:124
subroutine, public odas_compute_atmabsorption_ad(TC, ChannelIndex, Predictor, AtmOptics_AD, Predictor_AD, iVar)
elemental subroutine, public ssu_input_getvalue(SSU_Input, Channel, Time, Cell_Pressure, n_Channels)
subroutine, public odas_compute_atmabsorption_tl(TC, ChannelIndex, Predictor, Predictor_TL, AtmOptics_TL, iVar)
subroutine, public odps_compute_atmabsorption(TC, ChannelIndex, Predictor, AtmAbsorption)
subroutine, public odps_compute_atmabsorption_ad(TC, ChannelIndex, Predictor, AtmAbsorption_AD, Predictor_AD)
character(*), parameter module_version_id
subroutine compute_odps_atmabsorption_ad(SensorIndex, ChannelIndex, Predictor, AtmOptics_AD, Predictor_AD, iVar)
real(fp), parameter, public one
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
subroutine get_co2_cell_p(SensorIndex, ChannelIndex, u, y0)
subroutine compute_odps_atmabsorption_tl(SensorIndex, ChannelIndex, Predictor, Predictor_TL, AtmOptics_TL, iVar)
subroutine compute_odas_atmabsorption_ad(SensorIndex, ChannelIndex, Predictor, AtmOptics_AD, Predictor_AD, iVar)
elemental logical function, public ssu_input_cellpressureisset(ssu)
subroutine compute_odas_atmabsorption_tl(SensorIndex, ChannelIndex, Predictor, Predictor_TL, AtmOptics_TL, iVar)
subroutine, public odas_compute_atmabsorption(TC, ChannelIndex, Predictor, AtmOptics, iVar)
type(odssu_taucoeff_type), dimension(:), allocatable, target, save, public tc
subroutine compute_odps_atmabsorption(SensorIndex, ChannelIndex, Predictor, AtmOptics, iVar)
integer, parameter, public success
subroutine, public odps_compute_atmabsorption_tl(TC, ChannelIndex, Predictor, Predictor_TL, AtmAbsorption_TL)
integer function, public bisection_search(x, u, xLower, xUpper)