obspy.core.event.base.QuantityError.__nonzero__

QuantityError.__nonzero__()

Boolean testing for QuantityError.

QuantityError evaluates True if any of the default fields is not None. Setting non default fields raises also an UserWarning which is the reason we have to skip those lines in the doctest below.

>>> err = QuantityError()
>>> bool(err)
False
>>> err.custom_field = "spam"  
>>> bool(err)
False
>>> err.uncertainty = 0.05
>>> bool(err)
True
>>> del err.custom_field  
>>> bool(err)
True