cfdm.AuxiliaryCoordinate.creation_commands¶
-
AuxiliaryCoordinate.
creation_commands
(representative_data=False, namespace=None, indent=0, string=True, name='c', data_name='data', bounds_name='b', interior_ring_name='i', header=True)[source]¶ Return the commands that would create the construct.
New in version (cfdm): 1.8.7.0
- Parameters
- representative_data:
bool
, optional Return one-line representations of
Data
instances, 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 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 asimport cfdm
.- Parameter example:
If cfdm was imported as
import cfdm as xyz
then setnamespace='xyz'
- Parameter example:
If cfdm was imported as
from cfdm 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
AuxiliaryCoordinate
instance created by the returned commands.- Parameter example:
name='var1'
- data_name:
str
, optional The name of the construct’s
Data
instance created by the returned commands.- Parameter example:
name='data1'
- bounds_name:
str
, optional The name of the construct’s
Bounds
instance created by the returned commands.- Parameter example:
name='bounds1'
- interior_ring_name:
str
, optional The name of the construct’s
InteriorRing
instance created by the returned commands.- Parameter example:
name='ir1'
- 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 = cfdm.AuxiliaryCoordinate( ... properties={'units': 'degrees_east', ... 'standard_name': 'longitude'} ... ) >>> x.set_data([22.5, 67.5, 112.5]) >>> b = cfdm.Bounds() >>> b.set_data([[0.0, 45.0], [45.0, 90.0], [90.0, 135.0]]) >>> x.set_bounds(b) >>> print(x.creation_commands(header=False)) c = cfdm.AuxiliaryCoordinate() c.set_properties({'units': 'degrees_east', 'standard_name': 'longitude'}) data = cfdm.Data([22.5, 67.5, 112.5], units='degrees_east', dtype='f8') c.set_data(data) b = cfdm.Bounds() data = cfdm.Data([[0.0, 45.0], [45.0, 90.0], [90.0, 135.0]], units='degrees_east', dtype='f8') b.set_data(data) c.set_bounds(b)