cf.List.match_by_ncvar

List.match_by_ncvar(*ncvars)[source]

Whether or not the construct has a netCDF variable name.

New in version 3.0.0.

Parameters:
ncvars: optional

Define one or more conditions on the netCDF variable name.

A netCDF variable name is specified by a string (e.g. 'lat'), etc.); a Query object (e.g. cf.eq('lon')); or a compiled regular expression (e.g. re.compile('^t')) that is compared with the construct’s netCDF variable name via re.search.

The condition is satisfied if the netCDF variable name, as returned by the nc_get_variable method, exists and equals the condition value.

Returns:
bool

Whether or not at least one of the conditions are met.

Examples:

>>> f.match_by_ncvar('t')
>>> f.match_by_ncvar(re.compile('^t'))
>>> f.match_by_ncvar('t', 'time')