Bases: cf.utils.CfDict
Completely describe a field’s coordinate system (domain).
It contains the dimensions constructs, auxiliary coordinate constructs, cell measure constructs and transform constructs defined by the CF data model.
The domain is a dictionary-like object whose key/value pairs identify coordinate and cell measure constructs and store them as cf.Coordinate and cf.CellMeasure objects respectively.
It also has the following attributes:
Attribute | Description |
---|---|
dimension_sizes | The dimension constructs. |
dimensions | Map which dimensions relate to each component of the domain. |
transforms | The domain’s transform constructs stored as cf.Transform objects. |
Initialization
Parameters : |
|
---|
Examples
In this example, .... refers to the appropriate initializations of the coordinates, cell measure and transform, which are omitted here for clarity.
>>> dim_coordA = cf.Coordinate(....)
>>> dim_coordB = cf.Coordinate(....)
>>> dim_coordA.size, dim_coordB.size,
(73, 96)
>>> aux_coordA = cf.Coordinate(....)
>>> aux_coordA.shape
(96, 73)
>>> cell_measureA = cf.CellMeasure(....)
>>> cell_measureA.shape
(73, 96)
>>> transformA = cf.Transform(grid_mapping_name='latitude_longitude', ....)
>>> d = cf.Domain(dim0=dim_coordA, dim1=dim_coordB,
... aux0=aux_coordA,
... cm0=cell_measureA,
... trans0=transformA,
... dimensions={'aux0': ['dim1', 'dim0']}
... transform_map={'trans0': 'aux0'})
...
>>> d.dimensions
{'aux0': ['dim1', 'dim0'],
'cm0' : ['dim0', 'dim1'],
'dim1': ['dim1'],
'dim0': ['dim0']}
>>> d.transforms
{'trans0' : <CF Transform: latitude_longitude>}
Note that it was necessary to specifiy the dimension mapping for 'aux0' because the auxiliary coordinate doesn’t have the default dimension order of ['dim0', 'dim1']. Equivalent ways of initializing the same domain are as follows:
>>> d = cf.Domain(dims=[dim_coordA, dim_coordB],
... auxs=[aux_coordA],
... cms=cell_measureA,
... trans=transformA,
... dimensions={'aux0': ['dim1', 'dim0']}
... transform_map={'trans0': 'aux0'})
Here, note that we may specify an entry in the dimensions dictionary, even if the default behaviour aplies:
>>> d = cf.Domain(dims=[dim_coordA, dim_coordB],
... aux0=aux_coordA,
... cm0=cell_measureA,
... trans=transformA,
... dimensions={'aux0': ['dim1', 'dim0'],
... 'cm0' : ['dim0', 'dim1']},
... transform_map={'trans0': 'aux0'})
Here, the dimensions do not have default names ('dim0', 'dim1'), so it in this case it is necessary to specifiy all auxiliary coordinates and cell measures in the dimensions dictionary:
>>> d = cf.Domain(dim4=dim_coordA, dim12=dim_coordB,
... auxs=aux_coordA,
... cms=cell_measureA,
... trans=(transformA,),
... dimensions={'aux0': ['dim12', 'dim4'],
... 'cm0' : ['dim4', 'dim12']},
... transform_map={'trans0': 'aux0'})
In the last example, omitting the 'cm0' key from the dimensions dictionary would have been possible, but would have resulted in two new dimensions being created ('dim0', 'dim1' with sizes 73 and 96 respectively), which was not the intention in this case.
dimension_sizes | A dictionary mapping the domain’s dimensions to their sizes. |
dimensions | A dictionary mapping the domain’s components (including the field’s data array) to their dimensions. |
transforms | A dictionary-like storing the domain’s transforms. |
Undocumented methods behave exactly as their counterparts in a built-in dictionary.
analyse | |
aux_coords | Return a dictionary whose values are the auxiliary coordinates which span the given dimension and keys of the domain’s auxiliary coordinate identifiers. |
cell_measures | Return a dictionary whose values are the cell measures which span the given dimension and keys of the cell measure identifiers. |
clear | |
close | Close all referenced open data files. |
coord | Return a coordinate of the domain. |
coordinates | Return a dictionary mapping coordinate identifiers to their coordinates. |
copy | Return a deep copy. |
dim_coords | Return a dictionary whose values are the dimension coordinates which span the given dimension and keys of the domain’s dimension coordinate identifiers. |
direction | Return True if a dimension is increasing, otherwise return False. |
dump | Return a string containing a full description of the domain. |
equals | True if two domains are equal, False otherwise. |
expand_dims | Expand the domain with a new dimension in place. |
get | |
get_keys | Return a list of the key names which match a regular expression. |
has_key | Return true if and only if the dictionary contains the given key. |
insert_aux_coordinate | Insert a new auxiliary coordinate into the domain in place, preserving internal consistency. |
insert_cell_measure | Insert a new cell measure into the domain in place, preserving internal consistency. |
insert_dim_coordinate | Insert a new dimension coordinate to the domain in place, preserving internal consistency. |
insert_dimension | Insert a new dimension to the domain in place, preserving internal consistency. |
insert_transform | Insert a new transform into the domain in place, preserving internal consistency. |
items | |
itercell_measures | asdasdasdasdasdas |
itercoordinates | asdasdasdasdasdas |
iteritems | |
iterkeys | |
itervalues | |
keys | |
map_dims | Map the dimensions of two domains. |
new_auxiliary_identifier | Return a new |
new_cell_measure_identifier | Return a new |
new_dimension_identifier | Return a new, unique dimension identifier for the domain. |
new_transform_identifier | Return a new |
pop | Remove specified key from the domain in-place and return the corresponding value. |
popitem | |
remove_cell_measure | Remove a cell measure from the domain in place, preserving internal consistency. |
remove_coordinate | Remove a coordinate from the domain in place, preserving internal consistency. |
remove_dimension | Remove a dimension from the domain in place, preserving internal consistency. |
remove_transform | Remove a transform from the domain in place, preserving internal consistency. |
setdefault | |
squeeze | Remove a size 1 dimension from the domain in place. |
update | |
values |