cf.Query.setdefault

Query.setdefault(rtol=None, atol=None)[source]

Set condition parameters in-place that are not already set.

For compound queries the parameters are set recursively on the constituent conditions.

New in version 3.15.2.

See also

atol, rtol

Parameters
rtol: number, optional

Only applicable to the 'isclose' operator and ignore for all other operators. Set the given tolerance on relative numerical differences, unless already set. Ignored if None.

atol: number, optional

Only applicable to the 'isclose' operator and ignore for all other operators. Set the given tolerance on absolute numerical differences, unless already set. Ignored if None.

Returns

None

Examples

>>> q = cf.isclose(9)
>>> q
<CF Query: (isclose 9)>
>>> q.setdefault(rtol=1e-5, atol=1e-08)
<CF Query: (isclose 9 rtol=1e-05 atol=1e-08)>
>>> q = cf.isclose(9, rtol=9e-9)
>>> q.setdefault(rtol=1e-5, atol=1e-08)
>>> q
<CF Query: (isclose 9 rtol=9e-09 atol=1e-08)>
>>> q = cf.lt(9) & (cf.eq(1) | cf.isclose(4, rtol=9e-9))
>>> q
<CF Query: [(lt 9) & [(eq 1) | (isclose 4 rtol=9e-09)]]>
>>> q.setdefault(rtol=1e-5, atol=1e-08)
>>> q
<CF Query: [(lt 9) & [(eq 1) | (isclose 4 rtol=9e-09 atol=1e-08)]]>