MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
netcdfcommonmodule Module Reference

This module contains the NetCDFCommonModule. More...

Functions/Subroutines

integer(i4b) function, public nc_fopen (nc_fname, iout)
 Open netcdf file. More...
 
subroutine, public nc_fclose (ncid, nc_fname)
 Close netcdf file. More...
 
subroutine, public nf_verify (res, nc_fname)
 error check a netcdf-fortran interface call More...
 

Variables

integer(i4b), parameter, public netcdf_max_dim = 6
 
integer(i4b), parameter, public netcdf_attr_strlen = 80
 

Detailed Description

Common NetCDF interfaces and constants

Function/Subroutine Documentation

◆ nc_fclose()

subroutine, public netcdfcommonmodule::nc_fclose ( integer(i4b), intent(in)  ncid,
character(len=*), intent(in)  nc_fname 
)

Definition at line 44 of file NetCDFCommon.f90.

45  integer(I4B), intent(in) :: ncid
46  character(len=*), intent(in) :: nc_fname
47  ! -- local
48  !
49  ! -- close netcdf file
50  call nf_verify(nf90_close(ncid), nc_fname)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nc_fopen()

integer(i4b) function, public netcdfcommonmodule::nc_fopen ( character(len=*), intent(in)  nc_fname,
integer(i4b), intent(in)  iout 
)

Definition at line 28 of file NetCDFCommon.f90.

29  character(len=*), intent(in) :: nc_fname
30  integer(I4B), intent(in) :: iout
31  ! -- return
32  integer(I4B) :: ncid
33  ! -- local
34  !
35  ! -- initialize
36  ncid = -1
37  !
38  ! -- open netcdf file
39  call nf_verify(nf90_open(nc_fname, nf90_nowrite, ncid), nc_fname)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nf_verify()

subroutine, public netcdfcommonmodule::nf_verify ( integer(i4b), intent(in)  res,
character(len=*), intent(in)  nc_fname 
)

Definition at line 55 of file NetCDFCommon.f90.

56  integer(I4B), intent(in) :: res
57  character(len=*), intent(in) :: nc_fname
58  ! -- local variables
59  character(len=LINELENGTH) :: errstr
60  !
61  ! -- strings are set for a subset of errors
62  ! but the exit status will always be reported
63  if (res /= nf90_noerr) then
64  !
65  select case (res)
66  case (-33) ! (NC_EBADID)
67  errstr = 'Not a netcdf id'
68  case (nf90_einval) ! (-36)
69  errstr = 'Invalid Argument'
70  case (nf90_eperm) ! (-37)
71  errstr = 'Write to read only'
72  case (-38) ! (NC_ENOTINDEFINE)
73  errstr = 'Operation not allowed in data mode'
74  case (-39) ! (NC_EINDEFINE)
75  errstr = 'Operation not allowed in define mode'
76  case (nf90_einvalcoords) ! (-40)
77  errstr = 'Index exceeds dimension bound'
78  case (nf90_enameinuse) ! (-42)
79  errstr = 'String match to name in use'
80  case (nf90_enotatt) ! (-43)
81  errstr = 'Attribute not found'
82  case (-45) ! (NC_EBADTYPE)
83  errstr = 'Not a netcdf data type'
84  case (nf90_ebaddim) ! (-46)
85  errstr = 'Invalid dimension id or name'
86  case (nf90_enotvar) ! (-49)
87  errstr = 'Variable not found'
88  case (nf90_enotnc) ! (-51)
89  errstr = 'Not a netcdf file'
90  case (nf90_echar) ! (-56)
91  errstr = 'Attempt to convert between text & numbers'
92  case (nf90_eedge) ! (-57)
93  errstr = 'Edge+start exceeds dimension bound'
94  case (nf90_estride) ! (-58)
95  errstr = 'Illegal stride'
96  case (nf90_ebadname) ! (-59)
97  errstr = 'Attribute or variable name contains illegal characters'
98  case (-127) ! (NC_EBADCHUNK)
99  errstr = 'Bad chunksize.'
100  case default
101  errstr = ''
102  end select
103  !
104  if (errstr /= '') then
105  write (errmsg, '(a,a,a,i0,a)') 'NetCDF library error [error="', &
106  trim(errstr), '", exit code=', res, '].'
107  else
108  write (errmsg, '(a,i0,a)') 'NetCDF library error [exit code=', &
109  res, '].'
110  end if
111  !
112  call store_error(errmsg)
113  call store_error_filename(nc_fname)
114  end if
Here is the call graph for this function:

Variable Documentation

◆ netcdf_attr_strlen

integer(i4b), parameter, public netcdfcommonmodule::netcdf_attr_strlen = 80

Definition at line 22 of file NetCDFCommon.f90.

22  integer(I4B), parameter :: NETCDF_ATTR_STRLEN = 80

◆ netcdf_max_dim

integer(i4b), parameter, public netcdfcommonmodule::netcdf_max_dim = 6

Definition at line 21 of file NetCDFCommon.f90.

21  integer(I4B), parameter :: NETCDF_MAX_DIM = 6