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 m_do_err_out 48 : ! 49 : implicit none 50 : ! 51 : include "netcdf.inc" 52 : ! 53 : ! !INPUT PARAMETERS: 54 : !! ncid : netCDF file id 55 : integer, intent (in) :: ncid 56 : ! 57 : ! !DESCRIPTION: Closes a netCDF file with file id ncid. 58 : !\\ 59 : !\\ 60 : ! !AUTHOR: 61 : ! John Tannahill (LLNL) and Jules Kouatchou 62 : ! 63 : ! !REVISION HISTORY: 64 : ! See https://github.com/geoschem/ncdfutil for complete history 65 : !EOP 66 : !------------------------------------------------------------------------------ 67 : !BOC 68 : ! 69 : ! !LOCAL VARIABLES: 70 : character (len=512) :: err_msg 71 : integer :: ierr 72 : ! 73 0 : ierr = Nf_Close (ncid) 74 : 75 0 : if (ierr /= NF_NOERR) then 76 0 : err_msg = 'In Nccl: ' // Nf_Strerror (ierr) 77 0 : call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) 78 : end if 79 : 80 0 : return 81 : 82 : end subroutine Nccl 83 : !EOC 84 : !------------------------------------------------------------------------------ 85 : ! NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group ! 86 : ! and NASA/GSFC, SIVO, Code 610.3 ! 87 : !------------------------------------------------------------------------------ 88 : !BOP 89 : ! 90 : ! !IROUTINE: Nccl_Noerr 91 : ! 92 : ! !INTERFACE: 93 : ! 94 0 : subroutine Nccl_Noerr (ncid) 95 : ! 96 : implicit none 97 : ! 98 : include "netcdf.inc" 99 : ! 100 : ! !INPUT PARAMETERS: 101 : !! ncid : netCDF file id 102 : integer, intent (in) :: ncid 103 : ! 104 : ! !DESCRIPTION: Closes a netCDF file (with file id ncid) if it is open and 105 : ! suppresses Ncclos error messages/exit if it is not. 106 : !\\ 107 : !\\ 108 : ! !AUTHOR: 109 : ! John Tannahill (LLNL) and Jules Kouatchou 110 : ! 111 : ! !REVISION HISTORY: 112 : ! See https://github.com/geoschem/ncdfutil for complete history 113 : !EOP 114 : !------------------------------------------------------------------------------ 115 : !BOC 116 : ! 117 : ! !LOCAL VARIABLES: 118 : integer :: ierr 119 : ! 120 0 : ierr = Nf_Close (ncid) 121 : 122 0 : return 123 : 124 : end subroutine Nccl_Noerr 125 : !EOC 126 : end module HCO_m_netcdf_io_close 127 :