cf.Domain.items

Domain.items(items=None, role=None, axes=None, ctype=None, exact=False, inverse=False, match_all=True, rank=None, regex=False, strict_axes=False)[source]

Return items of the domain.

This method has exactly the same interface, functionality and outputs as cf.Field.items. Therefore see cf.Field.items for the full documentation details.

Parameters :
items : optional

See cf.Field.items.

role : (sequence of) str, optional

See cf.Field.items.

ctype : (sequence of) str, optional

See cf.Field.items.

axes : optional

See cf.Field.items.

rank : int or cf.Comparison, optional

See cf.Field.items.

exact : bool, optional

See cf.Field.items.

inverse : bool, optional

See cf.Field.items.

match_all : bool, optional

See cf.Field.items.

regex : bool, optional

See cf.Field.items.

strict_axes : bool, optional

See cf.Field.items.

Returns :
out : dict

See cf.Field.items.

See also

axes, item, remove_items

Examples

See cf.Field.items.

All of these examples are for the same domain, whose complete dictionary of items is shown in the first example.

>>> d.items()
{'dim0': <CF DimensionCoordinate: grid_latitude(111) degrees>,
 'dim1': <CF DimensionCoordinate: grid_longitude(106) degrees>,
 'dim2': <CF DimensionCoordinate: time(12) days since 1997-1-1>,
 'aux0': <CF AuxiliaryCoordinate: longitude(111, 106) degrees_E>,
 'aux1': <CF AuxiliaryCoordinate: latitude(111, 106) degrees_N>,
 'aux2': <CF AuxiliaryCoordinate: forecast_reference_time(12) days since 1997-1-1>
 'cm0': <CF CellMeasure: area(111, 106) m2>,
 'trans0': <CF Transform: rotated_latitude_longitude>}
>>> d.items(axes='grid_latitude')
{'dim0': <CF DimensionCoordinate: grid_latitude(111) degrees>,
 'aux0': <CF AuxiliaryCoordinate: longitude(111, 106) degrees_E>,
 'aux1': <CF AuxiliaryCoordinate: latitude(111, 106)> degrees_N,
 'cm0': <CF CellMeasure: area(111, 106) m2>}
>>> d.items(axes='grid_latitude', rank=1)
{'dim0': <CF DimensionCoordinate: grid_latitude(111) degrees>}
>>> d.items(axes='grid_latitude', strict_axes=True)
{'dim0': <CF DimensionCoordinate: grid_latitude(111) degrees>}
>>> d.items(axes='time')
{'dim2': <CF DimensionCoordinate: time(12) days since 1997-1-1>,
 'aux2': <CF AuxiliaryCoordinate: forecast_reference_time(12) days since 1997-1-1>}
>>> d.items(axes='time', role='d')
{'dim2': <CF DimensionCoordinate: time(12) days since 1997-1-1>}
>>> d.items(axes='area')
{'aux0': <CF AuxiliaryCoordinate: longitude(111, 106) degrees_E>,
 'aux1': <CF AuxiliaryCoordinate: latitude(111, 106) degrees_N>,
 'cm0': <CF CellMeasure: area(111, 106) m2>}
>>> d.items(axes=['grid_latitude', 'grid_longitude'])
{'aux0': <CF AuxiliaryCoordinate: longitude(111, 106) degrees_E>,
 'aux1': <CF AuxiliaryCoordinate: latitude(111, 106) degrees_N>,
 'cm0': <CF CellMeasure: area(111, 106) m2>}
>>> d.items(axes=d.axes(ctype='T'))
{'dim2': <CF DimensionCoordinate: time(12) days since 1997-1-1>,
 'aux2': <CF AuxiliaryCoordinate: forecast_reference_time(12) days since 1997-1-1>}
>>> d.items(axes={'units': 'hrs since 1-1-1'})
{'dim2': <CF DimensionCoordinate: time(12) days since 1997-1-1>,
 'aux2': <CF AuxiliaryCoordinate: forecast_reference_time(12) days since 1997-1-1>}
>>> d.items(ctype='T')
{'dim2': <CF DimensionCoordinate: time(12) days since 1997-1-1>,
 'aux2': <CF AuxiliaryCoordinate: forecast_reference_time(12) days since 1997-1-1>}
>>> d.items('grid')
{'dim0': <CF DimensionCoordinate: grid_latitude(111) degrees>,
 'dim1': <CF DimensionCoordinate: grid_longitude(106) degrees>}
>>> d.items('grid', exact=True)
{}
>>> d.items({'units': 'degrees_E'})
{'dim0': <CF DimensionCoordinate: grid_latitude(111) degrees>,
 'dim1': <CF DimensionCoordinate: grid_longitude(106) degrees>,
 'aux0': <CF AuxiliaryCoordinate: longitude(111, 106) degrees_E>,
 'aux1': <CF AuxiliaryCoordinate: latitude(111, 106)> degrees_N}
>>> d.items({'units': 'degrees_E'}, exact=True)
{'aux0': <CF AuxiliaryCoordinate: longitude(111, 106) degrees_E>}
>>> d.items({'units': 'radians', 'standard_name': 'time'})
{}
>>> d.items({'units': 'radians', 'standard_name': 'time'}, maximal_match=False)
{'dim0': <CF DimensionCoordinate: grid_latitude(111) degrees>,
 'dim1': <CF DimensionCoordinate: grid_longitude(106) degrees>,
 'dim2': <CF DimensionCoordinate: time(12) days since 1997-1-1>,
 'aux0': <CF AuxiliaryCoordinate: longitude(111, 106) degrees_E>,
 'aux1': <CF AuxiliaryCoordinate: latitude(111, 106)> degrees_N}
>>> d.items({'units': 'radians', 'standard_name': 'time'}, maximal_match=False, exact=True)
{'dim2': <CF DimensionCoordinate: time(12) days since 1997-1-1>}
>>> set(d.items(role='da')) == set(d.items(role='ct', inverse=True))
True

Previous topic

cf.Domain.item_axes

Next topic

cf.Domain.map_axes

This Page