Return a coordinate of the domain.
Note that the returned coordinate is an object identity (not a copy) to the coordinate stored in the domain so, for example, a coordinate’s properties may be changed in-place:
>>> f.coord('height').long_name
AttributeError: Coordinate has no CF property 'long_name'
>>> f.coord('height').long_name = 'height'
>>> f.coord('height').long_name
'height'
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> d['dim2'].shape
(360,)
>>> d['dim2'].properties
{'_FillValue': None,
'axis': 'X',
'long_name': 'longitude',
'standard_name': 'longitude',
'units': 'degrees_east'}
>>> d.coord('longitude')
<CF Coordinate: longitude(360)>
>>> d.coord('long')
<CF Coordinate: longitude(360)>
>>> d.coord('long', key=True)
'dim2'
>>> d.coord('long', dimensions=True)
['dim2']
>>> d.coord('long', oned_d=True)
<CF Coordinate: longitude(360)>
>>> d.coord('lon', exact=True)
None
>>> d.coord('longitude', exact=True)
<CF Coordinate: longitude(360)>
>>> d.coord({'standard_name': 'long', 'axis': X})
<CF Coordinate: longitude(360)>
>>> d.coord({'standard_name': 'long', 'axis': 'X'}, maximal_match=False)
<CF Coordinate: longitude(360)>
>>> d.coord({'standard_name': 'long', 'axis': 'Y'})
None
>>> d.coord({'standard_name': 'long', 'axis': 'Y'}, maximal_match=False)
<CF Coordinate: longitude(360)>
>>> d.coord('long', role='dim')
<CF Coordinate: longitude(360)>
>>> d.coord('long', role='aux')
None