19 USE iso_fortran_env ,
ONLY: output_unit
40 PUBLIC ::
OPERATOR(==)
55 INTERFACE OPERATOR(==)
57 END INTERFACE OPERATOR(==)
65 '$Id: CRTM_ChannelInfo_Define.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 67 INTEGER,
PARAMETER ::
ml = 256
76 LOGICAL :: is_allocated = .false.
78 INTEGER :: n_channels = 0
80 CHARACTER(STRLEN) :: sensor_id =
'' 84 INTEGER :: sensor_index = 0
86 LOGICAL,
ALLOCATABLE :: process_channel(:)
87 INTEGER,
ALLOCATABLE :: sensor_channel(:)
88 INTEGER,
ALLOCATABLE :: channel_index(:)
140 status = channelinfo%Is_Allocated
168 channelinfo%Is_Allocated = .false.
169 channelinfo%n_Channels = 0
208 INTEGER,
INTENT(IN) :: n_channels
210 INTEGER :: alloc_stat
213 IF ( n_channels < 1 )
RETURN 217 ALLOCATE( channelinfo%Process_Channel( n_channels ), &
218 channelinfo%Sensor_Channel( n_channels ), &
219 channelinfo%Channel_Index( n_channels ), &
221 IF ( alloc_stat /= 0 )
RETURN 226 channelinfo%n_Channels = n_channels
228 channelinfo%Process_Channel = .true.
229 channelinfo%Sensor_Channel = 0
230 channelinfo%Channel_Index = 0
234 channelinfo%Is_Allocated = .true.
275 INTEGER,
OPTIONAL,
INTENT(IN) :: unit
279 CHARACTER(3) :: process
283 IF (
PRESENT(unit) )
THEN 288 WRITE(fid,
'(1x,"ChannelInfo OBJECT")')
289 WRITE(fid,
'(3x,"n_Channels :",1x,i0)') chinfo%n_Channels
290 WRITE(fid,
'(3x,"Sensor Id :",1x,a )') trim(chinfo%Sensor_ID)
291 WRITE(fid,
'(3x,"Sensor_Type :",1x,i0)') chinfo%Sensor_Type
292 WRITE(fid,
'(3x,"WMO_Satellite_ID :",1x,i0)') chinfo%WMO_Satellite_ID
293 WRITE(fid,
'(3x,"WMO_Sensor_ID :",1x,i0)') chinfo%WMO_Sensor_ID
294 WRITE(fid,
'(3x,"Sensor_Index :",1x,i0)') chinfo%Sensor_Index
296 WRITE(fid,
'(3x,"Channel# Index Process?")')
297 DO i = 1, chinfo%n_Channels
298 IF ( chinfo%Process_Channel(i) )
THEN 303 WRITE(fid,
'(4x,i5,7x,i5,8x,a)') &
304 chinfo%Sensor_Channel(i), chinfo%Channel_Index(i), process
342 INTEGER :: n_channels
343 n_channels = count(channelinfo%Process_Channel)
380 channels = pack(channelinfo%Sensor_Channel, mask=channelinfo%Process_Channel)
449 ChannelInfo , & ! In/output
450 Channel_Subset, & ! Optional input
455 INTEGER,
OPTIONAL,
INTENT(IN) :: channel_subset(:)
456 LOGICAL,
OPTIONAL,
INTENT(IN) :: reset
460 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_ChannelInfo_Subset' 463 INTEGER :: alloc_stat
465 INTEGER :: channel_idx(channelinfo%n_channels)
466 INTEGER,
ALLOCATABLE :: subset_idx(:)
472 IF (
PRESENT(reset) )
THEN 474 channelinfo%Process_Channel = .true.
480 IF (
PRESENT(channel_subset) )
THEN 481 n =
SIZE(channel_subset)
483 channelinfo%Process_Channel = .false.
487 IF ( n > channelinfo%n_Channels )
THEN 489 msg =
'Specified Channel_Subset contains too many channels!' 493 IF ( any(channel_subset < minval(channelinfo%Sensor_Channel)) .OR. &
494 any(channel_subset > maxval(channelinfo%Sensor_Channel)) )
THEN 496 msg =
'Specified Channel_Subset contains invalid channels!' 500 ALLOCATE( subset_idx(n),stat=alloc_stat )
501 IF ( alloc_stat /= 0 )
THEN 503 msg =
'Error allocating subset_idx array' 507 CALL insertionsort( channelinfo%Sensor_Channel, channel_idx )
510 channel_loop:
DO i = 1, channelinfo%n_Channels
511 IF ( channel_subset(subset_idx(j)) == channelinfo%Sensor_Channel(channel_idx(i)) )
THEN 512 channelinfo%Process_Channel(channel_idx(i)) = .true.
514 IF ( j > n )
EXIT channel_loop
518 DEALLOCATE( subset_idx )
548 CHARACTER(*),
INTENT(OUT) :: id
607 IF ( x%n_Channels /= y%n_Channels )
RETURN 609 IF ( (x%Sensor_ID == y%Sensor_ID ) .AND. &
610 (x%Sensor_Type == y%Sensor_Type ) .AND. &
611 (x%WMO_Satellite_ID == y%WMO_Satellite_ID) .AND. &
612 (x%WMO_Sensor_ID == y%WMO_Sensor_ID ) .AND. &
613 (x%Sensor_Index == y%Sensor_Index ) .AND. &
614 all(x%Process_Channel .EQV. y%Process_Channel) .AND. &
615 all(x%Sensor_Channel == y%Sensor_Channel ) .AND. &
616 all(x%Channel_Index == y%Channel_Index ) ) &
integer, parameter, public failure
integer function, public crtm_channelinfo_subset(ChannelInfo, Channel_Subset, Reset)
integer, parameter, public strlen
character(*), parameter module_version_id
elemental subroutine, public crtm_channelinfo_destroy(ChannelInfo)
subroutine, public crtm_channelinfo_inspect(chInfo, Unit)
subroutine, public crtm_channelinfo_defineversion(Id)
elemental logical function crtm_channelinfo_equal(x, y)
elemental logical function, public crtm_channelinfo_associated(ChannelInfo)
elemental subroutine, public crtm_channelinfo_create(ChannelInfo, n_Channels)
pure integer function, dimension(crtm_channelinfo_n_channels(channelinfo)), public crtm_channelinfo_channels(ChannelInfo)
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
integer, parameter, public invalid_wmo_satellite_id
integer, parameter, public invalid_sensor
integer, parameter, public invalid_wmo_sensor_id
elemental integer function, public crtm_channelinfo_n_channels(ChannelInfo)
integer, parameter, public success