cf.FieldList.select_by_ncvar

FieldList.select_by_ncvar(*rank)[source]

Select field constructs by netCDF variable name.

To find the inverse of the selection, use a list comprehension with match_by_ncvar method of the field constucts. For example, to select all field constructs which do not have a netCDF name of ‘tas’:

>>> gl = cf.FieldList(f for f in fl if not f.match_by_ncvar('tas'))

New in version 3.0.0.

Parameters:
ncvars: optional

Select field constructs. May be one or more:

  • The netCDF name of a field construct.

A field construct is selected if it matches any of the given names.

A netCDF variable name is specified by a string (e.g. 'tas', etc.); a Query object (e.g. cf.eq('tas')); or a compiled regular expression (e.g. re.compile('^air_')) that selects the field constructs whose netCDF variable names match via re.search.

If no netCDF variable names are provided then all field are selected.

Returns:
FieldList

The matching field constructs.

Examples:

TODO