46 '$Id: CloudCoeff_Binary_IO.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 49 INTEGER,
PARAMETER ::
ml = 256
167 n_MW_Frequencies, & ! Optional Output
168 n_MW_Radii , & ! Optional Output
169 n_IR_Frequencies, & ! Optional Output
170 n_IR_Radii , & ! Optional Output
171 n_Temperatures , & ! Optional Output
172 n_Densities , & ! Optional Output
173 n_Legendre_Terms, & ! Optional Output
174 n_Phase_Elements, & ! Optional Output
175 Release , & ! Optional Output
179 CHARACTER(*),
INTENT(IN) :: filename
180 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_mw_frequencies
181 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_mw_radii
182 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_ir_frequencies
183 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_ir_radii
184 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_temperatures
185 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_densities
186 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_legendre_terms
187 INTEGER,
OPTIONAL,
INTENT(OUT) :: n_phase_elements
188 INTEGER,
OPTIONAL,
INTENT(OUT) :: release
189 INTEGER,
OPTIONAL,
INTENT(OUT) :: version
193 CHARACTER(*),
PARAMETER :: routine_name =
'CloudCoeff_Binary_InquireFile' 205 msg =
'File '//trim(filename)//
' not found.' 211 IF ( err_stat /=
success )
THEN 212 msg =
'Error opening '//trim(filename)
217 READ( fid,iostat=io_stat ) cloudcoeff%Release, cloudcoeff%Version
218 IF ( io_stat /= 0 )
THEN 219 WRITE( msg,
'("Error reading Release/Version. IOSTAT = ",i0)' ) io_stat
224 READ( fid,iostat=io_stat ) cloudcoeff%n_MW_Frequencies, &
225 cloudcoeff%n_MW_Radii , &
226 cloudcoeff%n_IR_Frequencies, &
227 cloudcoeff%n_IR_Radii , &
228 cloudcoeff%n_Temperatures , &
229 cloudcoeff%n_Densities , &
230 cloudcoeff%n_Legendre_Terms, &
231 cloudcoeff%n_Phase_Elements
232 IF ( io_stat /= 0 )
THEN 233 WRITE( msg,
'("Error reading dimensions from ",a,". IOSTAT = ",i0)' ) &
234 trim(filename), io_stat
239 CLOSE( fid,iostat=io_stat )
240 IF ( io_stat /= 0 )
THEN 241 WRITE( msg,
'("Error closing ",a,". IOSTAT = ",i0)' ) trim(filename), io_stat
246 IF (
PRESENT(n_mw_frequencies) ) n_mw_frequencies = cloudcoeff%n_MW_Frequencies
247 IF (
PRESENT(n_mw_radii ) ) n_mw_radii = cloudcoeff%n_MW_Radii
248 IF (
PRESENT(n_ir_frequencies) ) n_ir_frequencies = cloudcoeff%n_IR_Frequencies
249 IF (
PRESENT(n_ir_radii ) ) n_ir_radii = cloudcoeff%n_IR_Radii
250 IF (
PRESENT(n_temperatures ) ) n_temperatures = cloudcoeff%n_Temperatures
251 IF (
PRESENT(n_densities ) ) n_densities = cloudcoeff%n_Densities
252 IF (
PRESENT(n_legendre_terms) ) n_legendre_terms = cloudcoeff%n_Legendre_Terms
253 IF (
PRESENT(n_phase_elements) ) n_phase_elements = cloudcoeff%n_Phase_Elements
254 IF (
PRESENT(release ) ) release = cloudcoeff%Release
255 IF (
PRESENT(version ) ) version = cloudcoeff%Version
262 CLOSE( fid,iostat=io_stat )
263 IF ( io_stat /= 0 ) &
264 msg = trim(msg)//
'; Error closing input file during error cleanup' 329 CloudCoeff, & ! Output
330 Quiet , & ! Optional input
334 CHARACTER(*),
INTENT(IN) :: filename
336 LOGICAL,
OPTIONAL,
INTENT(IN) :: quiet
337 LOGICAL,
OPTIONAL,
INTENT(IN) :: debug
341 CHARACTER(*),
PARAMETER :: routine_name =
'CloudCoeff_ReadFile(Binary)' 353 IF (
PRESENT(quiet) ) noisy = .NOT. quiet
355 IF (
PRESENT(debug) )
THEN 356 IF ( debug ) noisy = .true.
362 IF ( err_stat /=
success )
THEN 363 msg =
'Error opening '//trim(filename)
369 READ( fid,iostat=io_stat ) dummy%Release, dummy%Version
370 IF ( io_stat /= 0 )
THEN 371 WRITE( msg,
'("Error reading Release/Version. IOSTAT = ",i0)' ) io_stat
375 msg =
'CloudCoeff Release check failed.' 382 READ( fid,iostat=io_stat ) dummy%n_MW_Frequencies, &
384 dummy%n_IR_Frequencies, &
386 dummy%n_Temperatures , &
387 dummy%n_Densities , &
388 dummy%n_Legendre_Terms, &
389 dummy%n_Phase_Elements
390 IF ( io_stat /= 0 )
THEN 391 WRITE( msg,
'("Error reading data dimensions. IOSTAT = ",i0)' ) io_stat
396 dummy%n_MW_Frequencies, &
398 dummy%n_IR_Frequencies, &
400 dummy%n_Temperatures , &
401 dummy%n_Densities , &
402 dummy%n_Legendre_Terms, &
403 dummy%n_Phase_Elements )
405 msg =
'CloudCoeff object allocation failed.' 409 READ( fid,iostat=io_stat ) cloudcoeff%Frequency_MW, &
410 cloudcoeff%Frequency_IR, &
411 cloudcoeff%Reff_MW , &
412 cloudcoeff%Reff_IR , &
413 cloudcoeff%Temperature , &
415 IF ( io_stat /= 0 )
THEN 416 WRITE( msg,
'("Error reading dimension vector data. IOSTAT = ",i0)' ) io_stat
420 READ( fid,iostat=io_stat ) cloudcoeff%ke_L_MW , &
421 cloudcoeff%w_L_MW , &
422 cloudcoeff%g_L_MW , &
423 cloudcoeff%pcoeff_L_MW
424 IF ( io_stat /= 0 )
THEN 425 WRITE( msg,
'("Error reading microwave liquid phase data. IOSTAT = ",i0)' ) io_stat
429 READ( fid,iostat=io_stat ) cloudcoeff%ke_S_MW , &
430 cloudcoeff%w_S_MW , &
431 cloudcoeff%g_S_MW , &
432 cloudcoeff%pcoeff_S_MW
433 IF ( io_stat /= 0 )
THEN 434 WRITE( msg,
'("Error reading microwave solid phase data. IOSTAT = ",i0)' ) io_stat
438 READ( fid,iostat=io_stat ) cloudcoeff%ke_IR , &
442 IF ( io_stat /= 0 )
THEN 443 WRITE( msg,
'("Error reading infrared data. IOSTAT = ",i0)' ) io_stat
447 cloudcoeff%Version = dummy%Version
451 CLOSE( fid,iostat=io_stat )
452 IF ( io_stat /= 0 )
THEN 453 WRITE( msg,
'("Error closing ",a,". IOSTAT = ",i0)' ) trim(filename), io_stat
468 CLOSE( fid,iostat=io_stat )
469 IF ( io_stat /= 0 ) &
470 msg = trim(msg)//
'; Error closing input file during error cleanup.' 539 CloudCoeff, & ! Input
540 Quiet , & ! Optional input
544 CHARACTER(*),
INTENT(IN) :: filename
546 LOGICAL,
OPTIONAL,
INTENT(IN) :: quiet
547 LOGICAL,
OPTIONAL,
INTENT(IN) :: debug
551 CHARACTER(*),
PARAMETER :: routine_name =
'CloudCoeff_WriteFile(Binary)' 552 CHARACTER(*),
PARAMETER :: file_status_on_error =
'DELETE' 563 IF (
PRESENT(quiet) ) noisy = .NOT. quiet
565 IF (
PRESENT(debug) )
THEN 566 IF ( debug ) noisy = .true.
573 msg =
'Input CloudCoeff object is not allocated.' 578 msg =
'CloudCoeff Release check failed.' 585 IF ( err_stat /=
success )
THEN 586 msg =
'Error opening '//trim(filename)
592 WRITE( fid,iostat=io_stat ) cloudcoeff%Release, cloudcoeff%Version
593 IF ( io_stat /= 0 )
THEN 594 WRITE( msg,
'("Error reading Release/Version. IOSTAT = ",i0)' ) io_stat
601 WRITE( fid,iostat=io_stat ) cloudcoeff%n_MW_Frequencies, &
602 cloudcoeff%n_MW_Radii , &
603 cloudcoeff%n_IR_Frequencies, &
604 cloudcoeff%n_IR_Radii , &
605 cloudcoeff%n_Temperatures , &
606 cloudcoeff%n_Densities , &
607 cloudcoeff%n_Legendre_Terms, &
608 cloudcoeff%n_Phase_Elements
609 IF ( io_stat /= 0 )
THEN 610 WRITE( msg,
'("Error writing data dimensions. IOSTAT = ",i0)' ) io_stat
614 WRITE( fid,iostat=io_stat ) cloudcoeff%Frequency_MW, &
615 cloudcoeff%Frequency_IR, &
616 cloudcoeff%Reff_MW , &
617 cloudcoeff%Reff_IR , &
618 cloudcoeff%Temperature , &
620 IF ( io_stat /= 0 )
THEN 621 WRITE( msg,
'("Error writing dimension vector data. IOSTAT = ",i0)' ) io_stat
625 WRITE( fid,iostat=io_stat ) cloudcoeff%ke_L_MW , &
626 cloudcoeff%w_L_MW , &
627 cloudcoeff%g_L_MW , &
628 cloudcoeff%pcoeff_L_MW
629 IF ( io_stat /= 0 )
THEN 630 WRITE( msg,
'("Error writing microwave liquid phase data. IOSTAT = ",i0)' ) io_stat
634 WRITE( fid,iostat=io_stat ) cloudcoeff%ke_S_MW , &
635 cloudcoeff%w_S_MW , &
636 cloudcoeff%g_S_MW , &
637 cloudcoeff%pcoeff_S_MW
638 IF ( io_stat /= 0 )
THEN 639 WRITE( msg,
'("Error writing microwave solid phase data. IOSTAT = ",i0)' ) io_stat
643 WRITE( fid,iostat=io_stat ) cloudcoeff%ke_IR , &
647 IF ( io_stat /= 0 )
THEN 648 WRITE( msg,
'("Error writing infrared data. IOSTAT = ",i0)' ) io_stat
654 CLOSE( fid,status=
'KEEP',iostat=io_stat )
655 IF ( io_stat /= 0 )
THEN 656 WRITE( msg,
'("Error closing ",a,". IOSTAT = ",i0)' ) trim(filename), io_stat
672 IF ( io_stat /= 0 ) &
673 msg = trim(msg)//
'; Error deleting output file during error cleanup.' 706 CHARACTER(*),
INTENT(OUT) :: id
integer, parameter, public failure
elemental subroutine, public cloudcoeff_destroy(CloudCoeff)
elemental subroutine, public cloudcoeff_create(CloudCoeff, n_MW_Frequencies, n_MW_Radii, n_IR_Frequencies, n_IR_Radii, n_Temperatures, n_Densities, n_Legendre_Terms, n_Phase_Elements)
character(*), parameter write_error_status
character(*), parameter module_version_id
subroutine inquire_cleanup()
subroutine read_cleanup()
integer function, public cloudcoeff_binary_readfile(Filename, CloudCoeff, Quiet, Debug)
subroutine write_cleanup()
subroutine, public cloudcoeff_binary_ioversion(Id)
integer function, public open_binary_file(Filename, FileID, For_Output, No_Check)
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
subroutine, public cloudcoeff_info(CloudCoeff, Info)
elemental logical function, public cloudcoeff_associated(CloudCoeff)
integer function, public cloudcoeff_binary_inquirefile(Filename, n_MW_Frequencies, n_MW_Radii, n_IR_Frequencies, n_IR_Radii, n_Temperatures, n_Densities, n_Legendre_Terms, n_Phase_Elements, Release, Version)
logical function, public cloudcoeff_validrelease(CloudCoeff)
integer, parameter, public success
integer, parameter, public information
integer function, public cloudcoeff_binary_writefile(Filename, CloudCoeff, Quiet, Debug)