cf.CoordinateReference.creation_commands¶
-
CoordinateReference.creation_commands(namespace=None, indent=0, string=True, name='c', header=True)[source]¶ Returns the commands to create the coordinate reference.
New in version (cfdm): 1.8.7.0
- 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 xyzthen 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.- header:
bool, optional If True (the default) output a comment describing the components. If False no such comment is returned.
- name:
str, optional The name of the
CoordinateReferenceinstance created by the returned commands.- Parameter example:
name='var1'
- 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.CoordinateReference( ... coordinates=['dimensioncoordinate0'] ... ) >>> x.datum.set_parameter('earth_radius', 6371007) >>> x.coordinate_conversion.set_parameters( ... {'standard_name': 'atmosphere_hybrid_height_coordinate', ... 'computed_standard_name': 'altitude'} ... ) >>> x.coordinate_conversion.set_domain_ancillaries( ... {'a': 'domainancillary0', ... 'b': 'domainancillary1', ... 'orog': 'domainancillary2'} ... ) >>> print(x.creation_commands(header=False)) c = cf.CoordinateReference() c.set_coordinates({'dimensioncoordinate0'}) c.datum.set_parameter('earth_radius', 6371007) c.coordinate_conversion.set_parameter('standard_name', 'atmosphere_hybrid_height_coordinate') c.coordinate_conversion.set_parameter('computed_standard_name', 'altitude') c.coordinate_conversion.set_domain_ancillaries({'a': 'domainancillary0', 'b': 'domainancillary1', 'orog': 'domainancillary2'})