cfdm.Domain.identity

Domain.identity(default='')[source]

Return the canonical identity.

By default the identity is the first found of the following:

  • The cf_role property, preceded by 'cf_role='.

  • The long_name property, preceded by 'long_name='.

  • The netCDF variable name, preceded by 'ncvar%'.

  • The value of the default parameter.

New in version (cfdm): 1.9.0.0

See also

identities

Parameters
default: optional

If no identity can be found then return the value of the default parameter.

Returns

The identity.

Examples:

>>> d = cfdm.Domain()
>>> d.set_properties({'foo': 'bar',
...                   'long_name': 'Domain for model'})
>>> d.nc_set_variable('dom1')
>>> d.identity()
'long_name=Domain for model'
>>> d.del_property('long_name')
'long_name=Domain for model'
>>> d.identity(default='no identity')
'ncvar%dom1'
>>> d.identity()
'ncvar%dom1'
>>> d.nc_del_variable()
'dom1'
>>> d.identity()
''
>>> d.identity(default='no identity')
'no identity'