# cf.Data.creation_commands¶

Data.creation_commands(name='data', namespace=None, indent=0, string=True)[source]

Return the commands that would create the data object.

New in version (cfdm): 1.8.7.0

Parameters
name: str or None, optional

Set the variable name of Data object that the commands create.

namespace: str, optional

The name space containing classes of the cf package. This is prefixed to the class name in commands that instantiate instances of cf objects. By default, or if None, the name space is assumed to be consistent with cf being imported as import cf.

Parameter example:

If cf was imported as import cf as xyz then set namespace='xyz'

Parameter example:

If cf was imported as from cf import * then set namespace=''

indent: int, optional

Indent each line by this many spaces. By default no indentation is applied. Ignored if string is False.

string: bool, optional

If False then return each command as an element of a list. By default the commands are concatenated into a string, with a new line inserted between each command.

Returns
str or list

The commands in a string, with a new line inserted between each command. If string is False then the separate commands are returned as each element of a list.

Examples:

>>> d = cf.Data([[0.0, 45.0], [45.0, 90.0]],
...                           units='degrees_east')
>>> print(d.creation_commands())
data = cf.Data([[0.0, 45.0], [45.0, 90.0]], units='degrees_east', dtype='f8')

>>> d = cf.Data(['alpha', 'beta', 'gamma', 'delta'],
...                           mask = [1, 0, 0, 0])
>>> d.creation_commands(name='d', namespace='', string=False)
["d = Data(['', 'beta', 'gamma', 'delta'], dtype='U5', mask=Data([True, False, False, False], dtype='b1'))"]