20 USE iso_fortran_env ,
ONLY: output_unit
25 OPERATOR(.equalto.), &
47 PUBLIC ::
OPERATOR(==)
67 INTERFACE OPERATOR(==)
69 END INTERFACE OPERATOR(==)
73 END INTERFACE OPERATOR(+)
77 END INTERFACE OPERATOR(-)
79 INTERFACE OPERATOR(**)
81 END INTERFACE OPERATOR(**)
85 END INTERFACE OPERATOR(/)
101 '$Id: CRTM_RTSolution_Define.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 103 REAL(fp),
PARAMETER ::
zero = 0.0_fp
105 INTEGER,
PARAMETER ::
ml = 256
116 LOGICAL :: is_allocated = .false.
118 INTEGER :: n_layers = 0
120 CHARACTER(STRLEN) :: sensor_id =
'' 123 INTEGER :: sensor_channel = 0
125 CHARACTER(STRLEN*5) :: rt_algorithm_name =
'' 127 LOGICAL :: scattering_flag = .true.
128 INTEGER :: n_full_streams = 0
129 INTEGER :: n_stokes = 0
134 REAL(fp) :: surface_emissivity =
zero 135 REAL(fp) :: surface_reflectivity =
zero 137 REAL(fp) :: down_radiance =
zero 138 REAL(fp) :: down_solar_radiance =
zero 139 REAL(fp) :: surface_planck_radiance =
zero 140 REAL(fp),
ALLOCATABLE :: upwelling_overcast_radiance(:)
141 REAL(fp),
ALLOCATABLE :: upwelling_radiance(:)
142 REAL(fp),
ALLOCATABLE :: layer_optical_depth(:)
145 REAL(fp) :: brightness_temperature =
zero 197 status = rtsolution%Is_Allocated
225 rtsolution%Is_Allocated = .false.
226 rtsolution%n_Layers = 0
263 INTEGER,
INTENT(IN) :: n_layers
265 INTEGER :: alloc_stat
268 IF ( n_layers < 1 )
RETURN 271 ALLOCATE( rtsolution%Upwelling_Radiance(n_layers), &
272 rtsolution%Upwelling_Overcast_Radiance(n_layers), &
273 rtsolution%Layer_Optical_Depth(n_layers), &
275 IF ( alloc_stat /= 0 )
RETURN 279 rtsolution%n_Layers = n_layers
281 rtsolution%Upwelling_Radiance =
zero 282 rtsolution%Upwelling_Overcast_Radiance =
zero 283 rtsolution%Layer_Optical_Depth =
zero 286 rtsolution%Is_Allocated = .true.
324 rtsolution%SOD =
zero 325 rtsolution%Surface_Emissivity =
zero 326 rtsolution%Surface_Reflectivity =
zero 327 rtsolution%Up_Radiance =
zero 328 rtsolution%Down_Radiance =
zero 329 rtsolution%Down_Solar_Radiance =
zero 330 rtsolution%Surface_Planck_Radiance =
zero 331 rtsolution%Radiance =
zero 332 rtsolution%Brightness_Temperature =
zero 336 rtsolution%Upwelling_Radiance =
zero 337 rtsolution%Upwelling_Overcast_Radiance =
zero 338 rtsolution%Layer_Optical_Depth =
zero 378 TYPE(CRTM_RTSolution_type),
INTENT(IN) :: RTSolution
379 INTEGER,
OPTIONAL,
INTENT(IN) :: Unit
385 IF (
PRESENT(unit) )
THEN 390 WRITE(fid,
'(1x,"RTSolution OBJECT")')
392 WRITE(fid,
'(3x,"Sensor Id : ",a )') trim(rtsolution%Sensor_ID)
393 WRITE(fid,
'(3x,"WMO Satellite Id : ",i0)') rtsolution%WMO_Satellite_ID
394 WRITE(fid,
'(3x,"WMO Sensor Id : ",i0)') rtsolution%WMO_Sensor_ID
395 WRITE(fid,
'(3x,"Channel : ",i0)') rtsolution%Sensor_Channel
396 WRITE(fid,
'(3x,"RT Algorithm Name : ",a )') rtsolution%RT_Algorithm_Name
397 WRITE(fid,
'(3x,"Scattering Optical Depth : ",es13.6)') rtsolution%SOD
398 WRITE(fid,
'(3x,"Surface Emissivity : ",es13.6)') rtsolution%Surface_Emissivity
399 WRITE(fid,
'(3x,"Surface Reflectivity : ",es13.6)') rtsolution%Surface_Reflectivity
400 WRITE(fid,
'(3x,"Up Radiance : ",es13.6)') rtsolution%Up_Radiance
401 WRITE(fid,
'(3x,"Down Radiance : ",es13.6)') rtsolution%Down_Radiance
402 WRITE(fid,
'(3x,"Down Solar Radiance : ",es13.6)') rtsolution%Down_Solar_Radiance
403 WRITE(fid,
'(3x,"Surface Planck Radiance : ",es13.6)') rtsolution%Surface_Planck_Radiance
404 WRITE(fid,
'(3x,"Radiance : ",es13.6)') rtsolution%Radiance
405 WRITE(fid,
'(3x,"Brightness Temperature : ",es13.6)') rtsolution%Brightness_Temperature
407 WRITE(fid,
'(3x,"n_Layers : ",i0)') rtsolution%n_Layers
408 WRITE(fid,
'(3x,"Upwelling Radiance :")')
409 WRITE(fid,
'(5(1x,es13.6,:))') rtsolution%Upwelling_Radiance
410 WRITE(fid,
'(3x,"Layer Optical Depth :")')
411 WRITE(fid,
'(5(1x,es13.6,:))') rtsolution%Layer_Optical_Depth
416 TYPE(CRTM_RTSolution_type),
INTENT(IN) :: RTSolution(:,:)
417 INTEGER,
OPTIONAL,
INTENT(IN) :: Unit
419 INTEGER :: i, n_channels
420 INTEGER :: j, n_profiles
423 IF (
PRESENT(unit) )
THEN 427 n_channels =
SIZE(rtsolution,1)
428 n_profiles =
SIZE(rtsolution,2)
431 WRITE(fid, fmt=
'(1x,"PROFILE INDEX:",i0,", CHANNEL INDEX:",i0," - ")', advance=
'NO') j,i
463 CHARACTER(*),
INTENT(OUT) :: id
508 result( is_comparable )
510 INTEGER,
OPTIONAL,
INTENT(IN) :: n_sigfig
511 LOGICAL :: is_comparable
516 is_comparable = .false.
517 IF (
PRESENT(n_sigfig) )
THEN 527 IF ( (x%Sensor_ID /= y%Sensor_ID ) .OR. &
528 (x%WMO_Satellite_ID /= y%WMO_Satellite_ID) .OR. &
529 (x%WMO_Sensor_ID /= y%WMO_Sensor_ID ) .OR. &
530 (x%Sensor_Channel /= y%Sensor_Channel ) )
RETURN 533 IF ( x%RT_Algorithm_Name /= y%RT_Algorithm_Name )
RETURN 554 is_comparable = .true.
606 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_RTSolution_Statistics' 608 CHARACTER(ML) :: err_msg
609 CHARACTER(ML) :: alloc_msg
610 INTEGER :: alloc_stat
611 INTEGER :: n_channels, l
612 INTEGER :: n_profiles, m
617 n_channels =
SIZE(rts, dim=1)
618 n_profiles =
SIZE(rts, dim=2)
619 factor =
REAL(n_profiles,
fp)
623 ALLOCATE( rts_stats(n_channels, 2), &
624 stat = alloc_stat, errmsg = alloc_msg )
625 IF ( alloc_stat /= 0 )
THEN 626 err_msg =
'Error allocating output RTSolution structure - '//trim(alloc_msg)
630 rts_stats(:,1) = rts(:,1)
631 rts_stats(:,2) = rts(:,1)
638 rts_stats(l,1) = rts_stats(l,1) + rts(l,m)
641 rts_stats(:,1) = rts_stats(:,1)/factor
647 rts_stats(l,2) = rts_stats(l,2) + (rts(l,m) - rts_stats(l,1))**2
650 rts_stats(:,2) =
sqrt(rts_stats(:,2)/factor)
654 rts_stats(:,1)%RT_Algorithm_Name =
'Object average' 655 rts_stats(:,2)%RT_Algorithm_Name =
'Object standard deviation' 710 n_Channels , & ! Optional output
714 CHARACTER(*),
INTENT(IN) :: filename
715 INTEGER ,
OPTIONAL,
INTENT(OUT) :: n_channels
716 INTEGER ,
OPTIONAL,
INTENT(OUT) :: n_profiles
720 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_RTSolution_InquireFile' 723 CHARACTER(ML) :: io_msg
732 msg =
'File '//trim(filename)//
' not found.' 738 IF ( err_stat /=
success )
THEN 739 msg =
'Error opening '//trim(filename)
744 READ( fid,iostat=io_stat,iomsg=io_msg ) l, m
745 IF ( io_stat /= 0 )
THEN 746 msg =
'Error reading dimensions from '//trim(filename)//
' - '//trim(io_msg)
751 CLOSE( fid,iostat=io_stat,iomsg=io_msg )
752 IF ( io_stat /= 0 )
THEN 753 msg =
'Error closing '//trim(filename)//
' - '//trim(io_msg)
758 IF (
PRESENT(n_channels) ) n_channels = l
759 IF (
PRESENT(n_profiles) ) n_profiles = m
765 CLOSE( fid,iostat=io_stat,iomsg=io_msg )
767 msg = trim(msg)//
'; Error closing input file during error cleanup - '//trim(io_msg)
847 RTSolution , & ! Output
848 Quiet , & ! Optional input
849 n_Channels , & ! Optional output
850 n_Profiles , & ! Optional output
851 Old_Version, & ! Optional input (Allow reading of previous version files)
855 CHARACTER(*),
INTENT(IN) :: filename
857 LOGICAL,
OPTIONAL,
INTENT(IN) :: quiet
858 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_channels
859 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_profiles
860 LOGICAL,
OPTIONAL,
INTENT(IN) :: old_version
861 LOGICAL,
OPTIONAL,
INTENT(IN) :: debug
865 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_RTSolution_ReadFile' 868 CHARACTER(ML) :: io_msg
872 INTEGER :: l, n_file_channels, n_input_channels
873 INTEGER :: m, n_file_profiles, n_input_profiles
880 IF (
PRESENT(quiet) ) noisy = .NOT. quiet
882 IF (
PRESENT(debug) ) noisy = debug
887 IF ( err_stat /=
success )
THEN 888 msg =
'Error opening '//trim(filename)
894 READ( fid,iostat=io_stat,iomsg=io_msg ) n_file_channels, n_file_profiles
895 IF ( io_stat /= 0 )
THEN 896 msg =
'Error reading dimensions from '//trim(filename)//
' - '//trim(io_msg)
900 n_input_channels =
SIZE(rtsolution,dim=1)
901 IF ( n_file_channels > n_input_channels )
THEN 902 WRITE( msg,
'("Number of channels, ",i0," > size of the output RTSolution", & 903 &" array dimension, ",i0,". Only the first ",i0, & 904 &" channels will be read.")' ) &
905 n_file_channels, n_input_channels, n_input_channels
908 n_input_channels =
min(n_input_channels, n_file_channels)
910 n_input_profiles =
SIZE(rtsolution,dim=2)
911 IF ( n_file_profiles > n_input_profiles )
THEN 912 WRITE( msg,
'( "Number of profiles, ",i0," > size of the output RTSolution", & 913 &" array dimension, ",i0,". Only the first ",i0, & 914 &" profiles will be read.")' ) &
915 n_file_profiles, n_input_profiles, n_input_profiles
918 n_input_profiles =
min(n_input_profiles, n_file_profiles)
922 profile_loop:
DO m = 1, n_input_profiles
923 channel_loop:
DO l = 1, n_input_channels
924 err_stat =
read_record( fid, rtsolution(l,m), old_version=old_version )
925 IF ( err_stat /=
success )
THEN 926 WRITE( msg,
'("Error reading RTSolution element (",i0,",",i0,") from ",a)' ) &
935 CLOSE( fid,iostat=io_stat,iomsg=io_msg )
936 IF ( io_stat /= 0 )
THEN 937 msg =
'Error closing '//trim(filename)//
' - '//trim(io_msg)
943 IF (
PRESENT(n_channels) ) n_channels = n_input_channels
944 IF (
PRESENT(n_profiles) ) n_profiles = n_input_profiles
949 WRITE( msg,
'("Number of channels and profiles read from ",a,": ",i0,1x,i0)' ) &
950 trim(filename), n_input_channels, n_input_profiles
958 CLOSE( fid,iostat=io_stat,iomsg=io_msg )
959 IF ( io_stat /= 0 ) &
960 msg = trim(msg)//
'; Error closing input file during error cleanup - '//trim(io_msg)
1028 Filename , & ! Input
1029 RTSolution , & ! Input
1030 Quiet , & ! Optional input
1034 CHARACTER(*),
INTENT(IN) :: filename
1036 LOGICAL,
OPTIONAL,
INTENT(IN) :: quiet
1037 LOGICAL,
OPTIONAL,
INTENT(IN) :: debug
1041 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_RTSolution_WriteFile' 1043 CHARACTER(ML) :: msg
1044 CHARACTER(ML) :: io_msg
1048 INTEGER :: l, n_output_channels
1049 INTEGER :: m, n_output_profiles
1055 IF (
PRESENT(quiet) ) noisy = .NOT. quiet
1057 IF (
PRESENT(debug) ) noisy = debug
1058 n_output_channels =
SIZE(rtsolution,dim=1)
1059 n_output_profiles =
SIZE(rtsolution,dim=2)
1064 IF ( err_stat /=
success )
THEN 1065 msg =
'Error opening '//trim(filename)
1071 WRITE( fid,iostat=io_stat,iomsg=io_msg ) n_output_channels, n_output_profiles
1072 IF ( io_stat /= 0 )
THEN 1073 msg =
'Error writing dimensions to '//trim(filename)//
' - '//trim(io_msg)
1079 profile_loop:
DO m = 1, n_output_profiles
1080 channel_loop:
DO l = 1, n_output_channels
1082 IF ( err_stat /=
success )
THEN 1083 WRITE( msg,
'("Error writing RTSolution element (",i0,",",i0,") to ",a)' ) &
1084 l, m, trim(filename)
1092 CLOSE( fid,status=
'KEEP',iostat=io_stat,iomsg=io_msg )
1093 IF ( io_stat /= 0 )
THEN 1094 msg =
'Error closing '//trim(filename)//
' - '//trim(io_msg)
1101 WRITE( msg,
'("Number of channels and profiles written to ",a,": ",i0,1x,i0 )' ) &
1102 trim(filename), n_output_channels, n_output_profiles
1111 IF ( io_stat /= 0 ) &
1112 msg = trim(msg)//
'; Error deleting output file during error cleanup - '//trim(io_msg)
1174 IF ( (x%n_Layers == y%n_Layers) .AND. &
1175 (x%Sensor_ID == y%Sensor_ID ) .AND. &
1176 (x%WMO_Satellite_ID == y%WMO_Satellite_ID ) .AND. &
1177 (x%WMO_Sensor_ID == y%WMO_Sensor_ID ) .AND. &
1178 (x%Sensor_Channel == y%Sensor_Channel ) .AND. &
1179 (x%RT_Algorithm_Name == y%RT_Algorithm_Name) .AND. &
1180 (x%SOD .equalto. y%SOD ) .AND. &
1181 (x%Surface_Emissivity .equalto. y%Surface_Emissivity ) .AND. &
1182 (x%Surface_Reflectivity .equalto. y%Surface_Reflectivity ) .AND. &
1183 (x%Up_Radiance .equalto. y%Up_Radiance ) .AND. &
1184 (x%Down_Radiance .equalto. y%Down_Radiance ) .AND. &
1185 (x%Down_Solar_Radiance .equalto. y%Down_Solar_Radiance ) .AND. &
1186 (x%Surface_Planck_Radiance .equalto. y%Surface_Planck_Radiance) .AND. &
1187 (x%Radiance .equalto. y%Radiance ) .AND. &
1188 (x%Brightness_Temperature .equalto. y%Brightness_Temperature ) ) &
1193 is_equal = is_equal .AND. &
1194 all(x%Upwelling_Overcast_Radiance .equalto. y%Upwelling_Overcast_Radiance ) .AND. &
1195 all(x%Upwelling_Radiance .equalto. y%Upwelling_Radiance ) .AND. &
1196 all(x%Layer_Optical_Depth .equalto. y%Layer_Optical_Depth )
1243 IF ( (rts1%Sensor_ID /= rts2%Sensor_ID ) .AND. &
1244 (rts1%WMO_Satellite_ID /= rts2%WMO_Satellite_ID ) .AND. &
1245 (rts1%WMO_Sensor_ID /= rts2%WMO_Sensor_ID ) .AND. &
1246 (rts1%Sensor_Channel /= rts2%Sensor_Channel ) )
RETURN 1253 rtssum%RT_Algorithm_Name =
'Object add' 1255 rtssum%SOD = rtssum%SOD + rts2%SOD
1256 rtssum%Surface_Emissivity = rtssum%Surface_Emissivity + rts2%Surface_Emissivity
1257 rtssum%Surface_Reflectivity = rtssum%Surface_Reflectivity + rts2%Surface_Reflectivity
1258 rtssum%Up_Radiance = rtssum%Up_Radiance + rts2%Up_Radiance
1259 rtssum%Down_Radiance = rtssum%Down_Radiance + rts2%Down_Radiance
1260 rtssum%Down_Solar_Radiance = rtssum%Down_Solar_Radiance + rts2%Down_Solar_Radiance
1261 rtssum%Surface_Planck_Radiance = rtssum%Surface_Planck_Radiance + rts2%Surface_Planck_Radiance
1262 rtssum%Radiance = rtssum%Radiance + rts2%Radiance
1263 rtssum%Brightness_Temperature = rtssum%Brightness_Temperature + rts2%Brightness_Temperature
1267 rtssum%Upwelling_Overcast_Radiance(1:k) = rtssum%Upwelling_Overcast_Radiance(1:k) + &
1268 rts2%Upwelling_Overcast_Radiance(1:k)
1270 rtssum%Upwelling_Radiance(1:k) = rtssum%Upwelling_Radiance(1:k) + &
1271 rts2%Upwelling_Radiance(1:k)
1273 rtssum%Layer_Optical_Depth(1:k) = rtssum%Layer_Optical_Depth(1:k) + &
1274 rts2%Layer_Optical_Depth(1:k)
1321 IF ( (rts1%Sensor_ID /= rts2%Sensor_ID ) .AND. &
1322 (rts1%WMO_Satellite_ID /= rts2%WMO_Satellite_ID ) .AND. &
1323 (rts1%WMO_Sensor_ID /= rts2%WMO_Sensor_ID ) .AND. &
1324 (rts1%Sensor_Channel /= rts2%Sensor_Channel ) )
RETURN 1331 rtsdiff%RT_Algorithm_Name =
'Object subtract' 1333 rtsdiff%SOD = rtsdiff%SOD - rts2%SOD
1334 rtsdiff%Surface_Emissivity = rtsdiff%Surface_Emissivity - rts2%Surface_Emissivity
1335 rtsdiff%Surface_Reflectivity = rtsdiff%Surface_Reflectivity - rts2%Surface_Reflectivity
1336 rtsdiff%Up_Radiance = rtsdiff%Up_Radiance - rts2%Up_Radiance
1337 rtsdiff%Down_Radiance = rtsdiff%Down_Radiance - rts2%Down_Radiance
1338 rtsdiff%Down_Solar_Radiance = rtsdiff%Down_Solar_Radiance - rts2%Down_Solar_Radiance
1339 rtsdiff%Surface_Planck_Radiance = rtsdiff%Surface_Planck_Radiance - rts2%Surface_Planck_Radiance
1340 rtsdiff%Radiance = rtsdiff%Radiance - rts2%Radiance
1341 rtsdiff%Brightness_Temperature = rtsdiff%Brightness_Temperature - rts2%Brightness_Temperature
1345 rtsdiff%Upwelling_Overcast_Radiance(1:k) = rtsdiff%Upwelling_Overcast_Radiance(1:k) - &
1346 rts2%Upwelling_Overcast_Radiance(1:k)
1348 rtsdiff%Upwelling_Radiance(1:k) = rtsdiff%Upwelling_Radiance(1:k) - &
1349 rts2%Upwelling_Radiance(1:k)
1351 rtsdiff%Layer_Optical_Depth(1:k) = rtsdiff%Layer_Optical_Depth(1:k) - &
1352 rts2%Layer_Optical_Depth(1:k)
1397 INTEGER ,
INTENT(IN) :: power
1406 rts_power%RT_Algorithm_Name =
'Object exponent' 1408 rts_power%SOD = (rts_power%SOD)**power
1409 rts_power%Surface_Emissivity = (rts_power%Surface_Emissivity)**power
1410 rts_power%Surface_Reflectivity = (rts_power%Surface_Reflectivity)**power
1411 rts_power%Up_Radiance = (rts_power%Up_Radiance)**power
1412 rts_power%Down_Radiance = (rts_power%Down_Radiance)**power
1413 rts_power%Down_Solar_Radiance = (rts_power%Down_Solar_Radiance)**power
1414 rts_power%Surface_Planck_Radiance = (rts_power%Surface_Planck_Radiance)**power
1415 rts_power%Radiance = (rts_power%Radiance)**power
1416 rts_power%Brightness_Temperature = (rts_power%Brightness_Temperature)**power
1420 rts_power%Upwelling_Overcast_Radiance(1:k) = (rts_power%Upwelling_Overcast_Radiance(1:k))**power
1421 rts_power%Upwelling_Radiance(1:k) = (rts_power%Upwelling_Radiance(1:k))**power
1422 rts_power%Layer_Optical_Depth(1:k) = (rts_power%Layer_Optical_Depth(1:k))**power
1468 REAL(fp) ,
INTENT(IN) :: factor
1477 rts_normal%RT_Algorithm_Name =
'Object normalise' 1479 rts_normal%SOD = rts_normal%SOD/factor
1480 rts_normal%Surface_Emissivity = rts_normal%Surface_Emissivity/factor
1481 rts_normal%Surface_Reflectivity = rts_normal%Surface_Reflectivity/factor
1482 rts_normal%Up_Radiance = rts_normal%Up_Radiance/factor
1483 rts_normal%Down_Radiance = rts_normal%Down_Radiance/factor
1484 rts_normal%Down_Solar_Radiance = rts_normal%Down_Solar_Radiance/factor
1485 rts_normal%Surface_Planck_Radiance = rts_normal%Surface_Planck_Radiance/factor
1486 rts_normal%Radiance = rts_normal%Radiance/factor
1487 rts_normal%Brightness_Temperature = rts_normal%Brightness_Temperature/factor
1491 rts_normal%Upwelling_Overcast_Radiance(1:k) = rts_normal%Upwelling_Overcast_Radiance(1:k)/factor
1492 rts_normal%Upwelling_Radiance(1:k) = rts_normal%Upwelling_Radiance(1:k)/factor
1493 rts_normal%Layer_Optical_Depth(1:k) = rts_normal%Layer_Optical_Depth(1:k)/factor
1540 rts_sqrt%RT_Algorithm_Name =
'Object SQRT()' 1542 rts_sqrt%SOD =
sqrt(rts_sqrt%SOD)
1543 rts_sqrt%Surface_Emissivity =
sqrt(rts_sqrt%Surface_Emissivity)
1544 rts_sqrt%Surface_Reflectivity =
sqrt(rts_sqrt%Surface_Reflectivity)
1545 rts_sqrt%Up_Radiance =
sqrt(rts_sqrt%Up_Radiance)
1546 rts_sqrt%Down_Radiance =
sqrt(rts_sqrt%Down_Radiance)
1547 rts_sqrt%Down_Solar_Radiance =
sqrt(rts_sqrt%Down_Solar_Radiance)
1548 rts_sqrt%Surface_Planck_Radiance =
sqrt(rts_sqrt%Surface_Planck_Radiance)
1549 rts_sqrt%Radiance =
sqrt(rts_sqrt%Radiance)
1550 rts_sqrt%Brightness_Temperature =
sqrt(rts_sqrt%Brightness_Temperature)
1554 rts_sqrt%Upwelling_Overcast_Radiance(1:k) =
sqrt(rts_sqrt%Upwelling_Overcast_Radiance(1:k))
1555 rts_sqrt%Upwelling_Radiance(1:k) =
sqrt(rts_sqrt%Upwelling_Radiance(1:k))
1556 rts_sqrt%Layer_Optical_Depth(1:k) =
sqrt(rts_sqrt%Layer_Optical_Depth(1:k))
1576 INTEGER,
INTENT(IN) :: fid
1578 LOGICAL,
OPTIONAL,
INTENT(IN) :: old_version
1582 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_RTSolution_ReadFile(Record)' 1584 CHARACTER(ML) :: msg
1585 CHARACTER(ML) :: io_msg
1588 LOGICAL :: current_version
1593 current_version = .true.
1594 IF (
PRESENT(old_version) ) current_version = .NOT. old_version
1597 READ( fid,iostat=io_stat,iomsg=io_msg ) n_layers
1598 IF ( io_stat /= 0 )
THEN 1599 msg =
'Error reading dimensions - '//trim(io_msg)
1605 IF ( n_layers > 0 )
THEN 1608 msg =
'Error creating output object.' 1615 READ( fid,iostat=io_stat,iomsg=io_msg ) &
1617 rts%WMO_Satellite_Id, &
1618 rts%WMO_Sensor_Id , &
1620 IF ( io_stat /= 0 )
THEN 1621 msg =
'Error reading sensor information - '//trim(io_msg)
1627 READ( fid,iostat=io_stat,iomsg=io_msg ) &
1628 rts%RT_Algorithm_Name
1629 IF ( io_stat /= 0 )
THEN 1630 msg =
'Error reading RT Algorithm Name'//trim(io_msg)
1636 READ( fid,iostat=io_stat,iomsg=io_msg ) &
1638 rts%Surface_Emissivity , &
1639 rts%Surface_Reflectivity , &
1641 rts%Down_Radiance , &
1642 rts%Down_Solar_Radiance , &
1643 rts%Surface_Planck_Radiance
1644 IF ( io_stat /= 0 )
THEN 1645 msg =
'Error reading scalar intermediate results - '//trim(io_msg)
1648 IF ( n_layers > 0 )
THEN 1649 IF ( current_version )
THEN 1650 READ( fid,iostat=io_stat,iomsg=io_msg ) &
1651 rts%Upwelling_Overcast_Radiance , &
1652 rts%Upwelling_Radiance, &
1653 rts%Layer_Optical_Depth
1655 READ( fid,iostat=io_stat,iomsg=io_msg ) &
1656 rts%Upwelling_Radiance , &
1657 rts%Layer_Optical_Depth
1659 IF ( io_stat /= 0 )
THEN 1660 msg =
'Error reading array intermediate results - '//trim(io_msg)
1667 READ( fid,iostat=io_stat,iomsg=io_msg ) &
1669 rts%Brightness_Temperature
1670 IF ( io_stat /= 0 )
THEN 1671 msg =
'Error reading result data - '//trim(io_msg)
1679 CLOSE( fid,iostat=io_stat,iomsg=io_msg )
1681 msg = trim(msg)//
'; Error closing file during error cleanup - '//trim(io_msg)
1702 INTEGER,
INTENT(IN) :: fid
1707 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_RTSolution_WriteFile(Record)' 1709 CHARACTER(ML) :: msg
1710 CHARACTER(ML) :: io_msg
1718 WRITE( fid,iostat=io_stat,iomsg=io_msg ) rts%n_Layers
1719 IF ( io_stat /= 0 )
THEN 1720 msg =
'Error writing dimensions - '//trim(io_msg)
1726 WRITE( fid,iostat=io_stat,iomsg=io_msg ) &
1728 rts%WMO_Satellite_Id, &
1729 rts%WMO_Sensor_Id , &
1731 IF ( io_stat /= 0 )
THEN 1732 msg =
'Error writing sensor information - '//trim(io_msg)
1738 WRITE( fid,iostat=io_stat,iomsg=io_msg ) &
1739 rts%RT_Algorithm_Name
1740 IF ( io_stat /= 0 )
THEN 1741 msg =
'Error writing RT Algorithm Name'//trim(io_msg)
1747 WRITE( fid,iostat=io_stat,iomsg=io_msg ) &
1749 rts%Surface_Emissivity , &
1750 rts%Surface_Reflectivity , &
1752 rts%Down_Radiance , &
1753 rts%Down_Solar_Radiance , &
1754 rts%Surface_Planck_Radiance
1755 IF ( io_stat /= 0 )
THEN 1756 msg =
'Error writing scalar intermediate results - '//trim(io_msg)
1759 IF ( rts%n_Layers > 0 )
THEN 1760 WRITE( fid,iostat=io_stat,iomsg=io_msg ) &
1761 rts%Upwelling_Overcast_Radiance , &
1762 rts%Upwelling_Radiance, &
1763 rts%Layer_Optical_Depth
1764 IF ( io_stat /= 0 )
THEN 1765 msg =
'Error writing array intermediate results - '//trim(io_msg)
1772 WRITE( fid,iostat=io_stat,iomsg=io_msg ) &
1774 rts%Brightness_Temperature
1775 IF ( io_stat /= 0 )
THEN 1776 msg =
'Error writing result data - '//trim(io_msg)
1784 IF ( io_stat /= 0 ) &
1785 msg = trim(msg)//
'; Error closing file during error cleanup - '//trim(io_msg)
elemental type(crtm_rtsolution_type) function crtm_rtsolution_subtract(rts1, rts2)
elemental type(crtm_rtsolution_type) function crtm_rtsolution_normalise(rts, factor)
elemental type(crtm_rtsolution_type) function crtm_rtsolution_exponent(rts, power)
subroutine scalar_inspect(RTSolution, Unit)
integer, parameter, public failure
integer, parameter, public strlen
integer, parameter, public warning
elemental logical function, public crtm_rtsolution_compare(x, y, n_SigFig)
elemental subroutine, public crtm_rtsolution_zero(RTSolution)
integer function, public crtm_rtsolution_statistics(rts, rts_stats)
integer, parameter, public fp
integer function, public readgatts_binary_file(fid, Write_Module, Created_On, Title, History, Comment)
character(*), parameter write_error_status
elemental type(crtm_rtsolution_type) function crtm_rtsolution_sqrt(rts)
subroutine rank2_inspect(RTSolution, Unit)
subroutine inquire_cleanup()
integer function, public crtm_rtsolution_inquirefile(Filename, n_Channels, n_Profiles)
subroutine read_cleanup()
integer function, public crtm_rtsolution_readfile(Filename, RTSolution, Quiet, n_Channels, n_Profiles, Old_Version, Debug)
subroutine write_cleanup()
subroutine read_record_cleanup()
elemental logical function, public crtm_rtsolution_associated(RTSolution)
integer function, public open_binary_file(Filename, FileID, For_Output, No_Check)
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
integer, parameter, public invalid_wmo_satellite_id
integer function read_record(fid, rts, old_version)
elemental subroutine, public crtm_rtsolution_destroy(RTSolution)
integer, parameter, public default_n_sigfig
integer, parameter, public invalid_sensor
integer, parameter, public invalid_wmo_sensor_id
integer function, public writegatts_binary_file(fid, Write_Module, Created_On, Title, History, Comment)
subroutine write_record_cleanup()
character(*), parameter module_version_id
elemental type(crtm_rtsolution_type) function crtm_rtsolution_add(rts1, rts2)
elemental subroutine, public crtm_rtsolution_create(RTSolution, n_Layers)
subroutine, public crtm_rtsolution_defineversion(Id)
elemental logical function crtm_rtsolution_equal(x, y)
integer, parameter, public success
integer, parameter, public information
integer function, public crtm_rtsolution_writefile(Filename, RTSolution, Quiet, Debug)