.. highlightlang:: us .. _nc_vardef: nc_vardef ========= .. index:: nc_vardef .. us.tag nc_vardef ENGLISH NC_Var :ref:`nc_vardef` adds a new variable to an open netCDF file in define mode. .. function:: varid = nc_vardef(ncid, ssName, nDataType, rvDimids) .. us.return **Return Value** *varid* is the ID of the variable. If a error occurs, *varid* is -1. .. us.params **Parameters** .. uparam:: ncid Identifies the netCDF file. .. uparam:: ssName *ssName* is the name of the variable. Must begin with an alphabetic character or an underscore, followed by zero or more alphanumeric characters including the underscore (``_``) or numbers. Channel names may contain the following special characters: ``.``, ``-``, ``+``, ``$``, ``#``, ``~``, ``!``, ``^``, ``&``, ``%``. Case is significant. .. uparam:: nDataType *nDataType* is the data type of the variable and is one of the following: ``NC_BYTE``, ``NC_CHAR``, ``NC_SHORT``, ``NC_LONG``, ``NC_FLOAT``, ``NC_DOUBLE``. .. uparam:: rvDimids *rvDimids* is vector of dimension ID's and defines the shape of a netCDF variable. .. seealso:: :ref:`overview-netcdf-files`, :ref:`nc_create` :sub:`id-1963459`