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
measureattribute, preceeded by'measure:'. - The
standard_nameproperty. - The
idattribute, preceeded by'id%'. - The
long_nameproperty, preceeded by'long_name='. - The netCDF variable name, preceeded by
'ncvar%'. - The value of the default parameter.
New in version 3.0.0.
See also
id,identities,long_name,measure,nc_get_variable,standard_nameParameters: - default: optional
If no identity can be found then return the value of the default parameter.
- strict:
bool, optional If True then only take the identity from the “measure” arttribute, the “standard_name” property or the “id” attribute, in that order.
- relaxed:
bool, optional If True then only take the identity from the “measure” arttribute, the “standard_name” property, the “id” attribute, the “long_name” property or netCDF variable name, in that order.
- 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'
- The