31 character(len=*) :: nc_fname
36 logical(LGP) :: exists
42 inquire (file=nc_fname, exist=exists)
43 if (.not. exists)
then
44 write (
errmsg,
'(a,a,a)')
'Specified NetCDF input file does &
45 ¬ exist [file=', trim(nc_fname),
'].'
66 character(len=*),
intent(in) :: modeltype
67 character(len=*),
intent(in) :: modelname
69 character(len=*),
intent(in) :: input_name
70 integer(I4B),
intent(in) :: varid
71 integer(I4B),
intent(in) :: iout
73 character(len=NETCDF_ATTR_STRLEN) :: input_str
74 character(len=LENCOMPONENTNAME) :: c_name, sc_name
75 character(len=LINELENGTH) :: mempath, varname
76 integer(I4B) :: layer, period, iaux, mf6_layer, mf6_period, mf6_iaux
77 logical(LGP) :: success
88 if (nf90_get_att(nc_vars%ncid, varid,
'modflow6_input', &
89 input_str) == nf90_noerr)
then
104 if (nf90_get_att(nc_vars%ncid, varid, &
105 'modflow6_layer', mf6_layer) == nf90_noerr)
then
110 if (nf90_get_att(nc_vars%ncid, varid, &
111 'modflow6_iper', mf6_period) == nf90_noerr)
then
116 if (nf90_get_att(nc_vars%ncid, varid, &
117 'modflow6_iaux', mf6_iaux) == nf90_noerr)
then
122 call nc_vars%add(sc_name, varname, layer, period, iaux, varid)
124 errmsg =
'NetCDF variable invalid modflow6_input attribute: "'// &
125 trim(input_str)//
'".'
141 character(len=*),
intent(in) :: modeltype
142 character(len=*),
intent(in) :: modelname
143 character(len=*),
intent(in) :: input_name
144 character(len=*),
intent(in) :: nc_fname
145 integer(I4B),
intent(in) :: ncid
147 character(len=NETCDF_ATTR_STRLEN) :: grid
153 if (nf90_get_att(ncid, nf90_global,
"modflow6_grid", &
154 grid) == nf90_noerr)
then
160 errmsg =
'NetCDF input file global attribute "grid" not found.'
173 nc_vars, nc_fname, ncid, iout)
175 character(len=*),
intent(in) :: modeltype
176 character(len=*),
intent(in) :: modelname
177 character(len=*),
intent(in) :: input_name
179 character(len=*),
intent(in) :: nc_fname
180 integer(I4B),
intent(in) :: ncid
181 integer(I4B),
intent(in) :: iout
182 integer(I4B) :: ndim, nvar, nattr, unlimdimid
183 integer(I4B),
dimension(:),
allocatable :: varids
185 character(len=LINELENGTH) :: grid
186 integer(I4B) :: iparam
192 call nc_vars%init(modelname, nc_fname, ncid, grid)
195 call nf_verify(nf90_inquire(ncid, ndim, nvar, nattr, unlimdimid), &
199 allocate (varids(nvar))
200 call nf_verify(nf90_inq_varids(ncid, nvar, varids), nc_vars%nc_fname)
206 varids(iparam), iout)
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lencomponentname
maximum length of a component name
This module defines variable data types.
subroutine split_mem_address(mem_address, mem_path, var_name, success)
Split a memory address string into memory path and variable name.
subroutine split_mem_path(mem_path, component, subcomponent)
Split the memory path into component(s)
This module contains the NCContextBuildModule.
integer(i4b) function, public open_ncfile(nc_fname, iout)
open netcdf file
subroutine add_package_var(modeltype, modelname, nc_vars, input_name, varid, iout)
add a package input variable to nc_vars structure
character(len=netcdf_attr_strlen) function verify_global_attr(modeltype, modelname, input_name, nc_fname, ncid)
verify global attribute modflow6_grid is present and return value
subroutine, public create_netcdf_context(modeltype, modelname, input_name, nc_vars, nc_fname, ncid, iout)
create internal description of modflow6 input variables in netcdf file
This module contains the NCFileVarsModule.
This module contains the NetCDFCommonModule.
integer(i4b), parameter, public netcdf_attr_strlen
subroutine, public nf_verify(res, nc_fname)
error check a netcdf-fortran interface call
integer(i4b) function, public nc_fopen(nc_fname, iout)
Open netcdf file.
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
This module contains the SourceCommonModule.
character(len=lencomponentname) function, public idm_subcomponent_type(component, subcomponent)
component from package or model type
character(len=lenpackagename) function, public idm_subcomponent_name(component_type, subcomponent_type, sc_name)
model package subcomponent name
Type describing modflow6 input variables in model NetCDF file.