cf.CellMeasure.identity

CellMeasure.identity(default='', strict=None, relaxed=False, nc_only=False, relaxed_identity=None)[source]

Return the canonical identity.

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

  • The measure attribute, preceeded by 'measure:'.

  • The standard_name property.

  • The id attribute, preceeded by 'id%'.

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

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

  • The value of the default parameter.

New in version 3.0.0.

Parameters
default: optional

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

strict: bool, optional

If True then the identity is the first found of only the “measure” arttribute, “standard_name” property or the “id” attribute.

relaxed: bool, optional

If True then the identity is the first found of only the “measure” arttribute, the “standard_name” property, the “id” attribute, the “long_name” property or the netCDF variable name.

nc_only: bool, optional

If True then only take the identity from the netCDF variable name.

Returns

The identity.

Examples:

>>> c.measure
'area'
>>> c.properties()
{'long_name': 'cell_area',
 'foo': 'bar'}
>>> c.nc_get_variable()
'areacello'
>>> c.identity()
'measure:area'
>>> del c.measure
>>> c.identity()
'long_name=cell_area'
>>> del c.long_name
>>> c.identity()
'ncvar%areacello'
>>> c.nc_del_variable()
'areacello'
>>> c.identity()
''
>>> c.identity('no identity')
'no identity'