Bases: object
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 dimension coordinate, auxiliary coordinate and cell measure constructs and store them as cf.DimensionCoordinate, cf.AuxiliaryCoordinate and cf.CellMeasure objects respectively.
Initialization
Note
cf.DimensionCoordinate, cf.AuxiliaryCoordinate and cf.Coordinate objects may almost always be used interchangably in the initialization, but there may be performance improvements if the appropriate type is provided.
Parameters : |
|
---|
Examples
In this example, four dots (....) refers to appropriate initializations of the coordinate, cell measure and transform constructs, which are omitted here for clarity.
>>> dim_coord_A = cf.DimensionCoordinate(....)
>>> dim_coord_B = cf.DimensionCoordinate(....)
>>> dim_coord_A.size
73
>>> dim_coord_B.size
96
>>> aux_coord_A = cf.AuxiliaryCoordinate(....)
>>> aux_coord_A.shape
(96, 73)
>>> cell_measure_A = cf.CellMeasure(....)
>>> cell_measure_A.shape
(73, 96)
>>> transform_A = cf.Transform(name='latitude_longitude', ....)
>>> d = cf.Domain(dim=(dim_coord_A, dim_coord_B),
... aux=aux_coordA,
... cm=[cell_measure_A],
... trans=transform_A,
... assign_axes={'aux0': ['dim1', 'dim0']})
...
>>> d.dimensions
{'aux0': ['dim1', 'dim0'],
'cm0' : ['dim0', 'dim1'],
'dim1': ['dim1'],
'dim0': ['dim0']}
>>> d.transforms
{'trans0' : <CF Transform: latitude_longitude>}
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(dim=[dim_coordA, dim_coordB],
... aux=aux_coordA,
... cm=cell_measureA,
... trans=transformA,
... assign_axes={'aux0': ['dim1', 'dim0']}
... transform_map={'trans0': 'aux0'})
Note that we may (for clarity) specify an entry in the dimensions dictionary, even if the default behaviour aplies:
>>> d = cf.Domain(dim={'dim1': dim_coord_B, 'dim0': dim_coord_A},
... aux0={'aux0': aux_coord_A},
... cm0={'cm0': cell_measure_A},
... trans={'trans0': transform_A},,
... assign_axes={'aux0': ['dim1', 'dim0'],
... 'cm0' : ['dim0', 'dim1']})
We may change default identifier names:
>>> d = cf.Domain(dim=[dim_coord_A, dim_coord_B],
... aux={'aux5': aux_coord_A},
... cm=[cell_measureA],
... trans=transform_A,
... assign_axes={'aux5': ['dim1', 'dim0']})
>>> d = cf.Domain(dim={'dim21': dim_coord_A, 'dim3': dim_coord_B},
... aux={'aux5': aux_coord_A},
... cm=cell_measureA,
... trans=[transform_A],
... assign_axes={'aux5': ['dim3' , 'dim21'],
... 'cm0' : ['dim21', 'dim3']})
In the last case it was necessary to include the cell measure construct in the dimension map because we had altered the default dimension names. If we had not included 'cm0' in the dimension map then the cell measure’s dimension would have initialized by the default values ['dim0', 'dim1'] and these two new axes would have created in addition to 'dim21', and 'dim3'.
analyse | |||
attach_to_transform | Attach a coordinate construct to a transform. | ||
axes | Return domain axis identifiers. | ||
axis | Return a domain axis identifier. | ||
axis_name | Return the canonical name for an axis. | ||
close | Close all referenced open data files. | ||
copy | Return a deep copy. | ||
data_axes | Return the axes of the field’s data array. | ||
direction | Return True if an axis is increasing, otherwise return False. | ||
directions | Return a dictionary mapping axes to their directions. | ||
dump | Return a string containing a full description of the domain. | ||
dump_axes | Return a string containing a description of the domain. | ||
dump_components | Return a string containing a full description of the domain. | ||
cf.Domain.equal_transform | |||
equals | True if two domains are equal, False otherwise. | ||
equivalent | True if and only if two domains are logically equivalent. | ||
equivalent_transform |
|
||
expand_dims | Expand the domain with a new dimension in place. | ||
cf.Domain.finalize | |||
get | Return the item corresponding to an internal identifier. | ||
has | True if the domain has the given internal identifier. | ||
insert_aux | Insert a auxiliary coordinate into the domain in place. | ||
insert_axis | Insert an axis into the domain in place. | ||
insert_cm | Insert a cell measure into the domain in place. | ||
insert_coord | Insert a dimension coordinate or auxiliary coordinate into the domain in place. | ||
insert_dim | Insert a dimension coordinate to the domain in place. | ||
insert_transform | Insert a transform object into the domain in place. | ||
item | Return an item of the domain, or its domain identifier. | ||
item_axes | Return the axes of a domain item. | ||
items | Return items of the domain. | ||
map_axes | Map the axis identifiers of the domain to their equivalent axis identifiers of another. | ||
new_aux_identifier | Return a new, unique auxiliary coordinate identifier for the domain. | ||
new_axis_identifier | Return a new, unique axis identifier for the domain. | ||
new_cm_identifier | Return a new, unique cell measure identifier for the domain. | ||
new_transform_identifier | Return a new, unique transform identifier for the domain. | ||
remove_axes | Remove and return axes from the domain. | ||
remove_axis | Remove and return an axis from the domain. | ||
remove_item | Remove and return an item from the domain. | ||
remove_items | Remove and return items from the domain. | ||
transform_axes | Return the axes spanned by the coordinate object inputs of a transform. |