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_open.F90 8 : ! 9 : ! !INTERFACE: 10 : ! 11 : module HCO_m_netcdf_io_open 12 : ! 13 : implicit none 14 : ! 15 : ! !PUBLIC MEMBER FUNCTIONS: 16 : ! 17 : public Ncop_Rd 18 : public Ncop_Wr 19 : ! 20 : ! !DESCRIPTION: Routines to open 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: Ncop_Rd 40 : ! 41 : ! !INTERFACE: 42 : ! 43 0 : subroutine Ncop_Rd (ncid, filname) 44 : ! 45 : ! !USES: 46 : ! 47 : use m_do_err_out 48 : ! 49 : implicit none 50 : ! 51 : include "netcdf.inc" 52 : ! 53 : ! !INPUT PARAMETERS: 54 : !! filname : name of netCDF file to open for reading 55 : character (len=*), intent (in) :: filname 56 : ! 57 : ! !OUTPUT PARAMETERS: 58 : !! ncid : opened netCDF file id 59 : integer , intent (out) :: ncid 60 : ! 61 : ! !DESCRIPTION: Opens a netCDF file for reading and does some error checking. 62 : !\\ 63 : !\\ 64 : ! !AUTHOR: 65 : ! John Tannahill (LLNL) and Jules Kouatchou 66 : ! 67 : ! !REVISION HISTORY: 68 : ! See https://github.com/geoschem/ncdfutil for complete history 69 : !EOP 70 : !------------------------------------------------------------------------------ 71 : !BOC 72 : ! 73 : ! !LOCAL VARIABLES: 74 : character (len=512) :: err_msg 75 : integer :: ierr 76 : ! 77 0 : ierr = Nf_Open (filname, NF_NOWRITE, ncid) 78 : 79 0 : if (ierr /= NF_NOERR) then 80 0 : err_msg = 'In Ncop_Rd, cannot open: ' // Trim (filname) 81 0 : call Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) 82 : end if 83 : 84 0 : return 85 : 86 : end subroutine Ncop_Rd 87 : !EOC 88 : !------------------------------------------------------------------------------ 89 : ! NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group ! 90 : ! and NASA/GSFC, SIVO, Code 610.3 ! 91 : !------------------------------------------------------------------------------ 92 : !BOP 93 : ! 94 : ! !IROUTINE: Ncop_Wr 95 : ! 96 : ! !INTERFACE: 97 : ! 98 0 : subroutine Ncop_Wr (ncid, filname) 99 : ! 100 : ! !USES: 101 : ! 102 : use m_do_err_out 103 : ! 104 : implicit none 105 : ! 106 : include "netcdf.inc" 107 : ! 108 : ! !INPUT PARAMETERS: 109 : !! filname : name of netCDF file to open for reading 110 : character (len=*), intent (in) :: filname 111 : ! 112 : ! !OUTPUT PARAMETERS: 113 : !! ncid : opened netCDF file id 114 : integer , intent (out) :: ncid 115 : ! 116 : ! !DESCRIPTION: Opens a netCDF file for reading/writing and does some 117 : ! error checking. 118 : !\\ 119 : !\\ 120 : ! !AUTHOR: 121 : ! John Tannahill (LLNL) and Jules Kouatchou 122 : ! 123 : ! !REVISION HISTORY: 124 : ! See https://github.com/geoschem/ncdfutil for complete history 125 : !EOP 126 : !------------------------------------------------------------------------------ 127 : !BOC 128 : ! 129 : ! !LOCAL VARIABLES: 130 : character (len=512) :: err_msg 131 : integer :: ierr 132 : ! 133 0 : ierr = Nf_Open (filname, NF_WRITE, ncid) 134 : 135 0 : if (ierr /= NF_NOERR) then 136 0 : err_msg = 'In Ncop_Rd, cannot open: ' // Trim (filname) 137 0 : call Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) 138 : end if 139 : 140 0 : return 141 : 142 : end subroutine Ncop_Wr 143 : !EOC 144 : !------------------------------------------------------------------------ 145 : end module HCO_m_netcdf_io_open 146 :