cfdm.DimensionCoordinate.set_data¶
-
DimensionCoordinate.
set_data
(data, copy=True, inplace=True)[source]¶ Set the data.
The units, calendar and fill value of the incoming
Data
instance are removed prior to insertion.New in version (cfdm): 1.7.0
- Parameters
- data: data_like
The data to be inserted. Must be 1-dimensional, i.e. scalar or multidimensional data is not allowed.
A data_like object is any object that can be converted to a
Data
object, i.e.numpy
array_like objects,Data
objects, and cfdm instances that containData
objects.- copy:
bool
, optional If True (the default) then copy the data prior to insertion, else the data is not copied.
- inplace:
bool
, optional: If True (the default) then do the operation in-place and return
None
. If False a new, modifiedDimensionCoordinate
instance is returned.New in version (cfdm): 1.8.7.0
- Returns
None
orDimensionCoordinate
If the operation was in-place then
None
is returned, otherwise return a newDimensionCoordinate
instance containing the new data.
Examples
>>> d = cfdm.Data(range(10)) >>> f.set_data(d) >>> f.has_data() True >>> f.get_data() <Data(10): [0, ..., 9]> >>> f.del_data() <Data(10): [0, ..., 9]> >>> f.has_data() False >>> print(f.get_data(None)) None >>> print(f.del_data(None)) None