cf.Data.creation_commands¶
-
Data.
creation_commands
(name='data', namespace='cf', string=True)[source]¶ Return the commands that would create the data object.
Parameters: - name:
str
, optional Set the name of
Data
object that the commands create.- namespace:
str
, optional The namespace containing the cf package classes. By default it is assumed that
cf
was imported asimport cf
.- Parameter example:
If
cf
was imported asimport cf as cfp
then setnamespace='cfp'
- Parameter example:
If
cf
was imported asfrom cf import *
then setnamespace=''
- string:
bool
, optional Return each command an element of a
list
. By default the the commands are concatenated into a string.
Returns: Examples:
>>> d <CF Data(3, 2): [[0.0, ..., 135.0]]] 'degrees_east'> >>> print(d.array) [[ 0. 45.] [ 45. 90.] [ 90. 135.]] >>> print(d.creation_commands()) data = cf.Data([[0.0, 45.0], [45.0, 90.0], [90.0, 135.0]], units='degrees_east', dtype='f8')
>>> print(d.array) [-- 'beta' 'gamma' 'delta' 'epsilon'] >>> d.creation_commands(name='d', package='', string=0) ["d = Data(['', 'beta', 'gamma', 'delta', 'epsilon'], dtype='S7')", "d_mask = Data([True, False, False, False, False], dtype='b1')", 'd.where(d_mask, masked, inplace=True)']
- name: