cf.Field.select

Field.select(match=None, cvalue={}, csize={}, rank=None, exact=False, match_all=True, regex=False, inverse=False)[source]

Return the field if it satisfies the given conditions.

The conditions are defined in the same manner as for cf.Field.match, which tests whether or not a field satisfies the given conditions.

f.select(**kwargs) is equivalent to f if f.match(**kwargs) else cf.FieldList().

Parameters :
match : optional

Set conditions on field property values. See the match parameter of cf.Field.match for details.

cvalue : dict, optional

A dictionary which identifies field coordinate objects with corresponding tests on their data array values. See the cvalue parameter of cf.Field.match for details.

csize : dict, optional

A dictionary which identifies field coordinate objects with corresponding tests on their cell sizes. See the csize parameter of cf.Field.match for details.

rank : int or cf.Comparison, optional

Specify a condition on field domain rank, where the domain rank is the number of domain axes. See the rank parameter of cf.Field.match for details.

exact : bool, optional

The exact argument applies to the interpretion of particular conditions given by values of the match argument and by keys of the cvalue and csize arguments. See the exact parameter of cf.Field.match for details.

match_all : bool, optional

The match_all argument applies to the interpretion of all conditions (properties, coordinate object values, coordinate object cell sizes, domain rank and data array rank). See the match_all parameter of cf.Field.match for details.

regex : bool, optional

The regex argument applies to the interpretion of string-valued conditions. See the regex parameter of cf.Field.match for details.

inverse : bool, optional

If True then return the field if it does not satisfy the given conditions. By default an empty field list is returned if it satisfies the given conditions.

Returns :
out : cf.Field or cf.FieldList

If the field matches the given conditions then it is returned as an object identity. Otherwise an empty field list is returned.

See also

match

Examples

Select the field if has exactly four domain axes:

>>> f.select(rank=4)

See cf.Field.match for further examples.

Previous topic

cf.Field.roll

Next topic

cf.Field.setattr

This Page