cfdm.core.Field.has_data¶
-
Field.
has_data
()[source]¶ Whether or not the construct has data.
New in version (cfdm): 1.7.0
- Returns
bool
True if data have been set, otherwise False.
Examples
>>> f = cfdm.core.Field() >>> 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