cf.CfDict

class cf.CfDict(*args, **kwargs)

Bases: _abcoll.MutableMapping

A dictionary-like object with attributes.

Initialization

Parmaters :
*args, **kwargs:

Keys and values are initialized exactly as for a built-in dict.

copy()

Return a deep copy.

Equivalent to copy.deepcopy(x)

Returns :
out :

The deep copy.

Examples

>>> x.copy()
equals(other, rtol=None, atol=None)

Return True if two instances are congruent in that they have

  1. Equal sets of keys.
  2. For each key, the two values are equal.
  3. Both instances have equal attributes.

Equality of numbers is to within a tolerance. Refer to cf for details.

Parameters:
  • other (object) – The variable to compare against for equality.
  • atol (None or float) – Optional. If None then use the default method for setting the absolute tolerance for equality of real numbers (refer to cf for details). If a float then set the absolute tolerance to this value for all comparisons (refer to the override parameter).
  • rtol (None or float) – Optional. If None then use the default method for setting the relative tolerance for equality of real numbers (refer to cf for details). If a float then set the relative tolerance to this value for all comparisons (refer to the override parameter).
Returns:

True if the two objects are congruent, False otherwise.

get_keys(regex=None)

Return a list of the cf dictionary’s key names which match the given regular expression.

Parameters:regex (str) – Optional. The regular expression with which to identify key names.
Returns:A list of keys names.

Examples

>>> d.keys()
['dim2', 'dim0', 'dim1', 'aux0', 'cm0']
>>> d.get_keys()
['dim2', 'dim0', 'dim1', 'aux0', 'cm0']
>>> d.get_keys('dim')
['dim2', 'dim0', 'dim1']
>>> d.get_keys('^aux|^dim')
['dim2', 'dim0', 'dim1', 'aux0']
>>> d.get_keys('dim[123]')
['dim2', 'dim1']
has_key(k) → True if CFD has a key k, else False

Previous topic

cf.CfList

Next topic

cf.Variable

This Page