cfdm.core.Field.set_data

Field.set_data(data, axes, copy=True)[source]

Set the data of the field construct.

The units, calendar and fill value properties of the data object are removed prior to insertion.

New in version 1.7.0.

Parameters:
data: Data

The data to be inserted.

axes: (sequence of) str, or None

The identifiers of the domain axes spanned by the data array. If None then the data axes are not set.

The axes may also be set afterwards with the set_data_axes method.

Parameter example:

axes=['domainaxis2']

Parameter example:

axes='domainaxis2'

Parameter example:

axes=['domainaxis2', 'domainaxis1']

Parameter example:

axes=None

copy: bool, optional

If False then do not copy the data prior to insertion. By default the data are copied.

Returns:

None

Examples:

Set the domain axis constructs spanned by the data of the field construct:

>>> d
<Data(10, 9): [[23.6, ..., 76.8]]>
>>> f.set_data(d, axes=['domainaxis0', 'domainaxis1'])