cf.List.creation_commands¶
- List.creation_commands(representative_data=False, namespace=None, indent=0, string=True, name='c', data_name='data', quantization_name='q', header=True)[source]¶
- Return the commands that would create the construct. - Added in version (cfdm): 1.8.7.0 - Parameters:
- representative_data: bool, optional
- Return one-line representations of - Datainstances, which are not executable code but prevent the data being converted in its entirety to a string representation.
- 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 xyzthen 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.
- name: str, optional
- The name of the - Listinstance created by the returned commands.
- data_name: str, optional
- The name of the construct’s - Datainstance created by the returned commands.
- quantization_name: str, optional
- The name of the construct’s - Quantizationinstance created by the returned commands.- Added in version (cfdm): 1.12.2.0 
- header: bool, optional
- If True (the default) output a comment describing the components. If False no such comment is returned. 
 
- representative_data: 
- Returns:
 - Examples - >>> x = cf.List( ... properties={'units': 'Kelvin', ... 'standard_name': 'air_temperature'} ... ) >>> x.set_data([271.15, 274.15, 280]) >>> print(x.creation_commands(header=False)) c = cf.List() c.set_properties({'units': 'Kelvin', 'standard_name': 'air_temperature'}) data = cf.Data([271.15, 274.15, 280.0], units='Kelvin', dtype='f8') c.set_data(data) 
 
 
 
