cf.Quantization.creation_commands¶
- Quantization.creation_commands(namespace=None, indent=0, string=True, name='p', header=True)[source]¶
Return the commands that would create the component.
Added in version (cfdm): 1.12.2.0
See also
- Parameters:
- 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 asimport cf
.- Parameter example:
If cf was imported as
import cf as xyz
then setnamespace='xyz'
- Parameter example:
If cf was imported as
from cf import *
then setnamespace=''
- 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
Quantization
instance created by the returned commands.- header:
bool
, optional If True (the default) output a comment describing the components. If False no such comment is returned.
- namespace:
- Returns:
Examples
>>> x = cf.Quantization({'algorithm': 'granular_bitround'}) >>> x.nc_set_variable('var') >>> print(x.creation_commands(header=False)) p = cf.Quantization() p.set_parameters({'algorithm': 'granular_bitround'}) p.nc_set_variable('var')