xcdat.get_axis_coord
xcdat.get_axis_coord#
- xcdat.get_axis_coord(obj, axis)[source]#
Gets the coordinate variable for an axis.
This function uses
cf_xarrayto try to find the matching coordinate variable by checking the following attributes in order:"axis""standard_name"Dimension name
Must follow the valid short-hand convention
For example,
"lat"for latitude and"lon"for longitude
- Parameters
obj (Union[xr.Dataset, xr.DataArray]) – The Dataset or DataArray object.
axis (CFAxisName) – The CF-compliant axis name (“X”, “Y”, “T”, “Z”).
- Returns
xr.DataArray – The coordinate variable.
- Raises
KeyError – If the coordinate variable was not found.
Notes
Refer to 1 for a list of CF-compliant
"axis"and"standard_name"attr names that can be interpreted bycf_xarray.References