cf.DomainAncillary.identity¶
-
DomainAncillary.
identity
(*args, **kwargs)[source]¶ Return the canonical identity.
By default the identity is the first found of the following:
The “standard_name” property.
The “id” attribute, preceded by
'id%'
.The “cf_role” property, preceded by
'cf_role='
.The “axis” property, preceded by
'axis='
.The “long_name” property, preceded by
'long_name='
.The netCDF variable name, preceded by
'ncvar%'
.The coordinate type (
'X'
,'Y'
,'Z'
or'T'
).The value of the default parameter.
If no identity can be found on the construct then the identity is taken from the bounds, if present (with the exception of the bounds netCDF variable name).
See also
- 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 “standard_name” property or the “id” attribute.
- relaxed:
bool
, optional If True then the identity is the first found of only 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:
>>> f.properties() {'foo': 'bar', 'long_name': 'Air Temperature', 'standard_name': 'air_temperature'} >>> f.nc_get_variable() 'tas' >>> f.identity() 'air_temperature' >>> f.del_property('standard_name') 'air_temperature' >>> f.identity(default='no identity') 'air_temperature' >>> f.identity() 'long_name=Air Temperature' >>> f.del_property('long_name') >>> f.identity() 'ncvar%tas' >>> f.nc_del_variable() 'tas' >>> f.identity() 'ncvar%tas' >>> f.identity() '' >>> f.identity(default='no identity') 'no identity'
>>> f.properties() {} >>> f.bounds.properties() {'axis': 'Z', 'units': 'm'} >>> f.identity() 'axis=Z'