cf.Field.copy¶

Field.copy(data=True)[source]

Return a deep copy of the field construct.

f.copy() is equivalent to copy.deepcopy(f).

Arrays within Data instances are copied with a copy-on-write technique. This means that a copy takes up very little extra memory, even when the original contains very large data arrays, and the copy operation is fast.

New in version 1.7.0.

Parameters: data: bool, optional If False then do not copy the data field construct, nor that of any of its metadata constructs. By default all data are copied. The deep copy.

Examples:

>>> g = f.copy()
>>> g = f.copy(data=False)
>>> g.has_data()
False