cf.Field.domain_axis_position¶
-
Field.
domain_axis_position
(identity)[source]¶ Return the position in the data of a domain axis construct.
New in version 3.0.0.
See also
- Parameters
- identity:
Select the domain axis construct by one of:
An identity or key of a 1-d coordinate construct that whose data spans the domain axis construct.
A domain axis construct identity or key.
The position of the domain axis construct in the field construct’s data.
A construct identity is specified by a string (e.g.
'latitude'
,'long_name=time'
,'ncvar%lat'
, etc.); or a compiled regular expression (e.g.re.compile('^atmosphere')
) that selects the relevant constructs whose identities match viare.search
.Each construct has a number of identities, and is selected if any of them match any of those provided. A construct’s identities are those returned by its
identities
method. In the following example, the constructx
has six identities:>>> x.identities() ['time', 'long_name=Time', 'foo=bar', 'standard_name=time', 'ncvar%t', 'T']
A construct key may optionally have the
'key%'
prefix. For example'dimensioncoordinate2'
and'key%dimensioncoordinate2'
are both acceptable keys.A position of a domain axis construct in the field construct’s data is specified by an integer index.
Note that in the output of a
print
call ordump
method, a construct is always described by one of its identities, and so this description may always be used as an identity argument.- Parameter example:
identity='long_name=Latitude'
- Parameter example:
identity='dimensioncoordinate1'
- Parameter example:
identity='domainaxis2'
- Parameter example:
identity='key%domainaxis2'
- Parameter example:
identity='ncdim%y'
- Parameter example:
identity=2
- Returns
int
The position in the field construct’s dat of the selected domain axis construct.
Examples:
>>> f <CF Field: air_temperature(time(12), latitude(64), longitude(128)) K> >>> f.get_data_axes() ('domainaxis0', 'domainaxis1', 'domainaxis2') >>> f.domain_axis_position('T') 0 >>> f.domain_axis_position('latitude') 1 >>> f.domain_axis_position('domainaxis1') 1 >>> f.domain_axis_position(2) 2 >>> f.domain_axis_position(-2) 1