FV3 Bundle
SpcCoeff_Define.f90
Go to the documentation of this file.
1 !
2 ! SpcCoeff_Define
3 !
4 ! Module defining the SpcCoeff data structure and routines
5 ! to manipulate them.
6 !
7 !
8 ! CREATION HISTORY:
9 ! Written by: Paul van Delst, 18-Mar-2002
10 ! paul.vandelst@noaa.gov
11 !
12 
14 
15  ! -----------------
16  ! Environment setup
17  ! -----------------
18  ! Module use
19  USE type_kinds, ONLY: long, double
21  USE compare_float_numbers, ONLY: OPERATOR(.equalto.)
22  USE subset_define , ONLY: subset_type , &
24  subset_getvalue , &
28  n_sensor_types , &
29  invalid_sensor , &
31  infrared_sensor , &
32  visible_sensor , &
37  unpolarized , &
38  intensity , &
43  vl_polarization , &
44  hl_polarization , &
49  rc_polarization , &
50  lc_polarization , &
52  USE accoeff_define , ONLY: accoeff_type , &
53  OPERATOR(==) , &
55  accoeff_destroy , &
56  accoeff_create , &
57  accoeff_inspect , &
59  accoeff_info , &
61  accoeff_subset , &
62  accoeff_concat , &
64  USE nltecoeff_define , ONLY: nltecoeff_type , &
65  OPERATOR(==) , &
71  nltecoeff_info , &
76  ! Disable implicit typing
77  IMPLICIT NONE
78 
79 
80  ! ------------
81  ! Visibilities
82  ! ------------
83  ! Everything private by default
84  PRIVATE
85  ! Datatypes
86  PUBLIC :: spccoeff_type
87  ! Operators
88  PUBLIC :: OPERATOR(==)
89  ! Procedures
90  PUBLIC :: spccoeff_associated
91  PUBLIC :: spccoeff_destroy
92  PUBLIC :: spccoeff_create
93  PUBLIC :: spccoeff_inspect
94  PUBLIC :: spccoeff_validrelease
95  PUBLIC :: spccoeff_info
96  PUBLIC :: spccoeff_defineversion
97  PUBLIC :: spccoeff_subset
98  PUBLIC :: spccoeff_concat
99  ! ...Channel flag specific procedures
100  PUBLIC :: spccoeff_clearallflags
103  ! ...Sensor specific procedures
108  ! ...Inherited procedures
109  PUBLIC :: accoeff_associated
110  PUBLIC :: accoeff_destroy
111  PUBLIC :: accoeff_create
112  PUBLIC :: accoeff_inspect
113  PUBLIC :: accoeff_validrelease
114  PUBLIC :: accoeff_info
115  PUBLIC :: accoeff_defineversion
116  PUBLIC :: nltecoeff_associated
117  PUBLIC :: nltecoeff_destroy
118  PUBLIC :: nltecoeff_create
119  PUBLIC :: nltecoeff_inspect
120  PUBLIC :: nltecoeff_validrelease
121  PUBLIC :: nltecoeff_info
122  PUBLIC :: nltecoeff_defineversion
123 
124 
125  ! ---------------------
126  ! Procedure overloading
127  ! ---------------------
128  INTERFACE OPERATOR(==)
129  MODULE PROCEDURE spccoeff_equal
130  END INTERFACE OPERATOR(==)
131 
132 
133  ! -----------------
134  ! Module parameters
135  ! -----------------
136  ! Version Id for the module
137  CHARACTER(*), PARAMETER :: module_version_id = &
138  '$Id: SpcCoeff_Define.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
139  ! Literal constants
140  REAL(Double), PARAMETER :: zero = 0.0_double
141  ! Default message string length
142  INTEGER, PARAMETER :: ml = 512
143  ! Sensor id string length
144  INTEGER, PARAMETER :: sl = 20
145  ! Current valid release and version numbers
146  INTEGER, PARAMETER :: spccoeff_release = 8 ! This determines structure and file formats.
147  INTEGER, PARAMETER :: spccoeff_version = 1 ! This is just the data version.
148  ! The bit positions for the various channel flags
149  INTEGER, PARAMETER :: solar_flag = 0
150  INTEGER, PARAMETER :: zeeman_flag = 1
151 
152 
153 
154  ! -----------------------------
155  ! SpcCoeff data type definition
156  ! -----------------------------
158  ! Allocation indicator
159  LOGICAL :: is_allocated = .false.
160  ! Release and version information
161  INTEGER(Long) :: release = spccoeff_release
162  INTEGER(Long) :: version = spccoeff_version
163  ! Dimensions
164  INTEGER(Long) :: n_channels = 0 ! L dimension
165  ! Sensor info
166  CHARACTER(SL) :: sensor_id = ''
167  INTEGER(Long) :: sensor_type = invalid_sensor
168  INTEGER(Long) :: wmo_satellite_id = invalid_wmo_satellite_id
169  INTEGER(Long) :: wmo_sensor_id = invalid_wmo_sensor_id
170  ! Channel data arrays
171  INTEGER(Long), ALLOCATABLE :: sensor_channel(:) ! L
172  INTEGER(Long), ALLOCATABLE :: polarization(:) ! L
173  INTEGER(Long), ALLOCATABLE :: channel_flag(:) ! L
174  REAL(Double) , ALLOCATABLE :: frequency(:) ! L
175  REAL(Double) , ALLOCATABLE :: wavenumber(:) ! L
176  REAL(Double) , ALLOCATABLE :: planck_c1(:) ! L
177  REAL(Double) , ALLOCATABLE :: planck_c2(:) ! L
178  REAL(Double) , ALLOCATABLE :: band_c1(:) ! L
179  REAL(Double) , ALLOCATABLE :: band_c2(:) ! L
180  REAL(Double) , ALLOCATABLE :: cosmic_background_radiance(:) ! L
181  REAL(Double) , ALLOCATABLE :: solar_irradiance(:) ! L
182  ! Derived type components
183  TYPE(accoeff_type) :: ac ! Antenna correction coefficients
184  TYPE(nltecoeff_type) :: nc ! non-LTE correction coefficients
185  END TYPE spccoeff_type
186 
187 
188 CONTAINS
189 
190 
191 !################################################################################
192 !################################################################################
193 !## ##
194 !## ## PUBLIC MODULE ROUTINES ## ##
195 !## ##
196 !################################################################################
197 !################################################################################
198 
199 !--------------------------------------------------------------------------------
200 !:sdoc+:
201 !
202 ! NAME:
203 ! SpcCoeff_Associated
204 !
205 ! PURPOSE:
206 ! Elemental function to test the status of the allocatable components
207 ! of the SpcCoeff structure.
208 !
209 ! CALLING SEQUENCE:
210 ! Status = SpcCoeff_Associated( SpcCoeff )
211 !
212 ! OBJECTS:
213 ! SpcCoeff: Structure which is to have its member's
214 ! status tested.
215 ! UNITS: N/A
216 ! TYPE: SpcCoeff_type
217 ! DIMENSION: Scalar or any rank
218 ! ATTRIBUTES: INTENT(IN)
219 !
220 ! FUNCTION RESULT:
221 ! Status: The return value is a logical value indicating the
222 ! status of the SpcCoeff members.
223 ! .TRUE. - if ANY of the SpcCoeff allocatable members
224 ! are in use.
225 ! .FALSE. - if ALL of the SpcCoeff allocatable members
226 ! are not in use.
227 ! UNITS: N/A
228 ! TYPE: LOGICAL
229 ! DIMENSION: Same as input
230 !
231 !:sdoc-:
232 !--------------------------------------------------------------------------------
233 
234  ELEMENTAL FUNCTION spccoeff_associated( SpcCoeff ) RESULT( Status )
235  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
236  LOGICAL :: status
237  status = spccoeff%Is_Allocated
238  END FUNCTION spccoeff_associated
239 
240 
241 !--------------------------------------------------------------------------------
242 !:sdoc+:
243 !
244 ! NAME:
245 ! SpcCoeff_Destroy
246 !
247 ! PURPOSE:
248 ! Elemental subroutine to re-initialize SpcCoeff objects.
249 !
250 ! CALLING SEQUENCE:
251 ! CALL SpcCoeff_Destroy( SpcCoeff )
252 !
253 ! OBJECTS:
254 ! SpcCoeff: Re-initialized SpcCoeff structure.
255 ! UNITS: N/A
256 ! TYPE: SpcCoeff_type
257 ! DIMENSION: Scalar or any rank
258 ! ATTRIBUTES: INTENT(OUT)
259 !
260 !:sdoc-:
261 !--------------------------------------------------------------------------------
262 
263  ELEMENTAL SUBROUTINE spccoeff_destroy( SpcCoeff )
264  TYPE(spccoeff_type), INTENT(OUT) :: spccoeff
265  spccoeff%Is_Allocated = .false.
266  spccoeff%n_Channels = 0
267  spccoeff%Sensor_Id = ''
268  spccoeff%WMO_Satellite_ID = invalid_wmo_satellite_id
269  spccoeff%WMO_Sensor_ID = invalid_wmo_sensor_id
270  spccoeff%Sensor_Type = invalid_sensor
271  END SUBROUTINE spccoeff_destroy
272 
273 
274 !--------------------------------------------------------------------------------
275 !:sdoc+:
276 !
277 ! NAME:
278 ! SpcCoeff_Create
279 !
280 ! PURPOSE:
281 ! Elemental subroutine to create an instance of an SpcCoeff object.
282 !
283 ! CALLING SEQUENCE:
284 ! CALL SpcCoeff_Create( SpcCoeff , &
285 ! n_Channels )
286 !
287 ! OBJECTS:
288 ! SpcCoeff: SpcCoeff object structure.
289 ! UNITS: N/A
290 ! TYPE: SpcCoeff_type
291 ! DIMENSION: Scalar or any rank
292 ! ATTRIBUTES: INTENT(OUT)
293 !
294 ! INPUTS:
295 ! n_Channels: Number of sensor channels.
296 ! Must be > 0.
297 ! UNITS: N/A
298 ! TYPE: INTEGER
299 ! DIMENSION: Scalar
300 ! ATTRIBUTES: INTENT(IN)
301 !
302 !:sdoc-:
303 !--------------------------------------------------------------------------------
304 
305  ELEMENTAL SUBROUTINE spccoeff_create( &
306  SpcCoeff , & ! Output
307  n_Channels ) ! Input
308  ! Arguments
309  TYPE(spccoeff_type), INTENT(OUT) :: spccoeff
310  INTEGER , INTENT(IN) :: n_channels
311  ! Local variables
312  INTEGER :: alloc_stat
313 
314  ! Check input
315  IF ( n_channels < 1 ) RETURN
316 
317  ! Perform the allocation
318  ALLOCATE( spccoeff%Sensor_Channel( n_channels ), &
319  spccoeff%Polarization( n_channels ), &
320  spccoeff%Channel_Flag( n_channels ), &
321  spccoeff%Frequency( n_channels ), &
322  spccoeff%Wavenumber( n_channels ), &
323  spccoeff%Planck_C1( n_channels ), &
324  spccoeff%Planck_C2( n_channels ), &
325  spccoeff%Band_C1( n_channels ), &
326  spccoeff%Band_C2( n_channels ), &
327  spccoeff%Cosmic_Background_Radiance( n_channels ), &
328  spccoeff%Solar_Irradiance( n_channels ), &
329  stat = alloc_stat )
330  IF ( alloc_stat /= 0 ) RETURN
331 
332 
333  ! Initialise
334  ! ...Dimensions
335  spccoeff%n_Channels = n_channels
336  ! ...Arrays
337  spccoeff%Sensor_Channel = 0
338  spccoeff%Polarization = invalid_polarization
339  spccoeff%Channel_Flag = 0
340  spccoeff%Frequency = zero
341  spccoeff%Wavenumber = zero
342  spccoeff%Planck_C1 = zero
343  spccoeff%Planck_C2 = zero
344  spccoeff%Band_C1 = zero
345  spccoeff%Band_C2 = zero
346  spccoeff%Cosmic_Background_Radiance = zero
347  spccoeff%Solar_Irradiance = zero
348 
349 
350  ! Set allocation indicator
351  spccoeff%Is_Allocated = .true.
352 
353  END SUBROUTINE spccoeff_create
354 
355 
356 !--------------------------------------------------------------------------------
357 !:sdoc+:
358 !
359 ! NAME:
360 ! SpcCoeff_Inspect
361 !
362 ! PURPOSE:
363 ! Subroutine to print the contents of a SpcCoeff object to stdout.
364 !
365 ! CALLING SEQUENCE:
366 ! CALL SpcCoeff_Inspect( SpcCoeff )
367 !
368 ! OBJECTS:
369 ! SpcCoeff: SpcCoeff object to display.
370 ! UNITS: N/A
371 ! TYPE: SpcCoeff_type
372 ! DIMENSION: Scalar
373 ! ATTRIBUTES: INTENT(IN)
374 !
375 !:sdoc-:
376 !--------------------------------------------------------------------------------
377 
378  SUBROUTINE spccoeff_inspect( SpcCoeff )
379  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
380  INTEGER :: n
381  WRITE(*,'(1x,"SpcCoeff OBJECT")')
382  ! Release/version info
383  WRITE(*,'(3x,"Release.Version :",1x,i0,".",i0)') spccoeff%Release, spccoeff%Version
384  ! Dimensions
385  WRITE(*,'(3x,"n_Channels :",1x,i0)') spccoeff%n_Channels
386  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
387  ! Sensor info
388  WRITE(*,'(3x,"Sensor_Id :",1x,a )') trim(spccoeff%Sensor_Id)
389  WRITE(*,'(3x,"WMO_Satellite_ID :",1x,i0)') spccoeff%WMO_Satellite_ID
390  WRITE(*,'(3x,"WMO_Sensor_ID :",1x,i0)') spccoeff%WMO_Sensor_ID
391  WRITE(*,'(3x,"Sensor_Type :",1x,a )') trim(sensor_type_name(spccoeff%Sensor_Type))
392  WRITE(*,'(3x,"Sensor_Channel :")')
393  WRITE(*,'(10(1x,i5,:))') spccoeff%Sensor_Channel
394  ! Data arrays
395  IF ( spccoeff_ismicrowavesensor(spccoeff) ) THEN
396  WRITE(*,'(3x,"Polarization :")')
397  DO n = 1, spccoeff%n_Channels
398  WRITE(*,'(5x,"Channel ",i0,": ",a)') spccoeff%Sensor_Channel(n), &
399  polarization_type_name(spccoeff%Polarization(n))
400  END DO
401  END IF
402  WRITE(*,'(3x,"Channel_Flag :")')
403  WRITE(*,'(3(1x,b32.32,:))') spccoeff%Channel_Flag
404  WRITE(*,'(3x,"Frequency :")')
405  WRITE(*,'(5(1x,es13.6,:))') spccoeff%Frequency
406  WRITE(*,'(3x,"Wavenumber :")')
407  WRITE(*,'(5(1x,es13.6,:))') spccoeff%Wavenumber
408  WRITE(*,'(3x,"Planck_C1 :")')
409  WRITE(*,'(5(1x,es13.6,:))') spccoeff%Planck_C1
410  WRITE(*,'(3x,"Planck_C2 :")')
411  WRITE(*,'(5(1x,es13.6,:))') spccoeff%Planck_C2
412  WRITE(*,'(3x,"Band_C1 :")')
413  WRITE(*,'(5(1x,es13.6,:))') spccoeff%Band_C1
414  WRITE(*,'(3x,"Band_C2 :")')
415  WRITE(*,'(5(1x,es13.6,:))') spccoeff%Band_C2
416  WRITE(*,'(3x,"Cosmic_Background_Radiance :")')
417  WRITE(*,'(5(1x,es13.6,:))') spccoeff%Cosmic_Background_Radiance
418  WRITE(*,'(3x,"Solar_Irradiance :")')
419  WRITE(*,'(5(1x,es13.6,:))') spccoeff%Solar_Irradiance
420  ! Derived types
421  IF ( accoeff_associated( spccoeff%AC ) ) CALL accoeff_inspect( spccoeff%AC )
422  IF ( nltecoeff_associated( spccoeff%NC ) ) CALL nltecoeff_inspect( spccoeff%NC )
423 
424  END SUBROUTINE spccoeff_inspect
425 
426 
427 !----------------------------------------------------------------------------------
428 !:sdoc+:
429 !
430 ! NAME:
431 ! SpcCoeff_ValidRelease
432 !
433 ! PURPOSE:
434 ! Function to check the SpcCoeff Release value.
435 !
436 ! CALLING SEQUENCE:
437 ! IsValid = SpcCoeff_ValidRelease( SpcCoeff )
438 !
439 ! INPUTS:
440 ! SpcCoeff: SpcCoeff object for which the Release component
441 ! is to be checked.
442 ! UNITS: N/A
443 ! TYPE: SpcCoeff_type
444 ! DIMENSION: Scalar
445 ! ATTRIBUTES: INTENT(IN)
446 !
447 ! FUNCTION RESULT:
448 ! IsValid: Logical value defining the release validity.
449 ! UNITS: N/A
450 ! TYPE: LOGICAL
451 ! DIMENSION: Scalar
452 !
453 !:sdoc-:
454 !----------------------------------------------------------------------------------
455 
456  FUNCTION spccoeff_validrelease( SpcCoeff ) RESULT( IsValid )
457  ! Arguments
458  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
459  ! Function result
460  LOGICAL :: isvalid
461  ! Local parameters
462  CHARACTER(*), PARAMETER :: routine_name = 'SpcCoeff_ValidRelease'
463  ! Local variables
464  CHARACTER(ML) :: msg
465 
466  ! Set up
467  isvalid = .true.
468 
469 
470  ! Check release is not too old
471  IF ( spccoeff%Release < spccoeff_release ) THEN
472  isvalid = .false.
473  WRITE( msg,'("An SpcCoeff data update is needed. ", &
474  &"SpcCoeff release is ",i0,". Valid release is ",i0,"." )' ) &
475  spccoeff%Release, spccoeff_release
476  CALL display_message( routine_name, msg, information )
477  RETURN
478  END IF
479 
480 
481  ! Check release is not too new
482  IF ( spccoeff%Release > spccoeff_release ) THEN
483  isvalid = .false.
484  WRITE( msg,'("An SpcCoeff software update is needed. ", &
485  &"SpcCoeff release is ",i0,". Valid release is ",i0,"." )' ) &
486  spccoeff%Release, spccoeff_release
487  CALL display_message( routine_name, msg, information )
488  RETURN
489  END IF
490 
491  END FUNCTION spccoeff_validrelease
492 
493 
494 !--------------------------------------------------------------------------------
495 !:sdoc+:
496 !
497 ! NAME:
498 ! SpcCoeff_Info
499 !
500 ! PURPOSE:
501 ! Subroutine to return a string containing version and dimension
502 ! information about a SpcCoeff object.
503 !
504 ! CALLING SEQUENCE:
505 ! CALL SpcCoeff_Info( SpcCoeff, Info, NoComponents=NoComponents )
506 !
507 ! OBJECTS:
508 ! SpcCoeff: SpcCoeff object about which info is required.
509 ! UNITS: N/A
510 ! TYPE: SpcCoeff_type
511 ! DIMENSION: Scalar
512 ! ATTRIBUTES: INTENT(IN)
513 !
514 ! OUTPUTS:
515 ! Info: String containing version and dimension information
516 ! about the SpcCoeff object.
517 ! UNITS: N/A
518 ! TYPE: CHARACTER(*)
519 ! DIMENSION: Scalar
520 ! ATTRIBUTES: INTENT(OUT)
521 !
522 ! OPTIONAL INPUTS:
523 ! NoComponents: Set this logical argument to not include the version
524 ! and dimension information of structure components.
525 ! If .FALSE. the substructure information is included [DEFAULT]
526 ! .TRUE. the substructure information is NOT included
527 ! If not specfied the default is .FALSE.
528 ! UNITS: N/A
529 ! TYPE: CHARACTER(*)
530 ! DIMENSION: Scalar
531 ! ATTRIBUTES: INTENT(OUT)
532 !
533 !:sdoc-:
534 !--------------------------------------------------------------------------------
535 
536  SUBROUTINE spccoeff_info( &
537  SpcCoeff , & ! Input
538  Info , & ! Output
539  NoComponents ) ! Optional input
540  ! Arguments
541  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
542  CHARACTER(*), INTENT(OUT) :: info
543  LOGICAL, OPTIONAL, INTENT(IN) :: nocomponents
544  ! Parameters
545  INTEGER, PARAMETER :: carriage_return = 13
546  INTEGER, PARAMETER :: linefeed = 10
547  ! Local variables
548  LOGICAL :: includecomponents
549  CHARACTER(5000) :: long_string
550  CHARACTER(2000) :: ac_info, nc_info
551 
552  ! Setup
553  includecomponents = .true.
554  IF ( PRESENT(nocomponents) ) includecomponents = .NOT. nocomponents
555 
556  ! Write the required data to the local string
557  WRITE( long_string, &
558  '(a,1x,"SpcCoeff RELEASE.VERSION: ",i2,".",i2.2,a,3x, &
559  &"N_CHANNELS=",i0 )' ) &
560  achar(carriage_return)//achar(linefeed), &
561  spccoeff%Release, spccoeff%Version, &
562  achar(carriage_return)//achar(linefeed), &
563  spccoeff%n_Channels
564 
565  ! Add derived type info strings
566  IF ( includecomponents ) THEN
567  ! ...Antenna correction structure
568  IF ( accoeff_associated( spccoeff%AC ) ) THEN
569  CALL accoeff_info( spccoeff%AC, ac_info )
570  long_string = trim(long_string)//trim(ac_info)
571  END IF
572  ! ...non-LTE correction structure
573  IF ( nltecoeff_associated( spccoeff%NC ) ) THEN
574  CALL nltecoeff_info( spccoeff%NC, nc_info )
575  long_string = trim(long_string)//trim(nc_info)
576  END IF
577  END IF
578 
579  ! Trim the output based on the
580  ! dummy argument string length
581  info = long_string(1:min(len(info), len_trim(long_string)))
582 
583  END SUBROUTINE spccoeff_info
584 
585 
586 !--------------------------------------------------------------------------------
587 !:sdoc+:
588 !
589 ! NAME:
590 ! SpcCoeff_DefineVersion
591 !
592 ! PURPOSE:
593 ! Subroutine to return the version information for the
594 ! definition module(s).
595 !
596 ! CALLING SEQUENCE:
597 ! CALL SpcCoeff_DefineVersion( Id )
598 !
599 ! OUTPUTS:
600 ! Id: Character string containing the version Id information for the
601 ! structure definition module(s). If the string length is
602 ! sufficient, the version information for all the modules (this,
603 ! and those for the derived type components) are concatenated.
604 ! Otherwise only the version id for this module is returned.
605 ! UNITS: N/A
606 ! TYPE: CHARACTER(*)
607 ! DIMENSION: Scalar
608 ! ATTRIBUTES: INTENT(OUT)
609 !
610 !:sdoc-:
611 !--------------------------------------------------------------------------------
612 
613  SUBROUTINE spccoeff_defineversion( Id )
614  CHARACTER(*), INTENT(OUT) :: id
615  INTEGER, PARAMETER :: carriage_return = 13
616  INTEGER, PARAMETER :: linefeed = 10
617  INTEGER, PARAMETER :: sl = 256
618  CHARACTER(SL) :: ac_id
619  CHARACTER(SL) :: nc_id
620  CHARACTER(SL*3) :: define_id
621  CALL accoeff_defineversion( ac_id )
622  CALL nltecoeff_defineversion( nc_id )
623  define_id = module_version_id//';'//achar(carriage_return)//achar(linefeed)//&
624  ' '//trim(ac_id)//';'//achar(carriage_return)//achar(linefeed)//&
625  ' '//trim(nc_id)
626  IF ( len_trim(define_id) <= len(id) ) THEN
627  id = define_id
628  ELSE
629  id = module_version_id
630  END IF
631  END SUBROUTINE spccoeff_defineversion
632 
633 
634 !--------------------------------------------------------------------------------
635 !:sdoc+:
636 !
637 ! NAME:
638 ! SpcCoeff_Subset
639 !
640 ! PURPOSE:
641 ! Subroutine to return a channel subset of the input SpcCoeff object.
642 !
643 ! CALLING SEQUENCE:
644 ! CALL SpcCoeff_Subset( SpcCoeff, Subset, SC_Subset )
645 !
646 ! OBJECTS:
647 ! SpcCoeff: SpcCoeff object which is to be subsetted.
648 ! UNITS: N/A
649 ! TYPE: SpcCoeff_type
650 ! DIMENSION: Scalar
651 ! ATTRIBUTES: INTENT(IN)
652 !
653 ! INPUTS:
654 ! Subset: Subset object containing the list of indices
655 ! corresponding the channels to be extracted.
656 ! UNITS: N/A
657 ! TYPE: Subset_type
658 ! DIMENSION: Scalar
659 ! ATTRIBUTES: INTENT(IN)
660 !
661 ! OUTPUTS:
662 ! SC_Subset: SpcCoeff object containing the requested channel subset
663 ! of the input SpcCoeff data.
664 ! UNITS: N/A
665 ! TYPE: SpcCoeff_type
666 ! DIMENSION: Scalar
667 ! ATTRIBUTES: INTENT(OUT)
668 !
669 !:sdoc-:
670 !--------------------------------------------------------------------------------
671 
672  SUBROUTINE spccoeff_subset( &
673  SpcCoeff , & ! Input
674  Sensor_Channel, & ! Input
675  SC_Subset ) ! Output
676  ! Arguments
677  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
678  INTEGER , INTENT(IN) :: sensor_channel(:)
679  TYPE(spccoeff_type), INTENT(OUT) :: sc_subset
680  ! Local variables
681  TYPE(subset_type) :: subset
682  INTEGER :: n_subset_channels
683  INTEGER, ALLOCATABLE :: idx(:)
684 
685  ! Check input is valid
686  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
687 
688  ! Generate the subset list
689  CALL subset_generate( &
690  subset, &
691  spccoeff%Sensor_Channel, &
692  sensor_channel )
693  IF ( .NOT. subset_associated( subset ) ) RETURN
694 
695 
696  ! Allocate the output subset SpcCoeff object
697  CALL subset_getvalue( subset, n_values = n_subset_channels, index = idx )
698  CALL spccoeff_create( sc_subset, n_subset_channels )
699  IF ( .NOT. spccoeff_associated(sc_subset) ) RETURN
700 
701 
702  ! Extract out the subset channels
703  ! ...First assign some scalars
704  sc_subset%Version = spccoeff%Version
705  sc_subset%Sensor_Id = spccoeff%Sensor_Id
706  sc_subset%Sensor_Type = spccoeff%Sensor_Type
707  sc_subset%WMO_Satellite_ID = spccoeff%WMO_Satellite_ID
708  sc_subset%WMO_Sensor_ID = spccoeff%WMO_Sensor_ID
709  ! ...and now extract the subset
710  sc_subset%Sensor_Channel = spccoeff%Sensor_Channel(idx)
711  sc_subset%Polarization = spccoeff%Polarization(idx)
712  sc_subset%Channel_Flag = spccoeff%Channel_Flag(idx)
713  sc_subset%Frequency = spccoeff%Frequency(idx)
714  sc_subset%Wavenumber = spccoeff%Wavenumber(idx)
715  sc_subset%Planck_C1 = spccoeff%Planck_C1(idx)
716  sc_subset%Planck_C2 = spccoeff%Planck_C2(idx)
717  sc_subset%Band_C1 = spccoeff%Band_C1(idx)
718  sc_subset%Band_C2 = spccoeff%Band_C2(idx)
719  sc_subset%Cosmic_Background_Radiance = spccoeff%Cosmic_Background_Radiance(idx)
720  sc_subset%Solar_Irradiance = spccoeff%Solar_Irradiance(idx)
721 
722 
723  ! Operate on the components
724  ! ...Antenna correction coefficients
725  IF ( accoeff_associated( spccoeff%AC ) ) &
726  CALL accoeff_subset( spccoeff%AC, sensor_channel, sc_subset%AC )
727  ! ...NLTE correction coefficients
728  IF ( nltecoeff_associated( spccoeff%NC ) ) &
729  CALL nltecoeff_subset( spccoeff%NC, sensor_channel, sc_subset%NC )
730 
731  END SUBROUTINE spccoeff_subset
732 
733 
734 !--------------------------------------------------------------------------------
735 !:sdoc+:
736 !
737 ! NAME:
738 ! SpcCoeff_Concat
739 !
740 ! PURPOSE:
741 ! Subroutine to concatenate multiple SpcCoeff objects along the channel
742 ! dimension into a single SpcCoeff object.
743 !
744 ! CALLING SEQUENCE:
745 ! CALL SpcCoeff_Concat( SpcCoeff, SC_Array, Sensor_Id=Sensor_Id )
746 !
747 ! OBJECTS:
748 ! SpcCoeff: SpcCoeff object containing the concatenated result.
749 ! UNITS: N/A
750 ! TYPE: SpcCoeff_type
751 ! DIMENSION: Scalar
752 ! ATTRIBUTES: INTENT(OUT)
753 !
754 ! INPUTS:
755 ! SC_Array: Array of SpcCoeff objects to be concatenated.
756 ! UNITS: N/A
757 ! TYPE: SpcCoeff_type
758 ! DIMENSION: Rank-1
759 ! ATTRIBUTES: INTENT(IN)
760 !
761 ! OPTIONAL INPUTS:
762 ! Sensor_Id: Sensor id character to string to use for the concatenated
763 ! result. If not specified, the sensor id of the first valid
764 ! element of SC_Array is used.
765 ! UNITS: N/A
766 ! TYPE: CHARACTER(*)
767 ! DIMENSION: Scalar
768 ! ATTRIBUTES: INTENT(IN), OPTIONAL
769 !
770 !:sdoc-:
771 !--------------------------------------------------------------------------------
772 
773  SUBROUTINE spccoeff_concat( &
774  SpcCoeff , & ! Output
775  SC_Array , & ! Input
776  Sensor_Id ) ! Optional input
777  ! Arguments
778  TYPE(spccoeff_type) , INTENT(OUT) :: spccoeff
779  TYPE(spccoeff_type) , INTENT(IN) :: sc_array(:)
780  CHARACTER(*), OPTIONAL, INTENT(IN) :: sensor_id
781  ! Local variables
782  INTEGER, ALLOCATABLE :: valid_index(:)
783  INTEGER :: i, j, n_sc, n_valid, n_channels
784  INTEGER :: ch1, ch2
785 
786  ! Set up
787  ! ...Check input is valid
788  n_sc = SIZE(sc_array)
789  IF ( n_sc < 1 ) RETURN ! Zero-sized array
790  ! ...Count valid input
791  n_valid = count(spccoeff_associated(sc_array))
792  IF ( n_valid == 0 ) RETURN ! All elements unallocated
793  ! ...Index the valid input
794  ALLOCATE( valid_index(n_valid) )
795  valid_index = pack( (/(i,i=1,n_sc)/), mask=spccoeff_associated(sc_array) )
796  ! ...Check non-channel dimensions and ids
797  DO j = 1, n_valid
798  i = valid_index(j)
799  IF ( sc_array(i)%Sensor_Type /= sc_array(valid_index(1))%Sensor_Type .OR. &
800  sc_array(i)%WMO_Satellite_ID /= sc_array(valid_index(1))%WMO_Satellite_ID .OR. &
801  sc_array(i)%WMO_Sensor_ID /= sc_array(valid_index(1))%WMO_Sensor_ID ) THEN
802  RETURN
803  END IF
804  END DO
805 
806 
807  ! Sum channel dimensions
808  n_channels = sum(sc_array%n_Channels)
809 
810 
811  ! Allocate the output concatenated SpcCoeff object
812  CALL spccoeff_create( spccoeff, n_channels )
813  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
814 
815 
816  ! Concatenate the channel data
817  ! ...First assign the non-channel dependent data
818  spccoeff%Version = sc_array(valid_index(1))%Version
819  IF ( PRESENT(sensor_id) ) THEN
820  spccoeff%Sensor_Id = adjustl(sensor_id)
821  ELSE
822  spccoeff%Sensor_Id = sc_array(valid_index(1))%Sensor_Id
823  END IF
824  spccoeff%Sensor_Type = sc_array(valid_index(1))%Sensor_Type
825  spccoeff%WMO_Satellite_ID = sc_array(valid_index(1))%WMO_Satellite_ID
826  spccoeff%WMO_Sensor_ID = sc_array(valid_index(1))%WMO_Sensor_ID
827  ! ...and now concatenate the channel data
828  ch1 = 1
829  DO j = 1, n_valid
830  i = valid_index(j)
831 
832  ch2 = ch1 + sc_array(i)%n_Channels - 1
833 
834  spccoeff%Sensor_Channel(ch1:ch2) = sc_array(i)%Sensor_Channel
835  spccoeff%Polarization(ch1:ch2) = sc_array(i)%Polarization
836  spccoeff%Channel_Flag(ch1:ch2) = sc_array(i)%Channel_Flag
837  spccoeff%Frequency(ch1:ch2) = sc_array(i)%Frequency
838  spccoeff%Wavenumber(ch1:ch2) = sc_array(i)%Wavenumber
839  spccoeff%Planck_C1(ch1:ch2) = sc_array(i)%Planck_C1
840  spccoeff%Planck_C2(ch1:ch2) = sc_array(i)%Planck_C2
841  spccoeff%Band_C1(ch1:ch2) = sc_array(i)%Band_C1
842  spccoeff%Band_C2(ch1:ch2) = sc_array(i)%Band_C2
843  spccoeff%Cosmic_Background_Radiance(ch1:ch2) = sc_array(i)%Cosmic_Background_Radiance
844  spccoeff%Solar_Irradiance(ch1:ch2) = sc_array(i)%Solar_Irradiance
845 
846  ch1 = ch2 + 1
847  END DO
848 
849 
850  ! Operate on the components
851  ! ...Antenna correction coefficients
852  CALL accoeff_concat( spccoeff%AC, sc_array%AC, sensor_id = sensor_id )
853  CALL accoeff_channelreindex( spccoeff%AC, spccoeff%Sensor_Channel )
854  ! ...NLTE correction coefficients
855  CALL nltecoeff_concat( spccoeff%NC, sc_array%NC, sensor_id = sensor_id )
856  CALL nltecoeff_channelreindex( spccoeff%NC, spccoeff%Sensor_Channel )
857 
858 
859  ! Cleanup
860  DEALLOCATE( valid_index )
861 
862  END SUBROUTINE spccoeff_concat
863 
864 
865 !--------------------------------------------------------------------------------
866 !:sdoc+:
867 !
868 ! NAME:
869 ! SpcCoeff_ClearAllFlags
870 !
871 ! PURPOSE:
872 ! Elemental subroutine to clear ALL SpcCoeff channel flags.
873 !
874 ! CALLING SEQUENCE:
875 ! CALL SpcCoeff_ClearAllFlags( SpcCoeff, ChannelIndex=ChannelIndex )
876 !
877 ! OBJECTS:
878 ! SpcCoeff: Structure which is to be altered.
879 ! UNITS: N/A
880 ! TYPE: SpcCoeff_type
881 ! DIMENSION: Scalar or any rank
882 ! ATTRIBUTES: INTENT(IN OUT)
883 !
884 ! OPTIONAL INPUTS:
885 ! ChannelIndex: Set this to the index corresponding to a particular
886 ! channel in the SpcCoeff object for which all the
887 ! flags are to be cleared.
888 ! If not specified, all the channels cleared.
889 ! UNITS: N/A
890 ! TYPE: INTEGER
891 ! DIMENSION: Conformable with SpcCoeff input
892 ! ATTRIBUTES: INTENT(IN)
893 !
894 !:sdoc-:
895 !--------------------------------------------------------------------------------
896 
897  ELEMENTAL SUBROUTINE spccoeff_clearallflags( SpcCoeff, ChannelIndex )
898  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
899  INTEGER, OPTIONAL, INTENT(IN) :: channelindex
900  INTEGER :: n
901  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
902  DO n = 0, bit_size(0_long)
903  CALL spccoeff_clearflag( spccoeff, n, channelindex=channelindex )
904  END DO
905  END SUBROUTINE spccoeff_clearallflags
906 
907 
908 !--------------------------------------------------------------------------------
909 !--------------------------------------------------------------------------------
910 ! NOTE: The following flag check, set, and clear procedures were generated
911 ! automatically using the
912 ! gen_flag_procedures.rb
913 ! script. Modify at your own risk!
914 !--------------------------------------------------------------------------------
915 !--------------------------------------------------------------------------------
916 
917 !--------------------------------------------------------------------------------
918 !:sdoc+:
919 !
920 ! NAME:
921 ! SpcCoeff_IsSolar
922 !
923 ! PURPOSE:
924 ! Elemental function to test if SpcCoeff channels are flagged as being
925 ! solar sensitive.
926 !
927 ! CALLING SEQUENCE:
928 ! Status = SpcCoeff_IsSolar( SpcCoeff, ChannelIndex=ChannelIndex )
929 !
930 ! OBJECTS:
931 ! SpcCoeff: Structure which is to be tested.
932 ! UNITS: N/A
933 ! TYPE: SpcCoeff_type
934 ! DIMENSION: Scalar or any rank
935 ! ATTRIBUTES: INTENT(IN)
936 !
937 ! OPTIONAL INPUTS:
938 ! ChannelIndex: Set this to the index corresponding to a particular
939 ! channel in the SpcCoeff object to test if it is a
940 ! solar sensitive channel.
941 ! If not specified, all the channels are tested.
942 ! UNITS: N/A
943 ! TYPE: INTEGER
944 ! DIMENSION: Conformable with SpcCoeff input
945 ! ATTRIBUTES: INTENT(IN)
946 !
947 ! FUNCTION RESULT:
948 ! Status: The return value is a logical value.
949 ! .TRUE. - The channel(s) is(are) solar sensitive.
950 ! .FALSE. - The channel(s) is(are) NOT solar sensitive.
951 ! UNITS: N/A
952 ! TYPE: LOGICAL
953 ! DIMENSION: Same as SpcCoeff input
954 !
955 !:sdoc-:
956 !--------------------------------------------------------------------------------
957 
958  ELEMENTAL FUNCTION spccoeff_issolar(SpcCoeff, ChannelIndex) RESULT(Is_Set)
959  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
960  INTEGER, OPTIONAL, INTENT(IN) :: channelindex
961  LOGICAL :: is_set
962  is_set = .false.
963  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
964  is_set = spccoeff_isflagset(spccoeff, solar_flag, channelindex=channelindex)
965  END FUNCTION spccoeff_issolar
966 
967 
968 !--------------------------------------------------------------------------------
969 !:sdoc+:
970 !
971 ! NAME:
972 ! SpcCoeff_IsZeeman
973 !
974 ! PURPOSE:
975 ! Elemental function to test if SpcCoeff channels are flagged as being
976 ! Zeeman affected.
977 !
978 ! CALLING SEQUENCE:
979 ! Status = SpcCoeff_IsZeeman( SpcCoeff, ChannelIndex=ChannelIndex )
980 !
981 ! OBJECTS:
982 ! SpcCoeff: Structure which is to be tested.
983 ! UNITS: N/A
984 ! TYPE: SpcCoeff_type
985 ! DIMENSION: Scalar or any rank
986 ! ATTRIBUTES: INTENT(IN)
987 !
988 ! OPTIONAL INPUTS:
989 ! ChannelIndex: Set this to the index corresponding to a particular
990 ! channel in the SpcCoeff object to test if it is a
991 ! Zeeman affected channel.
992 ! If not specified, all the channels are tested.
993 ! UNITS: N/A
994 ! TYPE: INTEGER
995 ! DIMENSION: Conformable with SpcCoeff input
996 ! ATTRIBUTES: INTENT(IN)
997 !
998 ! FUNCTION RESULT:
999 ! Status: The return value is a logical value.
1000 ! .TRUE. - The channel(s) is(are) Zeeman affected.
1001 ! .FALSE. - The channel(s) is(are) NOT Zeeman affected.
1002 ! UNITS: N/A
1003 ! TYPE: LOGICAL
1004 ! DIMENSION: Same as SpcCoeff input
1005 !
1006 !:sdoc-:
1007 !--------------------------------------------------------------------------------
1008 
1009  ELEMENTAL FUNCTION spccoeff_iszeeman(SpcCoeff, ChannelIndex) RESULT(Is_Set)
1010  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
1011  INTEGER, OPTIONAL, INTENT(IN) :: channelindex
1012  LOGICAL :: is_set
1013  is_set = .false.
1014  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
1015  is_set = spccoeff_isflagset(spccoeff, zeeman_flag, channelindex=channelindex)
1016  END FUNCTION spccoeff_iszeeman
1017 
1018 
1019 !--------------------------------------------------------------------------------
1020 !:sdoc+:
1021 !
1022 ! NAME:
1023 ! SpcCoeff_SetSolar
1024 !
1025 ! PURPOSE:
1026 ! Elemental subroutine to flag a SpcCoeff channel as solar sensitive.
1027 !
1028 ! CALLING SEQUENCE:
1029 ! CALL SpcCoeff_SetSolar( SpcCoeff, ChannelIndex=ChannelIndex )
1030 !
1031 ! OBJECTS:
1032 ! SpcCoeff: Structure which is to be altered.
1033 ! UNITS: N/A
1034 ! TYPE: SpcCoeff_type
1035 ! DIMENSION: Scalar or any rank
1036 ! ATTRIBUTES: INTENT(IN OUT)
1037 !
1038 ! OPTIONAL INPUTS:
1039 ! ChannelIndex: Set this to the index corresponding to a particular
1040 ! channel in the SpcCoeff object to flag as a
1041 ! solar sensitive channel.
1042 ! If not specified, all the channels are flagged.
1043 ! UNITS: N/A
1044 ! TYPE: INTEGER
1045 ! DIMENSION: Conformable with SpcCoeff input
1046 ! ATTRIBUTES: INTENT(IN)
1047 !
1048 !:sdoc-:
1049 !--------------------------------------------------------------------------------
1050 
1051  ELEMENTAL SUBROUTINE spccoeff_setsolar( SpcCoeff, ChannelIndex )
1052  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1053  INTEGER, OPTIONAL, INTENT(IN) :: channelindex
1054  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
1055  CALL spccoeff_setflag(spccoeff, solar_flag, channelindex=channelindex)
1056  END SUBROUTINE spccoeff_setsolar
1057 
1058 
1059 !--------------------------------------------------------------------------------
1060 !:sdoc+:
1061 !
1062 ! NAME:
1063 ! SpcCoeff_SetZeeman
1064 !
1065 ! PURPOSE:
1066 ! Elemental subroutine to flag a SpcCoeff channel as Zeeman affected.
1067 !
1068 ! CALLING SEQUENCE:
1069 ! CALL SpcCoeff_SetZeeman( SpcCoeff, ChannelIndex=ChannelIndex )
1070 !
1071 ! OBJECTS:
1072 ! SpcCoeff: Structure which is to be altered.
1073 ! UNITS: N/A
1074 ! TYPE: SpcCoeff_type
1075 ! DIMENSION: Scalar or any rank
1076 ! ATTRIBUTES: INTENT(IN OUT)
1077 !
1078 ! OPTIONAL INPUTS:
1079 ! ChannelIndex: Set this to the index corresponding to a particular
1080 ! channel in the SpcCoeff object to flag as a
1081 ! Zeeman affected channel.
1082 ! If not specified, all the channels are flagged.
1083 ! UNITS: N/A
1084 ! TYPE: INTEGER
1085 ! DIMENSION: Conformable with SpcCoeff input
1086 ! ATTRIBUTES: INTENT(IN)
1087 !
1088 !:sdoc-:
1089 !--------------------------------------------------------------------------------
1090 
1091  ELEMENTAL SUBROUTINE spccoeff_setzeeman( SpcCoeff, ChannelIndex )
1092  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1093  INTEGER, OPTIONAL, INTENT(IN) :: channelindex
1094  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
1095  CALL spccoeff_setflag(spccoeff, zeeman_flag, channelindex=channelindex)
1096  END SUBROUTINE spccoeff_setzeeman
1097 
1098 
1099 !--------------------------------------------------------------------------------
1100 !:sdoc+:
1101 !
1102 ! NAME:
1103 ! SpcCoeff_ClearSolar
1104 !
1105 ! PURPOSE:
1106 ! Elemental subroutine to flag a SpcCoeff channel as NOT being
1107 ! solar sensitive.
1108 !
1109 ! CALLING SEQUENCE:
1110 ! CALL SpcCoeff_ClearSolar( SpcCoeff, ChannelIndex=ChannelIndex )
1111 !
1112 ! OBJECTS:
1113 ! SpcCoeff: Structure which is to be altered.
1114 ! UNITS: N/A
1115 ! TYPE: SpcCoeff_type
1116 ! DIMENSION: Scalar or any rank
1117 ! ATTRIBUTES: INTENT(IN OUT)
1118 !
1119 ! OPTIONAL INPUTS:
1120 ! ChannelIndex: Set this to the index corresponding to a particular
1121 ! channel in the SpcCoeff object to indicate as being
1122 ! NOT solar sensitive.
1123 ! If not specified, all the channels cleared.
1124 ! UNITS: N/A
1125 ! TYPE: INTEGER
1126 ! DIMENSION: Conformable with SpcCoeff input
1127 ! ATTRIBUTES: INTENT(IN)
1128 !
1129 !:sdoc-:
1130 !--------------------------------------------------------------------------------
1131 
1132  ELEMENTAL SUBROUTINE spccoeff_clearsolar( SpcCoeff, ChannelIndex )
1133  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1134  INTEGER, OPTIONAL, INTENT(IN) :: channelindex
1135  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
1136  CALL spccoeff_clearflag( spccoeff, solar_flag, channelindex=channelindex )
1137  END SUBROUTINE spccoeff_clearsolar
1138 
1139 
1140 !--------------------------------------------------------------------------------
1141 !:sdoc+:
1142 !
1143 ! NAME:
1144 ! SpcCoeff_ClearZeeman
1145 !
1146 ! PURPOSE:
1147 ! Elemental subroutine to flag a SpcCoeff channel as NOT being
1148 ! Zeeman affected.
1149 !
1150 ! CALLING SEQUENCE:
1151 ! CALL SpcCoeff_ClearZeeman( SpcCoeff, ChannelIndex=ChannelIndex )
1152 !
1153 ! OBJECTS:
1154 ! SpcCoeff: Structure which is to be altered.
1155 ! UNITS: N/A
1156 ! TYPE: SpcCoeff_type
1157 ! DIMENSION: Scalar or any rank
1158 ! ATTRIBUTES: INTENT(IN OUT)
1159 !
1160 ! OPTIONAL INPUTS:
1161 ! ChannelIndex: Set this to the index corresponding to a particular
1162 ! channel in the SpcCoeff object to indicate as being
1163 ! NOT Zeeman affected.
1164 ! If not specified, all the channels cleared.
1165 ! UNITS: N/A
1166 ! TYPE: INTEGER
1167 ! DIMENSION: Conformable with SpcCoeff input
1168 ! ATTRIBUTES: INTENT(IN)
1169 !
1170 !:sdoc-:
1171 !--------------------------------------------------------------------------------
1172 
1173  ELEMENTAL SUBROUTINE spccoeff_clearzeeman( SpcCoeff, ChannelIndex )
1174  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1175  INTEGER, OPTIONAL, INTENT(IN) :: channelindex
1176  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
1177  CALL spccoeff_clearflag( spccoeff, zeeman_flag, channelindex=channelindex )
1178  END SUBROUTINE spccoeff_clearzeeman
1179 
1180 
1181 
1182 
1183 !--------------------------------------------------------------------------------
1184 !--------------------------------------------------------------------------------
1185 ! NOTE: The following sensor check and set procedures were generated
1186 ! automatically using the
1187 ! gen_sensor_procedures.rb
1188 ! script. Modify at your own risk!
1189 !--------------------------------------------------------------------------------
1190 !--------------------------------------------------------------------------------
1191 
1192 !--------------------------------------------------------------------------------
1193 !:sdoc+:
1194 !
1195 ! NAME:
1196 ! SpcCoeff_IsMicrowaveSensor
1197 !
1198 ! PURPOSE:
1199 ! Elemental function to test if the SpcCoeff object is for
1200 ! a microwave sensor.
1201 !
1202 ! CALLING SEQUENCE:
1203 ! Status = SpcCoeff_IsMicrowaveSensor( SpcCoeff )
1204 !
1205 ! OBJECTS:
1206 ! SpcCoeff: Structure which is to be tested.
1207 ! UNITS: N/A
1208 ! TYPE: SpcCoeff_type
1209 ! DIMENSION: Scalar or any rank
1210 ! ATTRIBUTES: INTENT(IN)
1211 !
1212 ! FUNCTION RESULT:
1213 ! Status: The return value is a logical value.
1214 ! .TRUE. - The sensor is a microwave instrument.
1215 ! .FALSE. - The sensor is NOT a microwave instrument.
1216 ! UNITS: N/A
1217 ! TYPE: LOGICAL
1218 ! DIMENSION: Same as SpcCoeff input
1219 !
1220 !:sdoc-:
1221 !--------------------------------------------------------------------------------
1222 
1223  ELEMENTAL FUNCTION spccoeff_ismicrowavesensor(SpcCoeff) RESULT(Is_Set)
1224  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
1225  LOGICAL :: is_set
1226  is_set = spccoeff_issensor(spccoeff, microwave_sensor)
1227  END FUNCTION spccoeff_ismicrowavesensor
1228 
1229 
1230 !--------------------------------------------------------------------------------
1231 !:sdoc+:
1232 !
1233 ! NAME:
1234 ! SpcCoeff_IsInfraredSensor
1235 !
1236 ! PURPOSE:
1237 ! Elemental function to test if the SpcCoeff object is for
1238 ! an infrared sensor.
1239 !
1240 ! CALLING SEQUENCE:
1241 ! Status = SpcCoeff_IsInfraredSensor( SpcCoeff )
1242 !
1243 ! OBJECTS:
1244 ! SpcCoeff: Structure which is to be tested.
1245 ! UNITS: N/A
1246 ! TYPE: SpcCoeff_type
1247 ! DIMENSION: Scalar or any rank
1248 ! ATTRIBUTES: INTENT(IN)
1249 !
1250 ! FUNCTION RESULT:
1251 ! Status: The return value is a logical value.
1252 ! .TRUE. - The sensor is an infrared instrument.
1253 ! .FALSE. - The sensor is NOT an infrared instrument.
1254 ! UNITS: N/A
1255 ! TYPE: LOGICAL
1256 ! DIMENSION: Same as SpcCoeff input
1257 !
1258 !:sdoc-:
1259 !--------------------------------------------------------------------------------
1260 
1261  ELEMENTAL FUNCTION spccoeff_isinfraredsensor(SpcCoeff) RESULT(Is_Set)
1262  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
1263  LOGICAL :: is_set
1264  is_set = spccoeff_issensor(spccoeff, infrared_sensor)
1265  END FUNCTION spccoeff_isinfraredsensor
1266 
1267 
1268 !--------------------------------------------------------------------------------
1269 !:sdoc+:
1270 !
1271 ! NAME:
1272 ! SpcCoeff_IsVisibleSensor
1273 !
1274 ! PURPOSE:
1275 ! Elemental function to test if the SpcCoeff object is for
1276 ! a visible sensor.
1277 !
1278 ! CALLING SEQUENCE:
1279 ! Status = SpcCoeff_IsVisibleSensor( SpcCoeff )
1280 !
1281 ! OBJECTS:
1282 ! SpcCoeff: Structure which is to be tested.
1283 ! UNITS: N/A
1284 ! TYPE: SpcCoeff_type
1285 ! DIMENSION: Scalar or any rank
1286 ! ATTRIBUTES: INTENT(IN)
1287 !
1288 ! FUNCTION RESULT:
1289 ! Status: The return value is a logical value.
1290 ! .TRUE. - The sensor is a visible instrument.
1291 ! .FALSE. - The sensor is NOT a visible instrument.
1292 ! UNITS: N/A
1293 ! TYPE: LOGICAL
1294 ! DIMENSION: Same as SpcCoeff input
1295 !
1296 !:sdoc-:
1297 !--------------------------------------------------------------------------------
1298 
1299  ELEMENTAL FUNCTION spccoeff_isvisiblesensor(SpcCoeff) RESULT(Is_Set)
1300  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
1301  LOGICAL :: is_set
1302  is_set = spccoeff_issensor(spccoeff, visible_sensor)
1303  END FUNCTION spccoeff_isvisiblesensor
1304 
1305 
1306 !--------------------------------------------------------------------------------
1307 !:sdoc+:
1308 !
1309 ! NAME:
1310 ! SpcCoeff_IsUltravioletSensor
1311 !
1312 ! PURPOSE:
1313 ! Elemental function to test if the SpcCoeff object is for
1314 ! an ultraviolet sensor.
1315 !
1316 ! CALLING SEQUENCE:
1317 ! Status = SpcCoeff_IsUltravioletSensor( SpcCoeff )
1318 !
1319 ! OBJECTS:
1320 ! SpcCoeff: Structure which is to be tested.
1321 ! UNITS: N/A
1322 ! TYPE: SpcCoeff_type
1323 ! DIMENSION: Scalar or any rank
1324 ! ATTRIBUTES: INTENT(IN)
1325 !
1326 ! FUNCTION RESULT:
1327 ! Status: The return value is a logical value.
1328 ! .TRUE. - The sensor is an ultraviolet instrument.
1329 ! .FALSE. - The sensor is NOT an ultraviolet instrument.
1330 ! UNITS: N/A
1331 ! TYPE: LOGICAL
1332 ! DIMENSION: Same as SpcCoeff input
1333 !
1334 !:sdoc-:
1335 !--------------------------------------------------------------------------------
1336 
1337  ELEMENTAL FUNCTION spccoeff_isultravioletsensor(SpcCoeff) RESULT(Is_Set)
1338  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
1339  LOGICAL :: is_set
1340  is_set = spccoeff_issensor(spccoeff, ultraviolet_sensor)
1341  END FUNCTION spccoeff_isultravioletsensor
1342 
1343 
1344 !--------------------------------------------------------------------------------
1345 !:sdoc+:
1346 !
1347 ! NAME:
1348 ! SpcCoeff_SetMicrowaveSensor
1349 !
1350 ! PURPOSE:
1351 ! Elemental subroutine to set a SpcCoeff object as being
1352 ! for a microwave sensor.
1353 !
1354 ! CALLING SEQUENCE:
1355 ! CALL SpcCoeff_SetMicrowaveSensor( SpcCoeff )
1356 !
1357 ! OBJECTS:
1358 ! SpcCoeff: Structure which is to be altered.
1359 ! UNITS: N/A
1360 ! TYPE: SpcCoeff_type
1361 ! DIMENSION: Scalar or any rank
1362 ! ATTRIBUTES: INTENT(IN OUT)
1363 !
1364 !:sdoc-:
1365 !--------------------------------------------------------------------------------
1366 
1367  ELEMENTAL SUBROUTINE spccoeff_setmicrowavesensor( SpcCoeff )
1368  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1369  CALL spccoeff_setsensor(spccoeff, microwave_sensor)
1370  END SUBROUTINE spccoeff_setmicrowavesensor
1371 
1372 
1373 !--------------------------------------------------------------------------------
1374 !:sdoc+:
1375 !
1376 ! NAME:
1377 ! SpcCoeff_SetInfraredSensor
1378 !
1379 ! PURPOSE:
1380 ! Elemental subroutine to set a SpcCoeff object as being
1381 ! for an infrared sensor.
1382 !
1383 ! CALLING SEQUENCE:
1384 ! CALL SpcCoeff_SetInfraredSensor( SpcCoeff )
1385 !
1386 ! OBJECTS:
1387 ! SpcCoeff: Structure which is to be altered.
1388 ! UNITS: N/A
1389 ! TYPE: SpcCoeff_type
1390 ! DIMENSION: Scalar or any rank
1391 ! ATTRIBUTES: INTENT(IN OUT)
1392 !
1393 !:sdoc-:
1394 !--------------------------------------------------------------------------------
1395 
1396  ELEMENTAL SUBROUTINE spccoeff_setinfraredsensor( SpcCoeff )
1397  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1398  CALL spccoeff_setsensor(spccoeff, infrared_sensor)
1399  END SUBROUTINE spccoeff_setinfraredsensor
1400 
1401 
1402 !--------------------------------------------------------------------------------
1403 !:sdoc+:
1404 !
1405 ! NAME:
1406 ! SpcCoeff_SetVisibleSensor
1407 !
1408 ! PURPOSE:
1409 ! Elemental subroutine to set a SpcCoeff object as being
1410 ! for a visible sensor.
1411 !
1412 ! CALLING SEQUENCE:
1413 ! CALL SpcCoeff_SetVisibleSensor( SpcCoeff )
1414 !
1415 ! OBJECTS:
1416 ! SpcCoeff: Structure which is to be altered.
1417 ! UNITS: N/A
1418 ! TYPE: SpcCoeff_type
1419 ! DIMENSION: Scalar or any rank
1420 ! ATTRIBUTES: INTENT(IN OUT)
1421 !
1422 !:sdoc-:
1423 !--------------------------------------------------------------------------------
1424 
1425  ELEMENTAL SUBROUTINE spccoeff_setvisiblesensor( SpcCoeff )
1426  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1427  CALL spccoeff_setsensor(spccoeff, visible_sensor)
1428  END SUBROUTINE spccoeff_setvisiblesensor
1429 
1430 
1431 !--------------------------------------------------------------------------------
1432 !:sdoc+:
1433 !
1434 ! NAME:
1435 ! SpcCoeff_SetUltravioletSensor
1436 !
1437 ! PURPOSE:
1438 ! Elemental subroutine to set a SpcCoeff object as being
1439 ! for an ultraviolet sensor.
1440 !
1441 ! CALLING SEQUENCE:
1442 ! CALL SpcCoeff_SetUltravioletSensor( SpcCoeff )
1443 !
1444 ! OBJECTS:
1445 ! SpcCoeff: Structure which is to be altered.
1446 ! UNITS: N/A
1447 ! TYPE: SpcCoeff_type
1448 ! DIMENSION: Scalar or any rank
1449 ! ATTRIBUTES: INTENT(IN OUT)
1450 !
1451 !:sdoc-:
1452 !--------------------------------------------------------------------------------
1453 
1454  ELEMENTAL SUBROUTINE spccoeff_setultravioletsensor( SpcCoeff )
1455  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1456  CALL spccoeff_setsensor(spccoeff, ultraviolet_sensor)
1457  END SUBROUTINE spccoeff_setultravioletsensor
1458 
1459 
1460 !--------------------------------------------------------------------------------
1461 !:sdoc+:
1462 !
1463 ! NAME:
1464 ! SpcCoeff_ClearSensor
1465 !
1466 ! PURPOSE:
1467 ! Elemental subroutine to reinitialise the sensor type.
1468 !
1469 ! CALLING SEQUENCE:
1470 ! CALL SpcCoeff_ClearSensor( SpcCoeff )
1471 !
1472 ! OBJECTS:
1473 ! SpcCoeff: Structure which is to be altered.
1474 ! UNITS: N/A
1475 ! TYPE: SpcCoeff_type
1476 ! DIMENSION: Scalar or any rank
1477 ! ATTRIBUTES: INTENT(IN OUT)
1478 !
1479 !:sdoc-:
1480 !--------------------------------------------------------------------------------
1481 
1482  ELEMENTAL SUBROUTINE spccoeff_clearsensor(SpcCoeff)
1483  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1484  spccoeff%Sensor_Type = invalid_sensor
1485  END SUBROUTINE spccoeff_clearsensor
1486 
1487 
1488 !##################################################################################
1489 !##################################################################################
1490 !## ##
1491 !## ## PRIVATE MODULE ROUTINES ## ##
1492 !## ##
1493 !##################################################################################
1494 !##################################################################################
1495 
1496 !------------------------------------------------------------------------------
1497 !
1498 ! NAME:
1499 ! SpcCoeff_Equal
1500 !
1501 ! PURPOSE:
1502 ! Elemental function to test the equality of two SpcCoeff objects.
1503 ! Used in OPERATOR(==) interface block.
1504 !
1505 ! CALLING SEQUENCE:
1506 ! is_equal = SpcCoeff_Equal( x, y )
1507 !
1508 ! or
1509 !
1510 ! IF ( x == y ) THEN
1511 ! ...
1512 ! END IF
1513 !
1514 ! OBJECTS:
1515 ! x, y: Two SpcCoeff objects to be compared.
1516 ! UNITS: N/A
1517 ! TYPE: SpcCoeff_type
1518 ! DIMENSION: Scalar or any rank
1519 ! ATTRIBUTES: INTENT(IN)
1520 !
1521 ! FUNCTION RESULT:
1522 ! is_equal: Logical value indicating whether the inputs are equal.
1523 ! UNITS: N/A
1524 ! TYPE: LOGICAL
1525 ! DIMENSION: Same as inputs.
1526 !
1527 !------------------------------------------------------------------------------
1528 
1529  ELEMENTAL FUNCTION spccoeff_equal( x, y ) RESULT( is_equal )
1530  TYPE(spccoeff_type), INTENT(IN) :: x, y
1531  LOGICAL :: is_equal
1532 
1533  ! Set up
1534  is_equal = .false.
1535 
1536  ! Check the object association status
1537  IF ( (.NOT. spccoeff_associated(x)) .OR. &
1538  (.NOT. spccoeff_associated(y)) ) RETURN
1539 
1540  ! Check contents
1541  ! ...Release/version info
1542  IF ( (x%Release /= y%Release) .OR. &
1543  (x%Version /= y%Version) ) RETURN
1544  ! ...Dimensions
1545  IF ( x%n_Channels /= y%n_Channels ) RETURN
1546  ! ...Scalars
1547  IF ( (x%Sensor_Id /= y%Sensor_Id ) .OR. &
1548  (x%WMO_Satellite_ID /= y%WMO_Satellite_ID) .OR. &
1549  (x%WMO_Sensor_ID /= y%WMO_Sensor_ID ) .OR. &
1550  (x%Sensor_Type /= y%Sensor_Type ) ) RETURN
1551  ! ...Structures
1552  IF ( accoeff_associated( x%AC ) .NEQV. accoeff_associated( y%AC ) ) RETURN
1553  IF ( accoeff_associated( x%AC ) .AND. accoeff_associated( y%AC ) ) THEN
1554  IF ( .NOT. (x%AC == y%AC) ) RETURN
1555  END IF
1556  IF ( nltecoeff_associated( x%NC ) .NEQV. nltecoeff_associated( y%NC ) ) RETURN
1557  IF ( nltecoeff_associated( x%NC ) .AND. nltecoeff_associated( y%NC ) ) THEN
1558  IF ( .NOT. (x%NC == y%NC) ) RETURN
1559  END IF
1560  ! ...Arrays
1561  IF ( all(x%Sensor_Channel == y%Sensor_Channel ) .AND. &
1562  all(x%Polarization == y%Polarization ) .AND. &
1563  all(x%Channel_Flag == y%Channel_Flag ) .AND. &
1564  all(x%Frequency .equalto. y%Frequency ) .AND. &
1565  all(x%Wavenumber .equalto. y%Wavenumber ) .AND. &
1566  all(x%Planck_C1 .equalto. y%Planck_C1 ) .AND. &
1567  all(x%Planck_C2 .equalto. y%Planck_C2 ) .AND. &
1568  all(x%Band_C1 .equalto. y%Band_C1 ) .AND. &
1569  all(x%Band_C2 .equalto. y%Band_C2 ) .AND. &
1570  all(x%Cosmic_Background_Radiance .equalto. y%Cosmic_Background_Radiance) .AND. &
1571  all(x%Solar_Irradiance .equalto. y%Solar_Irradiance ) ) &
1572  is_equal = .true.
1573 
1574  END FUNCTION spccoeff_equal
1575 
1576 
1577  ELEMENTAL FUNCTION spccoeff_issensor(SpcCoeff, Sensor_Type) RESULT(Is_Set)
1578  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
1579  INTEGER, INTENT(IN) :: sensor_type
1580  LOGICAL :: is_set
1581  is_set = .false.
1582  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
1583  is_set = (spccoeff%Sensor_Type == sensor_type)
1584  END FUNCTION spccoeff_issensor
1585 
1586 
1587  ELEMENTAL SUBROUTINE spccoeff_setsensor(SpcCoeff, Sensor_Type)
1588  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1589  INTEGER , INTENT(IN) :: sensor_type
1590  spccoeff%Sensor_Type = sensor_type
1591  END SUBROUTINE spccoeff_setsensor
1592 
1593 
1594 !--------------------------------------------------------------------------------
1595 !
1596 ! NAME:
1597 ! SpcCoeff_IsFlagSet
1598 !
1599 ! PURPOSE:
1600 ! Private elemental function to test if ANY SpcCoeff channels have
1601 ! the specified bitflags set in the Channel_Flag component.
1602 !
1603 ! CALLING SEQUENCE:
1604 ! Status = SpcCoeff_IsFlagSet( &
1605 ! SpcCoeff , &
1606 ! Flag_Type, &
1607 ! ChannelIndex=ChannelIndex )
1608 !
1609 ! OBJECTS:
1610 ! SpcCoeff: Structure which is to be tested.
1611 ! UNITS: N/A
1612 ! TYPE: SpcCoeff_type
1613 ! DIMENSION: Scalar or any rank
1614 ! ATTRIBUTES: INTENT(IN)
1615 !
1616 ! INPUTS:
1617 ! Flag_Type: Integer specifying the bitflag position.
1618 ! UNITS: N/A
1619 ! TYPE: INTEGER
1620 ! DIMENSION: Scalar or any rank
1621 ! ATTRIBUTES: INTENT(IN)
1622 !
1623 ! OPTIONAL INPUTS:
1624 ! ChannelIndex: Set this to the index corresponding to a particular
1625 ! channel in the SpcCoeff object to test.
1626 ! If not specified, all the channels are tested.
1627 ! UNITS: N/A
1628 ! TYPE: INTEGER
1629 ! DIMENSION: Conformable with SpcCoeff input
1630 ! ATTRIBUTES: INTENT(IN)
1631 !
1632 ! FUNCTION RESULT:
1633 ! Status: The return value is a logical value.
1634 ! .TRUE. - The specified flag is set on ANY channel.
1635 ! .FALSE. - The specified flag is NOT set on ALL channels.
1636 ! UNITS: N/A
1637 ! TYPE: LOGICAL
1638 ! DIMENSION: Same as SpcCoeff input
1639 !
1640 !--------------------------------------------------------------------------------
1641 
1642  ELEMENTAL FUNCTION spccoeff_isflagset( &
1643  SpcCoeff , & ! Input
1644  Flag_Type , & ! Input
1645  ChannelIndex ) & ! Optional input
1646  result(is_set)
1647  ! Arguments
1648  TYPE(spccoeff_type), INTENT(IN) :: spccoeff
1649  INTEGER , INTENT(IN) :: flag_type
1650  INTEGER, OPTIONAL , INTENT(IN) :: channelindex
1651  ! Function result
1652  LOGICAL :: is_set
1653 
1654  ! Setup
1655  is_set = .false.
1656  IF ( .NOT. spccoeff_associated(spccoeff) ) RETURN
1657 
1658  ! Perform test based on presence of channel index
1659  IF ( PRESENT(channelindex) ) THEN
1660  IF ( channelindex < 1 .OR. channelindex > spccoeff%n_Channels ) RETURN
1661  is_set = btest(spccoeff%Channel_Flag(channelindex),flag_type)
1662  ELSE
1663  is_set = any(btest(spccoeff%Channel_Flag,flag_type))
1664  END IF
1665 
1666  END FUNCTION spccoeff_isflagset
1667 
1668 
1669 !--------------------------------------------------------------------------------
1670 !
1671 ! NAME:
1672 ! SpcCoeff_SetFlag
1673 !
1674 ! PURPOSE:
1675 ! Private elemental subroutine to set the specified bitflags in the
1676 ! Channel_Flag component of an SpcCoeff object.
1677 !
1678 ! CALLING SEQUENCE:
1679 ! CALL SpcCoeff_SetFlag( &
1680 ! SpcCoeff , &
1681 ! Flag_Type, &
1682 ! ChannelIndex=ChannelIndex )
1683 !
1684 ! OBJECTS:
1685 ! SpcCoeff: Structure which is to have its channel bitflags set.
1686 ! UNITS: N/A
1687 ! TYPE: SpcCoeff_type
1688 ! DIMENSION: Scalar or any rank
1689 ! ATTRIBUTES: INTENT(IN OUT)
1690 !
1691 ! INPUTS:
1692 ! Flag_Type: Integer specifying the bitflag position.
1693 ! UNITS: N/A
1694 ! TYPE: INTEGER
1695 ! DIMENSION: Scalar or any rank
1696 ! ATTRIBUTES: INTENT(IN)
1697 !
1698 ! OPTIONAL INPUTS:
1699 ! ChannelIndex: Set this to the index corresponding to a particular
1700 ! channel in the SpcCoeff object for which the bitflag
1701 ! is to be set.
1702 ! If not specified, the bitflag is set for all the channels.
1703 ! UNITS: N/A
1704 ! TYPE: INTEGER
1705 ! DIMENSION: Conformable with SpcCoeff input
1706 ! ATTRIBUTES: INTENT(IN)
1707 !
1708 !--------------------------------------------------------------------------------
1709 
1710  ELEMENTAL SUBROUTINE spccoeff_setflag( &
1711  SpcCoeff , & ! In/Output
1712  Flag_Type , & ! Input
1713  ChannelIndex ) ! Optional input
1714  ! Arguments
1715  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1716  INTEGER , INTENT(IN) :: flag_type
1717  INTEGER, OPTIONAL , INTENT(IN) :: channelindex
1718 
1719  ! Perform test based on presence of channel index
1720  IF ( PRESENT(channelindex) ) THEN
1721  IF ( channelindex < 1 .OR. channelindex > spccoeff%n_Channels ) RETURN
1722  spccoeff%Channel_Flag(channelindex) = ibset(spccoeff%Channel_Flag(channelindex),flag_type)
1723  ELSE
1724  spccoeff%Channel_Flag = ibset(spccoeff%Channel_Flag,flag_type)
1725  END IF
1726 
1727  END SUBROUTINE spccoeff_setflag
1728 
1729 
1730 !--------------------------------------------------------------------------------
1731 !
1732 ! NAME:
1733 ! SpcCoeff_ClearFlag
1734 !
1735 ! PURPOSE:
1736 ! Private elemental subroutine to clear the specified bitflags in the
1737 ! Channel_Flag component of an SpcCoeff object.
1738 !
1739 ! CALLING SEQUENCE:
1740 ! CALL SpcCoeff_ClearFlag( &
1741 ! SpcCoeff , &
1742 ! Flag_Type, &
1743 ! ChannelIndex=ChannelIndex )
1744 !
1745 ! OBJECTS:
1746 ! SpcCoeff: Structure which is to have its channel bitflags cleared.
1747 ! UNITS: N/A
1748 ! TYPE: SpcCoeff_type
1749 ! DIMENSION: Scalar or any rank
1750 ! ATTRIBUTES: INTENT(IN OUT)
1751 !
1752 ! INPUTS:
1753 ! Flag_Type: Integer specifying the bitflag position.
1754 ! UNITS: N/A
1755 ! TYPE: INTEGER
1756 ! DIMENSION: Scalar or any rank
1757 ! ATTRIBUTES: INTENT(IN)
1758 !
1759 ! OPTIONAL INPUTS:
1760 ! ChannelIndex: Set this to the index corresponding to a particular
1761 ! channel in the SpcCoeff object for which the bitflag
1762 ! is to be cleared.
1763 ! If not specified, the bitflag is cleared for all the
1764 ! channels.
1765 ! UNITS: N/A
1766 ! TYPE: INTEGER
1767 ! DIMENSION: Conformable with SpcCoeff input
1768 ! ATTRIBUTES: INTENT(IN)
1769 !
1770 !--------------------------------------------------------------------------------
1771 
1772  ELEMENTAL SUBROUTINE spccoeff_clearflag( &
1773  SpcCoeff , & ! In/Output
1774  Flag_Type , & ! Input
1775  ChannelIndex ) ! Optional input
1776  ! Arguments
1777  TYPE(spccoeff_type), INTENT(IN OUT) :: spccoeff
1778  INTEGER , INTENT(IN) :: flag_type
1779  INTEGER, OPTIONAL , INTENT(IN) :: channelindex
1780 
1781  ! Perform test based on presence of channel index
1782  IF ( PRESENT(channelindex) ) THEN
1783  IF ( channelindex < 1 .OR. channelindex > spccoeff%n_Channels ) RETURN
1784  spccoeff%Channel_Flag(channelindex) = ibclr(spccoeff%Channel_Flag(channelindex),flag_type)
1785  ELSE
1786  spccoeff%Channel_Flag = ibclr(spccoeff%Channel_Flag,flag_type)
1787  END IF
1788 
1789  END SUBROUTINE spccoeff_clearflag
1790 
1791 END MODULE spccoeff_define
integer, parameter, public lc_polarization
integer, parameter, public second_stokes_component
integer, parameter, public invalid_polarization
subroutine, public spccoeff_inspect(SpcCoeff)
elemental subroutine, public spccoeff_setmicrowavesensor(SpcCoeff)
integer, parameter, public failure
integer, parameter, public invalid_wmo_sensor_id
elemental subroutine, public nltecoeff_create(NLTECoeff, n_Predictors, n_Sensor_Angles, n_Solar_Angles, n_NLTE_Channels, n_Channels)
elemental subroutine spccoeff_clearflag(SpcCoeff, Flag_Type, ChannelIndex)
real(fp), parameter, public zero
elemental subroutine, public spccoeff_clearallflags(SpcCoeff, ChannelIndex)
elemental subroutine, public spccoeff_setinfraredsensor(SpcCoeff)
subroutine, public accoeff_inspect(ACCoeff)
elemental logical function spccoeff_equal(x, y)
elemental logical function, public spccoeff_iszeeman(SpcCoeff, ChannelIndex)
integer, parameter, public long
Definition: Type_Kinds.f90:76
subroutine, public accoeff_subset(ACCoeff, Sensor_Channel, AC_Subset)
integer, parameter, public hl_polarization
character(*), dimension(0:n_polarization_types), parameter, public polarization_type_name
elemental subroutine, public spccoeff_destroy(SpcCoeff)
elemental subroutine spccoeff_clearsensor(SpcCoeff)
character(*), dimension(0:n_sensor_types), parameter, public sensor_type_name
subroutine, public spccoeff_concat(SpcCoeff, SC_Array, Sensor_Id)
integer, parameter, public third_stokes_component
integer, parameter, public plus45l_polarization
integer, parameter, public double
Definition: Type_Kinds.f90:106
integer, parameter, public hl_mixed_polarization
elemental subroutine, public spccoeff_clearsolar(SpcCoeff, ChannelIndex)
integer, parameter ml
logical function, public nltecoeff_validrelease(NLTECoeff)
integer, parameter solar_flag
elemental logical function, public spccoeff_ismicrowavesensor(SpcCoeff)
integer, parameter, public invalid_wmo_satellite_id
integer, parameter, public visible_sensor
integer, parameter sl
subroutine, public accoeff_info(ACCoeff, Info)
elemental subroutine, public accoeff_destroy(ACCoeff)
elemental logical function, public spccoeff_isinfraredsensor(SpcCoeff)
elemental subroutine, public spccoeff_setzeeman(SpcCoeff, ChannelIndex)
subroutine, public spccoeff_info(SpcCoeff, Info, NoComponents)
elemental logical function, public subset_associated(Subset)
elemental logical function, public spccoeff_isvisiblesensor(SpcCoeff)
elemental subroutine, public spccoeff_create(SpcCoeff, n_Channels)
elemental subroutine, public spccoeff_setvisiblesensor(SpcCoeff)
integer, parameter zeeman_flag
integer, parameter, public vl_mixed_polarization
integer, parameter, public first_stokes_component
integer, parameter, public vl_polarization
subroutine, public nltecoeff_subset(NLTECoeff, Sensor_Channel, NC_Subset)
subroutine, public spccoeff_defineversion(Id)
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
elemental subroutine, public spccoeff_setsolar(SpcCoeff, ChannelIndex)
elemental logical function, public spccoeff_issolar(SpcCoeff, ChannelIndex)
subroutine, public accoeff_defineversion(Id)
subroutine, public nltecoeff_channelreindex(NLTECoeff, Sensor_Channel)
subroutine, public accoeff_concat(ACCoeff, AC_Array, Sensor_Id)
integer, parameter, public intensity
logical function, public accoeff_validrelease(ACCoeff)
integer, parameter, public fourth_stokes_component
subroutine, public nltecoeff_inspect(NLTECoeff)
subroutine, public subset_getvalue(Subset, n_Values, Number, Index)
integer, parameter, public invalid_sensor
subroutine, public nltecoeff_info(NLTECoeff, Info)
elemental logical function spccoeff_issensor(SpcCoeff, Sensor_Type)
subroutine, public nltecoeff_defineversion(Id)
integer, parameter, public microwave_sensor
subroutine, public spccoeff_subset(SpcCoeff, Sensor_Channel, SC_Subset)
integer, parameter, public ultraviolet_sensor
integer, parameter, public n_sensor_types
integer, parameter, public unpolarized
character(*), parameter module_version_id
elemental subroutine, public nltecoeff_destroy(NLTECoeff)
elemental logical function, public spccoeff_isultravioletsensor(SpcCoeff)
elemental subroutine, public accoeff_create(ACCoeff, n_FOVs, n_Channels)
integer, parameter, public minus45l_polarization
#define min(a, b)
Definition: mosaic_util.h:32
integer, parameter, public n_polarization_types
elemental subroutine spccoeff_setflag(SpcCoeff, Flag_Type, ChannelIndex)
subroutine, public subset_generate(Subset, List, Subset_List)
integer, parameter, public rc_polarization
logical function, public spccoeff_validrelease(SpcCoeff)
elemental logical function spccoeff_isflagset(SpcCoeff, Flag_Type, ChannelIndex)
elemental subroutine spccoeff_setsensor(SpcCoeff, Sensor_Type)
integer, parameter, public success
elemental subroutine, public spccoeff_clearzeeman(SpcCoeff, ChannelIndex)
integer, parameter, public infrared_sensor
integer, parameter spccoeff_version
subroutine, public nltecoeff_concat(NLTECoeff, NC_Array, Sensor_Id)
subroutine, public accoeff_channelreindex(ACCoeff, Sensor_Channel)
elemental logical function, public accoeff_associated(ACCoeff)
integer, parameter spccoeff_release
elemental logical function, public spccoeff_associated(SpcCoeff)
integer, parameter, public information
elemental logical function, public nltecoeff_associated(NLTECoeff)
elemental subroutine, public spccoeff_setultravioletsensor(SpcCoeff)