72 '$Id: ODAS_Define.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 77 INTEGER,
PARAMETER ::
set = 1
79 INTEGER,
PARAMETER ::
sl = 20
80 INTEGER,
PARAMETER ::
ml = 256
99 CHARACTER(*),
PARAMETER,
DIMENSION( 0:N_SENSOR_TYPES ) :: &
110 INTEGER :: n_allocates = 0
117 INTEGER(Long) :: n_predictors = 0
118 INTEGER(Long) :: n_absorbers = 0
119 INTEGER(Long) :: n_channels = 0
120 INTEGER(Long) :: n_alphas = 0
121 INTEGER(Long) :: n_coeffs = 0
123 CHARACTER(SL) :: sensor_id =
' ' 128 INTEGER(Long),
POINTER :: sensor_channel(:) => null()
130 INTEGER(Long),
POINTER :: absorber_id(:) => null()
132 INTEGER(Long),
POINTER :: max_order(:) => null()
138 REAL(Double),
POINTER :: alpha(:,:) => null()
158 INTEGER(LONG),
POINTER :: order(:,:) => null()
159 INTEGER(Long),
POINTER :: pre_index(:,:,:) => null()
160 INTEGER(Long),
POINTER :: pos_index(:,:) => null()
161 REAL(Double),
POINTER :: c(:) => null()
226 result( association_status )
229 INTEGER,
OPTIONAL,
INTENT(IN) :: any_test
231 LOGICAL :: association_status
241 IF (
PRESENT( any_test ) )
THEN 242 IF ( any_test ==
set ) all_test = .false.
247 association_status = .false.
249 IF (
ASSOCIATED( odas%Sensor_Channel ) .AND. &
250 ASSOCIATED( odas%Absorber_ID ) .AND. &
251 ASSOCIATED( odas%Max_Order ) .AND. &
252 ASSOCIATED( odas%Alpha ) .AND. &
253 ASSOCIATED( odas%Order ) .AND. &
254 ASSOCIATED( odas%Pre_Index ) .AND. &
255 ASSOCIATED( odas%Pos_Index ) .AND. &
256 ASSOCIATED( odas%C ) )
THEN 257 association_status = .true.
260 IF (
ASSOCIATED( odas%Sensor_Channel ) .OR. &
261 ASSOCIATED( odas%Absorber_ID ) .OR. &
262 ASSOCIATED( odas%Max_Order ) .OR. &
263 ASSOCIATED( odas%Alpha ) .OR. &
264 ASSOCIATED( odas%Order ) .OR. &
265 ASSOCIATED( odas%Pre_Index ) .OR. &
266 ASSOCIATED( odas%Pos_Index ) .OR. &
267 ASSOCIATED( odas%C ) )
THEN 268 association_status = .true.
336 No_Clear , & ! Optional input
337 RCS_Id , & ! Revision control
339 result( error_status )
342 INTEGER,
OPTIONAL,
INTENT(IN) :: no_clear
343 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: rcs_id
344 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: message_log
346 INTEGER :: error_status
348 CHARACTER(*),
PARAMETER :: routine_name =
'Destroy_ODAS' 350 CHARACTER(ML) :: message
352 INTEGER :: allocate_status
360 odas%n_Predictors = 0
369 IF (
PRESENT( no_clear ) )
THEN 370 IF ( no_clear ==
set ) clear = .false.
380 DEALLOCATE( odas%Sensor_Channel , &
388 stat=allocate_status )
389 IF ( allocate_status /= 0 )
THEN 391 WRITE( message,
'("Error deallocating ODAS components. STAT = ",i0)' ) &
396 message_log=message_log )
402 odas%n_Allocates = odas%n_Allocates - 1
403 IF ( odas%n_Allocates /= 0 )
THEN 405 WRITE( message,
'("Allocation counter /= 0, Value = ",i0)' ) &
410 message_log=message_log )
520 n_Absorbers , & ! Input
521 n_Channels , & ! Input
525 RCS_Id , & ! Revision control
527 result( error_status )
529 INTEGER ,
INTENT(IN) :: n_predictors
530 INTEGER ,
INTENT(IN) :: n_absorbers
531 INTEGER ,
INTENT(IN) :: n_channels
532 INTEGER ,
INTENT(IN) :: n_alphas
533 INTEGER ,
INTENT(IN) :: n_coeffs
535 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: rcs_id
536 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: message_log
538 INTEGER :: error_status
540 CHARACTER(*),
PARAMETER :: routine_name =
'Allocate_ODAS' 542 CHARACTER(ML) :: message
543 INTEGER :: allocate_status
551 IF ( n_predictors < 1 .OR. &
552 n_absorbers < 1 .OR. &
553 n_channels < 1 .OR. &
558 'Input ODAS dimensions must all be > 0.', &
560 message_log=message_log )
569 message_log=message_log )
570 IF ( error_status /=
success )
THEN 572 'Error deallocating ODAS prior to reallocation.', &
574 message_log=message_log )
581 ALLOCATE( odas%Sensor_Channel( n_channels ), &
582 odas%Absorber_ID( n_absorbers ), &
583 odas%Max_Order( n_absorbers ), &
584 odas%Alpha( n_alphas, n_absorbers ), &
585 odas%Order( n_absorbers, n_channels ), &
586 odas%Pre_Index( 0:n_predictors, n_absorbers, n_channels ), &
587 odas%Pos_Index( n_absorbers, n_channels ), &
588 odas%C( n_coeffs ), &
589 stat=allocate_status )
590 IF ( allocate_status /= 0 )
THEN 592 WRITE( message,
'("Error allocating ODAS data arrays. STAT = ",i0)' ) &
597 message_log=message_log )
602 odas%n_Predictors = n_predictors
603 odas%n_Absorbers = n_absorbers
604 odas%n_Channels = n_channels
605 odas%n_Alphas = n_alphas
606 odas%n_Coeffs = n_coeffs
608 odas%Sensor_Channel = 0
620 odas%n_Allocates = odas%n_Allocates + 1
621 IF ( odas%n_Allocates /= 1 )
THEN 623 WRITE( message,
'("Allocation counter /= 1, Value = ",i0)' ) &
628 message_log=message_log )
697 ODAS_out , & ! Output
698 RCS_Id , & ! Revision control
700 result( error_status )
703 TYPE(
odas_type) ,
INTENT(IN OUT) :: odas_out
704 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: rcs_id
705 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: message_log
707 INTEGER :: error_status
709 CHARACTER(*),
PARAMETER :: routine_name =
'Assign_ODAS' 719 'Some or all INPUT ODAS pointer '//&
720 'members are NOT associated.', &
722 message_log=message_log )
730 odas_in%n_Absorbers , &
731 odas_in%n_Channels , &
735 message_log=message_log )
736 IF ( error_status /=
success )
THEN 738 'Error allocating output ODAS arrays.', &
740 message_log=message_log )
747 odas_out%Release = odas_in%Release
748 odas_out%Version = odas_in%Version
750 odas_out%Sensor_Id = odas_in%Sensor_Id
751 odas_out%Sensor_Type = odas_in%Sensor_Type
752 odas_out%WMO_Satellite_ID = odas_in%WMO_Satellite_ID
753 odas_out%WMO_Sensor_ID = odas_in%WMO_Sensor_ID
754 odas_out%Sensor_Channel = odas_in%Sensor_Channel
755 odas_out%Absorber_ID = odas_in%Absorber_ID
756 odas_out%Max_Order = odas_in%Max_Order
757 odas_out%Alpha = odas_in%Alpha
758 odas_out%Order = odas_in%Order
759 odas_out%Pre_Index = odas_in%Pre_Index
760 odas_out%Pos_Index = odas_in%Pos_Index
761 odas_out%C = odas_in%C
867 ULP_Scale , & ! Optional input
868 Check_All , & ! Optional input
869 RCS_Id , & ! Revision control
871 result( error_status )
875 INTEGER,
OPTIONAL,
INTENT(IN) :: ulp_scale
876 INTEGER,
OPTIONAL,
INTENT(IN) :: check_all
877 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: rcs_id
878 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: message_log
880 INTEGER :: error_status
882 CHARACTER(*),
PARAMETER :: routine_name =
'Equal_ODAS' 884 CHARACTER(ML) :: message
886 LOGICAL :: check_once
887 INTEGER(LONG) :: i, j, l, ip
897 IF (
PRESENT( ulp_scale ) )
THEN 898 IF ( ulp_scale > 0 ) ulp = ulp_scale
904 IF (
PRESENT( check_all ) )
THEN 905 IF ( check_all == 1 ) check_once = .false.
912 'Some or all INPUT ODAS_LHS pointer '//&
913 'members are NOT associated.', &
915 message_log=message_log )
921 'Some or all INPUT ODAS_RHS pointer '//&
922 'members are NOT associated.', &
924 message_log=message_log )
931 IF ( ( odas_lhs%Release /= odas_rhs%Release ) .OR. &
932 ( odas_lhs%Version /= odas_rhs%Version ) )
THEN 934 WRITE( message,
'( "Release/Version numbers are different : ", & 935 &i2, ".", i2.2, " vs. ", i2, ".", i2.2 )' ) &
936 odas_lhs%Release, odas_lhs%Version, &
937 odas_rhs%Release, odas_rhs%Version
941 message_log=message_log )
942 IF ( check_once )
RETURN 948 IF ( odas_lhs%n_Predictors /= odas_rhs%n_Predictors .OR. &
949 odas_lhs%n_Absorbers /= odas_rhs%n_Absorbers .OR. &
950 odas_lhs%n_Channels /= odas_rhs%n_Channels .OR. &
951 odas_lhs%n_Alphas /= odas_rhs%n_Alphas .OR. &
952 odas_lhs%n_Coeffs /= odas_rhs%n_Coeffs )
THEN 955 'Structure dimensions are different', &
957 message_log=message_log )
964 IF ( odas_lhs%Sensor_Id /= odas_rhs%Sensor_Id )
THEN 966 WRITE( message,
'( "Sensor_ID values are different, ", & 967 &a, " vs. ", a )' ) &
968 trim( odas_lhs%Sensor_Id), &
969 trim( odas_rhs%Sensor_Id)
973 message_log=message_log )
974 IF ( check_once )
RETURN 978 IF ( odas_lhs%Sensor_Type /= odas_rhs%Sensor_Type )
THEN 979 WRITE( message,
'("Sensor types are different, ", & 980 &i0,"(",a,") vs. ", i0,"(",a,")")' ) &
981 odas_lhs%Sensor_Type, &
983 odas_rhs%Sensor_Type, &
988 message_log=message_log )
989 IF ( check_once )
RETURN 993 IF ( odas_lhs%WMO_Satellite_ID /= odas_rhs%WMO_Satellite_ID )
THEN 995 WRITE( message,
'("WMO_Satellite_ID values are different, ",i0,& 997 odas_lhs%WMO_Satellite_ID, &
998 odas_rhs%WMO_Satellite_ID
1002 message_log=message_log )
1003 IF ( check_once )
RETURN 1007 IF ( odas_lhs%WMO_Sensor_ID /= odas_rhs%WMO_Sensor_ID )
THEN 1009 WRITE( message,
'("WMO_Sensor_ID values are different, ",i0,& 1011 odas_lhs%WMO_Sensor_ID, &
1012 odas_rhs%WMO_Sensor_ID
1016 message_log=message_log )
1017 IF ( check_once )
RETURN 1021 DO l = 1, odas_rhs%n_Channels
1022 IF ( odas_lhs%Sensor_Channel(l) /= odas_rhs%Sensor_Channel(l) )
THEN 1024 WRITE( message,
'("Sensor_Channel values are different, ",i0,& 1025 &" vs. ",i0,", for channel index # ",i0)' ) &
1026 odas_lhs%Sensor_Channel(l), &
1027 odas_rhs%Sensor_Channel(l), &
1032 message_log=message_log )
1033 IF ( check_once )
RETURN 1038 DO j = 1, odas_rhs%n_Absorbers
1039 IF ( odas_lhs%Absorber_ID(j) /= odas_rhs%Absorber_ID(j) )
THEN 1041 WRITE( message,
'("Absorber_ID values are different, ",i0,& 1042 &" vs. ",i0,", for absorber index # ",i0)' ) &
1043 odas_lhs%Absorber_ID(j), &
1044 odas_rhs%Absorber_ID(j), &
1049 message_log=message_log )
1050 IF ( check_once )
RETURN 1055 DO j = 1, odas_rhs%n_Absorbers
1056 IF ( odas_lhs%Max_Order(j) /= odas_rhs%Max_Order(j) )
THEN 1058 WRITE( message,
'("Order values are different, ",i0,& 1059 &" vs. ",i0,", for index (",i0,")")' ) &
1060 odas_lhs%Max_Order(j), &
1061 odas_rhs%Max_Order(j), &
1066 message_log=message_log )
1067 IF ( check_once )
RETURN 1072 DO j = 1, odas_rhs%n_Absorbers
1073 DO i = 1, odas_rhs%n_Alphas
1075 odas_rhs%Alpha(i,j), &
1076 ulp = ulp ) ) )
THEN 1078 WRITE( message,
'("Alpha values are different, ",es13.6,& 1079 &" vs. ",es13.6,", for alpha index # ",i0,& 1080 &" and absorber index #",i0 )' ) &
1081 odas_lhs%Alpha(i,j), &
1082 odas_rhs%Alpha(i,j), &
1087 message_log=message_log )
1088 IF ( check_once )
RETURN 1094 DO l = 1, odas_rhs%n_Channels
1095 DO j = 1, odas_rhs%n_Absorbers
1096 IF ( odas_lhs%Order(j,l) /= odas_rhs%Order(j,l) )
THEN 1098 WRITE( message,
'("Order values are different, ",i0,& 1099 &" vs. ",i0,", for index (",i0,1x,i0,")")' ) &
1100 odas_lhs%Order(j,l), &
1101 odas_rhs%Order(j,l), &
1106 message_log=message_log )
1107 IF ( check_once )
RETURN 1113 DO l = 1, odas_rhs%n_Channels
1114 DO j = 1, odas_rhs%n_Absorbers
1115 DO ip = 0, odas_rhs%n_Predictors
1116 IF ( odas_lhs%Pre_Index(ip,j,l) /= odas_rhs%Pre_Index(ip,j,l) )
THEN 1118 WRITE( message,
'("Predictor_Index values are different, ",i0,& 1119 &" vs. ",i0,", for index (",i0,1x,i0,1x,i0,")")' ) &
1120 odas_lhs%Pre_Index(ip,j,l), &
1121 odas_rhs%Pre_Index(ip,j,l), &
1126 message_log=message_log )
1127 IF ( check_once )
RETURN 1134 DO l = 1, odas_rhs%n_Channels
1135 DO j = 1, odas_rhs%n_Absorbers
1136 IF ( odas_lhs%Pos_Index(j,l) /= odas_rhs%Pos_Index(j,l) )
THEN 1138 WRITE( message,
'("Predictor_Index values are different, ",i0,& 1139 &" vs. ",i0,", for index (",i0,1x,i0,")")' ) &
1140 odas_lhs%Pos_Index(j,l), &
1141 odas_rhs%Pos_Index(j,l), &
1146 message_log=message_log )
1147 IF ( check_once )
RETURN 1153 DO i = 1, odas_rhs%n_Coeffs
1154 IF ( odas_lhs%C(i) /= odas_rhs%C(i) )
THEN 1156 WRITE( message,
'("C values are different, ",i0,& 1157 &" vs. ",i0,", for index (",i0,")")' ) &
1164 message_log=message_log )
1165 IF ( check_once )
RETURN 1223 RCS_Id , & ! Revision control
1225 result( error_status )
1228 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: rcs_id
1229 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: message_log
1231 INTEGER :: error_status
1233 CHARACTER(*),
PARAMETER :: routine_name =
'CheckRelease_ODAS' 1235 CHARACTER(ML) :: message
1248 WRITE( message,
'( "An ODAS data update is needed. ", & 1249 &"ODAS release is ", i2, & 1250 &". Valid release is ",i2,"." )' ) &
1255 message_log=message_log )
1262 WRITE( message,
'( "An ODAS software update is needed. ", & 1263 &"ODAS release is ", i2, & 1264 &". Valid release is ",i2,"." )' ) &
1269 message_log=message_log )
1326 RCS_Id , & ! Revision control
1328 result( error_status )
1331 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: rcs_id
1332 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: message_log
1334 INTEGER :: error_status
1336 CHARACTER(*),
PARAMETER :: routine_name =
'CheckAlgorithm_ODAS' 1349 'The ODAS Algorithm ID check failed. '//&
1350 'The data structure is not an ODAS structure', &
1352 message_log=message_log )
1403 CHARACTER(*),
INTENT(OUT) :: info
1404 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: rcs_id
1406 CHARACTER(2000) :: longstring
1414 WRITE( longstring,
'( a,3x,"ODAS RELEASE.VERSION: ",i2,".",i2.2,2x,& 1415 &"N_PREDICTORS=",i2,2x,& 1416 &"N_ABSORBERS=",i2,2x,& 1417 &"N_CHANNELS=",i0,2x, & 1418 &"N_Alphas=",i2,2x, & 1419 &"N_Coeffs=",i0)' ) &
1421 odas%Release, odas%Version, &
1422 odas%n_Predictors, &
1431 info = longstring(1:
min( len(info), len_trim(longstring) ))
1471 TYPE(ODAS_type),
INTENT(IN OUT) :: ODAS
1475 odas%Sensor_Id =
' '
integer function, public assign_odas(ODAS_in, ODAS_out, RCS_Id, Message_Log)
integer, parameter linefeed
integer, parameter, public failure
integer, parameter, public warning
integer, parameter, public long
integer, parameter, public n_sensor_types
integer, parameter, public invalid_wmo_satellite_id
integer, parameter, public visible_sensor
real(double), parameter fp_invalid
integer, parameter, public odas_release
character(*), dimension(0:n_sensor_types), parameter, public sensor_type_name
integer, parameter, public double
integer function, public equal_odas(ODAS_LHS, ODAS_RHS, ULP_Scale, Check_All, RCS_Id, Message_Log)
character(*), parameter odas_algorithm_name
integer, parameter, public infrared_sensor
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
integer function, public destroy_odas(ODAS, No_Clear, RCS_Id, Message_Log)
integer, parameter ultraviolet_sensor
subroutine clear_odas(ODAS)
integer, parameter ip_invalid
logical function, public associated_odas(ODAS, ANY_Test)
integer, parameter, public odas_algorithm
integer, parameter odas_version
subroutine, public info_odas(ODAS, Info, RCS_Id)
integer function, public allocate_odas(n_Predictors, n_Absorbers, n_Channels, n_Alphas, n_Coeffs, ODAS, RCS_Id, Message_Log)
integer function, public checkalgorithm_odas(ODAS, RCS_Id, Message_Log)
integer, parameter, public microwave_sensor
integer, parameter, public invalid_sensor
integer function, public checkrelease_odas(ODAS, RCS_Id, Message_Log)
integer, parameter, public success
integer, parameter carriage_return
character(*), parameter module_rcs_id
integer, parameter, public invalid_wmo_sensor_id