cfdm.CoordinateReference.nc_get_variable

CoordinateReference.nc_get_variable(default=ValueError())[source]

Return the netCDF variable name.

New in version (cfdm): 1.7.0

Parameters
default: optional

Return the value of the default parameter if the netCDF variable name has not been set. If set to an Exception instance then it will be raised instead.

Returns
str

The netCDF variable name. If unset then default is returned, if provided.

Examples:

>>> f.nc_set_variable('tas')
>>> f.nc_has_variable()
True
>>> f.nc_get_variable()
'tas'
>>> f.nc_del_variable()
'tas'
>>> f.nc_has_variable()
False
>>> print(f.nc_get_variable(None))
None
>>> print(f.nc_del_variable(None))
None