netcdf_variables.f90
! -----
! Variable definitions and inquiry
! -----
function nf90_def_var_scalar(ncid, name, xtype, varid)
integer, intent( in) :: ncid
character (len = *), intent( in) :: name
integer, intent( in) :: xtype
integer, intent(out) :: varid
integer :: nf90_def_var_scalar
! Dummy - shouldn't get used
integer, dimension(1) :: dimids
nf90_def_var_scalar = nf_def_var(ncid, name, xtype, 0, dimids, varid)
end function nf90_def_var_scalar
! -----
function nf90_def_var_onedim(ncid, name, xtype, dimids, varid)
integer, intent( in) :: ncid
character (len = *), intent( in) :: name
integer, intent( in) :: xtype
integer, intent( in) :: dimids
integer, intent(out) :: varid
integer :: nf90_def_var_onedim
integer, dimension(1) :: dimidsa
dimidsa(1) = dimids
nf90_def_var_onedim = nf_def_var(ncid, name, xtype, 1, dimidsa, varid)
end function nf90_def_var_onedim
! -----
function nf90_def_var_manydims(ncid, name, xtype, dimids, varid)
integer, intent( in) :: ncid
character (len = *), intent( in) :: name
integer, intent( in) :: xtype
integer, dimension(:), intent( in) :: dimids
integer, intent(out) :: varid
integer :: nf90_def_var_manydims
nf90_def_var_manydims = nf_def_var(ncid, name, xtype, size(dimids), dimids, varid)
end function nf90_def_var_manydims
! -----
function nf90_inq_varid(ncid, name, varid)
integer, intent( in) :: ncid
character (len = *), intent( in) :: name
integer, intent(out) :: varid
integer :: nf90_inq_varid
nf90_inq_varid = nf_inq_varid(ncid, name, varid)
end function nf90_inq_varid
! -----
function nf90_inquire_variable(ncid, varid, name, xtype, ndims, dimids, nAtts)
integer, intent( in) :: ncid, varid
character (len = *), optional, intent(out) :: name
integer, optional, intent(out) :: xtype, ndims
integer, dimension(:), optional, intent(out) :: dimids
integer, optional, intent(out) :: natts
integer :: nf90_inquire_variable
! Local variables
character (len = nf90_max_name) :: varname
integer :: externaltype, numdimensions
integer, dimension(nf90_max_var_dims) :: dimensionids
integer :: numattributes
nf90_inquire_variable = nf_inq_var(ncid, varid, varname, externaltype, &
numdimensions, dimensionids, numattributes)
if (nf90_inquire_variable == nf90_noerr) then
if(present(name)) name = trim(varname)
if(present(xtype)) xtype = externaltype
if(present(ndims)) ndims = numdimensions
if(present(dimids)) then
if (size(dimids) .ge. numdimensions) then
dimids(:numdimensions) = dimensionids(:numdimensions)
else
nf90_inquire_variable = nf90_einval
endif
endif
if(present(natts)) natts = numattributes
endif
end function nf90_inquire_variable
! -----
function nf90_rename_var(ncid, varid, newname)
integer, intent( in) :: ncid, varid
character (len = *), intent( in) :: newname
integer :: nf90_rename_var
nf90_rename_var = nf_rename_var(ncid, varid, newname)
end function nf90_rename_var
! -----

Return to the Main Unidata NetCDF page.