cfdm.CellMeasure.get_data¶
- CellMeasure.get_data(default=ValueError(), _units=True, _fill_value=True)[source]¶
Return the data.
Note that a
Datainstance is returned. Use itsarrayattribute to return the data as an independentnumpyarray.The units, calendar and fill value properties are, if set, inserted into the data.
Added in version (cfdm): 1.7.0
See also
- Parameters:
- default: optional
Return the value of the default parameter if data have not been set.
If set to an
Exceptioninstance then it will be raised instead.
- Returns:
DataThe data.
Examples
>>> f = cfdm.CellMeasure() >>> f.set_data([1, 2, 3]) >>> f.has_data() True >>> f.get_data() <Data(3): [1, 2, 3]> >>> f.data <Data(3): [1, 2, 3]> >>> f.del_data() <Data(3): [1, 2, 3]> >>> g = f.set_data([4, 5, 6], inplace=False) >>> g.data <Data(3): [4, 5, 6]> >>> f.has_data() False >>> print(f.get_data(None)) None >>> print(f.del_data(None)) None