47 '$Id: ACCoeff_Binary_IO.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 50 INTEGER,
PARAMETER ::
ml = 256
153 n_FOVs , & ! Optional output
154 n_Channels , & ! Optional output
155 Release , & ! Optional Output
156 Version , & ! Optional Output
157 Sensor_Id , & ! Optional Output
158 WMO_Satellite_Id, & ! Optional Output
162 CHARACTER(*),
INTENT(IN) :: filename
163 INTEGER ,
OPTIONAL,
INTENT(OUT) :: n_fovs
164 INTEGER ,
OPTIONAL,
INTENT(OUT) :: n_channels
165 INTEGER ,
OPTIONAL,
INTENT(OUT) :: release
166 INTEGER ,
OPTIONAL,
INTENT(OUT) :: version
167 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: sensor_id
168 INTEGER ,
OPTIONAL,
INTENT(OUT) :: wmo_satellite_id
169 INTEGER ,
OPTIONAL,
INTENT(OUT) :: wmo_sensor_id
173 CHARACTER(*),
PARAMETER :: routine_name =
'ACCoeff_InquireFile(Binary)' 185 msg =
'File '//trim(filename)//
' not found.' 192 IF ( err_stat /=
success )
THEN 193 msg =
'Error opening '//trim(filename)
199 READ( fid,iostat=io_stat ) accoeff%Release, accoeff%Version
200 IF ( io_stat /= 0 )
THEN 201 WRITE( msg,
'("Error reading Release/Version. IOSTAT = ",i0)' ) io_stat
207 READ( fid, iostat=io_stat ) &
210 IF ( io_stat /= 0 )
THEN 211 WRITE( msg,
'("Error reading dimension values from ",a,". IOSTAT = ",i0)' ) &
212 trim(filename), io_stat
218 READ( fid, iostat=io_stat ) &
219 accoeff%Sensor_Id , &
220 accoeff%WMO_Satellite_Id, &
221 accoeff%WMO_Sensor_Id
222 IF ( io_stat /= 0 )
THEN 223 WRITE( msg,
'("Error reading sensor information from ",a,". IOSTAT = ",i0)' ) &
224 trim(filename), io_stat
230 CLOSE( fid, iostat=io_stat )
231 IF ( io_stat /= 0 )
THEN 232 WRITE( msg,
'("Error closing ",a,". IOSTAT = ",i0)' ) trim(filename), io_stat
238 IF (
PRESENT(n_fovs ) ) n_fovs = accoeff%n_FOVs
239 IF (
PRESENT(n_channels ) ) n_channels = accoeff%n_Channels
240 IF (
PRESENT(release ) ) release = accoeff%Release
241 IF (
PRESENT(version ) ) version = accoeff%Version
242 IF (
PRESENT(sensor_id ) ) sensor_id = trim(accoeff%Sensor_Id)
243 IF (
PRESENT(wmo_satellite_id) ) wmo_satellite_id = accoeff%WMO_Satellite_Id
244 IF (
PRESENT(wmo_sensor_id ) ) wmo_sensor_id = accoeff%WMO_Sensor_Id
251 CLOSE( fid,iostat=io_stat )
252 IF ( io_stat /= 0 ) &
253 msg = trim(msg)//
'; Error closing input file during error cleanup' 333 No_Close, & ! Optional input
334 Quiet , & ! Optional input
338 CHARACTER(*),
INTENT(IN) :: filename
340 LOGICAL,
OPTIONAL,
INTENT(IN) :: no_close
341 LOGICAL,
OPTIONAL,
INTENT(IN) :: quiet
342 LOGICAL,
OPTIONAL,
INTENT(IN) :: debug
346 CHARACTER(*),
PARAMETER :: routine_name =
'ACCoeff_ReadFile(Binary)' 349 LOGICAL :: close_file
360 IF (
PRESENT(no_close) ) close_file = .NOT. no_close
363 IF (
PRESENT(quiet) ) noisy = .NOT. quiet
365 IF (
PRESENT(debug) )
THEN 366 IF ( debug ) noisy = .true.
373 INQUIRE( file=filename, number=fid )
376 msg =
'Error inquiring '//trim(filename)//
' for its FileID' 383 IF ( err_stat /=
success )
THEN 384 msg =
'Error opening '//trim(filename)
388 msg =
'File '//trim(filename)//
' not found.' 395 READ( fid,iostat=io_stat ) dummy%Release, dummy%Version
396 IF ( io_stat /= 0 )
THEN 397 WRITE( msg,
'("Error reading Release/Version. IOSTAT = ",i0)' ) io_stat
401 msg =
'ACCoeff Release check failed.' 408 READ( fid, iostat=io_stat ) dummy%n_FOVs , &
410 IF ( io_stat /= 0 )
THEN 411 WRITE( msg,
'("Error reading data dimensions. IOSTAT = ",i0)' ) io_stat
419 msg =
'ACCoeff object allocation failed.' 423 READ( fid, iostat=io_stat ) accoeff%Sensor_Id , &
424 accoeff%WMO_Satellite_Id, &
425 accoeff%WMO_Sensor_Id
426 IF ( io_stat /= 0 )
THEN 427 WRITE( msg,
'("Error reading sensor ids. IOSTAT = ",i0)' ) io_stat
431 READ( fid, iostat=io_stat ) accoeff%Sensor_Channel
432 IF ( io_stat /= 0 )
THEN 433 WRITE( msg,
'("Error reading sensor channels. IOSTAT = ",i0)' ) io_stat
437 READ( fid, iostat=io_stat ) accoeff%A_earth , &
440 IF ( io_stat /= 0 )
THEN 441 WRITE( msg,
'("Error reading antenna correction coefficients. IOSTAT = ",i0)' ) io_stat
447 accoeff%Version = dummy%Version
451 IF ( close_file )
THEN 452 CLOSE( fid,iostat=io_stat )
453 IF ( io_stat /= 0 )
THEN 454 WRITE( msg,
'("Error closing ",a,". IOSTAT = ",i0)' ) trim(filename), io_stat
470 CLOSE( fid,iostat=io_stat )
471 IF ( io_stat /= 0 ) &
472 msg = trim(msg)//
'; Error closing input file during error cleanup.' 551 No_Close, & ! Optional input
552 Quiet , & ! Optional input
556 CHARACTER(*),
INTENT(IN) :: filename
558 LOGICAL,
OPTIONAL,
INTENT(IN) :: no_close
559 LOGICAL,
OPTIONAL,
INTENT(IN) :: quiet
560 LOGICAL,
OPTIONAL,
INTENT(IN) :: debug
564 CHARACTER(*),
PARAMETER :: routine_name =
'ACCoeff_WriteFile(Binary)' 567 LOGICAL :: close_file
577 IF (
PRESENT(no_close) ) close_file = .NOT. no_close
580 IF (
PRESENT(quiet) ) noisy = .NOT. quiet
582 IF (
PRESENT(debug) )
THEN 583 IF ( debug ) noisy = .true.
587 msg =
'ACCoeff object is empty.' 595 INQUIRE( file=filename, number=fid )
598 msg =
'Error inquiring '//trim(filename)//
' for its FileID' 604 IF ( err_stat /=
success )
THEN 605 msg =
'Error opening '//trim(filename)
612 WRITE( fid,iostat=io_stat ) accoeff%Release, accoeff%Version
613 IF ( io_stat /= 0 )
THEN 614 WRITE( msg,
'("Error writing Release/Version. IOSTAT = ",i0)' ) io_stat
621 WRITE( fid, iostat=io_stat ) accoeff%n_FOVs , &
623 IF ( io_stat /= 0 )
THEN 624 WRITE( msg,
'("Error writing data dimensions. IOSTAT = ",i0)' ) io_stat
628 WRITE( fid, iostat=io_stat ) accoeff%Sensor_Id , &
629 accoeff%WMO_Satellite_Id, &
630 accoeff%WMO_Sensor_Id
631 IF ( io_stat /= 0 )
THEN 632 WRITE( msg,
'("Error writing sensor ids. IOSTAT = ",i0)' ) io_stat
636 WRITE( fid, iostat=io_stat ) accoeff%Sensor_Channel
637 IF ( io_stat /= 0 )
THEN 638 WRITE( msg,
'("Error writing sensor channels. IOSTAT = ",i0)' ) io_stat
642 WRITE( fid, iostat=io_stat ) accoeff%A_earth , &
645 IF ( io_stat /= 0 )
THEN 646 WRITE( msg,
'("Error writing antenna correction coefficients. IOSTAT = ",i0)' ) io_stat
652 IF ( close_file )
THEN 653 CLOSE( fid,iostat=io_stat )
654 IF ( io_stat /= 0 )
THEN 655 WRITE( msg,
'("Error closing ",a,". IOSTAT = ",i0)' ) trim(filename), io_stat
671 CLOSE( fid,iostat=io_stat )
672 IF ( io_stat /= 0 ) &
673 msg = trim(msg)//
'; Error closing input file during error cleanup.' 706 CHARACTER(*),
INTENT(OUT) :: id
integer, parameter, public failure
integer function, public accoeff_binary_readfile(Filename, ACCoeff, No_Close, Quiet, Debug)
integer function, public accoeff_binary_writefile(Filename, ACCoeff, No_Close, Quiet, Debug)
integer, parameter, public long
integer, parameter, public double
subroutine inquire_cleanup()
subroutine, public accoeff_info(ACCoeff, Info)
elemental subroutine, public accoeff_destroy(ACCoeff)
subroutine read_cleanup()
integer function, public accoeff_binary_inquirefile(Filename, n_FOVs, n_Channels, Release, Version, Sensor_Id, WMO_Satellite_Id, WMO_Sensor_Id)
subroutine write_cleanup()
integer function, public open_binary_file(Filename, FileID, For_Output, No_Check)
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
logical function, public accoeff_validrelease(ACCoeff)
character(*), parameter write_error_status
character(*), parameter, private module_version_id
elemental subroutine, public accoeff_create(ACCoeff, n_FOVs, n_Channels)
subroutine, public accoeff_binary_ioversion(Id)
integer, parameter, public success
elemental logical function, public accoeff_associated(ACCoeff)
integer, parameter, public information