Line data Source code
1 : !------------------------------------------------------------------------------ 2 : ! NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group ! 3 : ! and NASA/GSFC, SIVO, Code 610.3 ! 4 : !------------------------------------------------------------------------------ 5 : !BOP 6 : ! 7 : ! !MODULE: HCO_m_netcdf_io_close.F90 8 : ! 9 : ! !INTERFACE: 10 : ! 11 : module HCO_m_netcdf_io_close 12 : ! 13 : implicit none 14 : ! 15 : ! !PUBLIC MEMBER FUNCTIONS: 16 : ! 17 : public Nccl 18 : public Nccl_Noerr 19 : ! 20 : ! !DESCRIPTION: Routines to close a netCDF file. 21 : !\\ 22 : !\\ 23 : ! !AUTHOR: 24 : ! Jules Kouatchou 25 : ! 26 : ! !REVISION HISTORY: 27 : ! See https://github.com/geoschem/ncdfutil for complete history 28 : !EOP 29 : !------------------------------------------------------------------------------ 30 : !BOC 31 : CONTAINS 32 : !EOC 33 : !------------------------------------------------------------------------------ 34 : ! NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group ! 35 : ! and NASA/GSFC, SIVO, Code 610.3 ! 36 : !------------------------------------------------------------------------------ 37 : !BOP 38 : ! 39 : ! !IROUTINE: Nccl 40 : ! 41 : ! !INTERFACE: 42 : ! 43 0 : subroutine Nccl (ncid) 44 : ! 45 : ! !USES: 46 : ! 47 : use netCDF 48 : use m_do_err_out 49 : ! 50 : ! !INPUT PARAMETERS: 51 : !! ncid : netCDF file id 52 : integer, intent (in) :: ncid 53 : ! 54 : ! !DESCRIPTION: Closes a netCDF file with file id ncid. 55 : !\\ 56 : !\\ 57 : ! !AUTHOR: 58 : ! John Tannahill (LLNL) and Jules Kouatchou 59 : ! 60 : ! !REVISION HISTORY: 61 : ! See https://github.com/geoschem/ncdfutil for complete history 62 : !EOP 63 : !------------------------------------------------------------------------------ 64 : !BOC 65 : ! 66 : ! !LOCAL VARIABLES: 67 : character (len=512) :: err_msg 68 : integer :: ierr 69 : ! 70 0 : ierr = Nf90_Close (ncid) 71 : 72 0 : if (ierr /= NF90_NOERR) then 73 0 : err_msg = 'In Nccl: ' // Nf90_Strerror (ierr) 74 0 : call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) 75 : end if 76 : 77 0 : return 78 : 79 : end subroutine Nccl 80 : !EOC 81 : !------------------------------------------------------------------------------ 82 : ! NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group ! 83 : ! and NASA/GSFC, SIVO, Code 610.3 ! 84 : !------------------------------------------------------------------------------ 85 : !BOP 86 : ! 87 : ! !IROUTINE: Nccl_Noerr 88 : ! 89 : ! !INTERFACE: 90 : ! 91 0 : subroutine Nccl_Noerr (ncid) 92 : ! 93 : use netCDF 94 : ! 95 : ! !INPUT PARAMETERS: 96 : !! ncid : netCDF file id 97 : integer, intent (in) :: ncid 98 : ! 99 : ! !DESCRIPTION: Closes a netCDF file (with file id ncid) if it is open and 100 : ! suppresses Ncclos error messages/exit if it is not. 101 : !\\ 102 : !\\ 103 : ! !AUTHOR: 104 : ! John Tannahill (LLNL) and Jules Kouatchou 105 : ! 106 : ! !REVISION HISTORY: 107 : ! See https://github.com/geoschem/ncdfutil for complete history 108 : !EOP 109 : !------------------------------------------------------------------------------ 110 : !BOC 111 : ! 112 : ! !LOCAL VARIABLES: 113 : integer :: ierr 114 : ! 115 0 : ierr = Nf90_Close (ncid) 116 : 117 0 : return 118 : 119 : end subroutine Nccl_Noerr 120 : !EOC 121 : end module HCO_m_netcdf_io_close 122 :