cf.Constructs.filter_by_ncvar¶
-
Constructs.
filter_by_ncvar
(*ncvars, todict=False, cached=None)[source]¶ Select domain axis constructs by netCDF variable name.
New in version (cfdm): 1.7.0
See also
filter
,filters_applied
,inverse_filter
,clear_filters_applied
,unfilter
- Parameters
- ncvars: optional
Select constructs that have a netCDF variable name, defined by their
nc_get_variable
methods, that match any of the given values.If no netCDF variable names are provided then all constructs that do or could have a netCDF variable name are selected.
A value may be any object that can match via the
==
operator, or are.Pattern
object that matches via itssearch
method.- todict:
bool
, optional If True then return a dictionary of constructs keyed by their construct identifiers, instead of a
Constructs
object. This is a faster option.New in version (cfdm): 1.8.9.0
- cached: optional
If any value other than
None
then return cached without selecting any constructs.New in version (cfdm): 1.8.9.0
- Returns
Constructs
ordict
or cachedThe selected constructs, or a cached valued.
Examples:
Select the constructs with netCDF variable name ‘time’:
>>> d = c.filter_by_ncvar('time')
Select the constructs with netCDF variable name ‘time’ or ‘lat’:
>>> d = c.filter_by_ncvar('time', 'lat')