cf.Coordinate.name

Coordinate.name(default=None)[source]

Return a name for the variable.

Returns the the first found of:

  • The variable’s identity.
  • The long_name CF property, preceeded by the string 'long_name:.
  • The ncvar attribute, preceeded by the string 'ncvar:.

If none of these are found then the value of the default parameter is returned.

Parameters :
default : str, optional

If no name can be found then return the value of the default parameter. By default the default is None.

Returns :
out : str

A name for the variable.

Examples

>>> f.standard_name = 'air_temperature'
>>> f.long_name = 'temperature of the air'
>>> f.ncvar = 'tas'
>>> f.name()
'air_temperature'
>>> del f.standard_name
>>> f.name()
'long_name:temperature of the air'
>>> del f.long_name
>>> f.name()
'ncvar:tas'
>>> del f.ncvar
>>> f.name()
None
>>> f.name('no_name')
'no_name'
>>> f.standard_name = 'air_temperature'
>>> f.name('no_name')
'air_temperature'

Previous topic

cf.Coordinate.match

Next topic

cf.Coordinate.override_units

This Page