CellMethod.creation_commands(namespace=None, indent=0, string=True, name='c', header=True)[source]

Returns the commands to create the cell method construct.

New in version (cfdm):

namespace: str, optional

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

Parameter example:

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

Parameter example:

If cfdm was imported as from cfdm 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.

name: str, optional

The name of the CellMethod instance created by the returned commands.

Parameter example:


header: bool, optional

If True (the default) output a comment describing the components. If False no such comment is returned.

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.


>>> x = cfdm.CellMethod(
...     axes=['area'],
...     qualifiers={'over': 'land'}
... )
>>> print(x.creation_commands(header=False))
c = cfdm.CellMethod()
c.set_qualifier('over', 'land')