cf.Field.get_data

Field.get_data(default=ValueError(), _units=None, _fill_value=True)[source]

Return the data.

Note that a Data instance is returned. Use its array attribute to return the data as an independent numpy array.

The units, calendar and fill value properties are, if set, inserted into the data.

New in version 1.7.0.

Parameters
default: optional

Return the value of the default parameter if data have not been set.

If set to an Exception instance then it will be raised instead.

_units: optional

Ignored.

_fill_value: optional

Returns

The data.

Examples

>>> d = cf.Data(range(10))
>>> f.set_data(d)
>>> f.has_data()
True
>>> f.get_data()
<CF Data(10): [0, ..., 9]>
>>> f.del_data()
<CF Data(10): [0, ..., 9]>
>>> f.has_data()
False
>>> print(f.get_data(None))
None
>>> print(f.del_data(None))
None