cf.Domain.get_data¶
-
Domain.
get_data
(default=ValueError(), _units=None, _fill_value=True)[source]¶ Return a default value when data is requested.
A
Domain
instance can never have data, so a default value must be returned if data is requested. This is useful for cases when it is not known in advance if aField
orDomain
instance is in use.New in version 3.11.0.
See also
- Parameters
- default: optional
Return the value of the default parameter.
If set to an
Exception
instance then it will be raised instead.- _units: optional
Ignored.
- _fill_value: optional
Ignored.
- Returns
The value of the default parameter, if an exception has not been raised.
Examples:
>>> d = cf.example_domain(0) >>> print(d.get_data(None)) None >>> d.get_data() Traceback (most recent call last): ... ValueError: Domain has no data