Bases: cf.utils.CfDict
Completely describe a field’s coordinate system (space).
It contains the dimension constructs, auxiliary coordinate constructs, cell measure constructs and transform constructs defined by the CF data model.
The space is a dictionary-like object whose key/value pairs identify and store the coordinate and cell measure constructs which describe it.
The dimensionality of the space’s components and its transforms are stored as attributes.
Initialization
Parameters : |
---|
Add a new dimension or auxiliary coordinate to the space in place.
Parameters : |
dim_name_map : dict, optional
|
---|---|
Returns : | None |
Examples
>>>
Return a dictionary whose values are the auxiliary coordinates which span the given dimension with keys of the space’s auxiliary coordinate keys.
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> s.dimensions
{'data': ['dim0', 'dim1', 'dim2'],
'aux0': ['dim1', 'dim2'],
'aux1': ['dim0'],
'aux2': ['dim2', 'dim1'],
'dim0': ['dim0'],
'dim1': ['dim1'],
'dim2': ['dim2']}
>>> s.aux_coords()
{'aux0': <CF Coordinate>,
'aux1': <CF Coordinate>,
'aux2': <CF Coordinate>}
>>> s.aux_coords('dim2')
{'aux0': <CF Coordinate>,
'aux2': <CF Coordinate>}
Find a coordinate of the space by name. Refer to cf.Field.coord for details.
Return a deep copy.
Equivalent to copy.deepcopy(x)
Returns : |
|
---|
Examples
>>> x.copy()
Return a string containing a full description of the space.
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> s.dump()
>>> s.dump(id='foobar')
Return True if two spaces are equal.
Equality is defined as follows:
- There is one-to-one coorespondence between dimensions and dimension sizes between the two spaces.
- For each space component type (dimension coordinate, auxiliary coordinate and cell measures), the set of constructs in one space equals that of the other space. The component indentifiers need not be the same.
- The set of transforms in one space equals that of the other space. The transform indentifiers need not be the same.
Equality of numbers is to within a tolerance. Refer to cf for details.
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> s.equals(t)
True
Expand the space with a new dimension in place.
The new dimension may by of any size greater then 0.
Parameters : |
|
---|---|
Returns : | None |
Examples
>>> s.expand_dims()
>>> s.expand_dims(size=12)
>>> c
<CF Coordinate: >
>>> s.expand_dims(coord=c)
Return a list of the cf dictionary’s key names which match the given regular expression.
Parameters: | regex (str) – Optional. The regular expression with which to identify key names. |
---|---|
Returns: | A list of keys names. |
Examples
>>> d.keys()
['dim2', 'dim0', 'dim1', 'aux0', 'cm0']
>>> d.get_keys()
['dim2', 'dim0', 'dim1', 'aux0', 'cm0']
>>> d.get_keys('dim')
['dim2', 'dim0', 'dim1']
>>> d.get_keys('^aux|^dim')
['dim2', 'dim0', 'dim1', 'aux0']
>>> d.get_keys('dim[123]')
['dim2', 'dim1']
Return a new
Return a new
Return a new
Remove a coordinate from the space in place.
Parameters : |
|
---|---|
Returns : | None |
Examples
>>> s.remove_coordinate('dim0')
>>> s.remove_coordinate('aux1')
Remove a size 1 dimension from the space in place.
If the dimension has a dimension coordinate then it is removed, as are 1-d auxiliary coordinates and cell measures which span the dimension. The dimension is squeezed from multidimensional auxiliary coordinates and cell measures if they span it.
The dimension is not squeezed from the field’s data array if it spans it, therefore the field’s data array may need to be squeezed concurrently.
Parameters : |
|
---|---|
Returns : | None |
Examples
>>> s.dimension_sizes
{'dim0': 12, 'dim1': 73, 'dim2': 1}
>>> s.dimensions
{'data': ['dim0', 'dim1', 'dim2'],
'aux0': ['dim1', 'dim2'],
'aux1': ['dim2', 'dim1'],
'dim0': ['dim0'],
'dim1': ['dim1'],
'dim2': ['dim2'],
'cm0' : ['dim1', 'dim2']}
>>> s.squeeze('dim2')
>>> s.dimension_sizes
{'dim0': 12, 'dim1': 73}
>>> s.dimensions
{'data': ['dim0', 'dim1', 'dim2'],
'aux0': ['dim1'],
'aux1': ['dim1'],
'dim0': ['dim0'],
'dim1': ['dim1'],
'cm0' : ['dim1']}
The sizes of the space’s dimensions.
Examples
>>> s.dimension_sizes
{'dim2': 96,
'dim1': 73,
'dim0': 1}
The dimensions of each of the space’s components and of the its field’s data array.
>>> s.dimensions
{'data': ['dim0', 'dim1', 'dim2'],
'aux0': ['dim1', 'dim2'],
'aux1': ['dim2', 'dim1'],
'dim0': ['dim0'],
'dim1': ['dim1'],
'dim2': ['dim2'],
'cm0' : ['dim1', 'dim2']}
The space’s transform constructs.
>>> s.transforms
{'trans0': <CF Transform: ocean_sigma_z_coordinate>
>>> type(s.transforms)
'cf.utils.CfDict'