xarray.Dataset.cf.__getitem__#

Dataset.cf.__getitem__(key)#

Index into a Dataset making use of CF attributes.

Parameters:
keystr, Iterable[str], optional
One of
  • axes names: “X”, “Y”, “Z”, “T”

  • coordinate names: “longitude”, “latitude”, “vertical”, “time”

  • cell measures: “area”, “volume”, or other names present in the cell_measures attribute

  • standard names: names present in standard_name attribute

  • cf roles: ‘timeseries_id’, ‘profile_id’, ‘trajectory_id’, ‘mesh_topology’, ‘grid_topology’

  • grid mappings: ‘grid_mapping’ or a grid_mapping_name like ‘rotated_latitude_longitude’

Returns:
DataArray or Dataset

Dataset.cf[str] will return a DataArray, Dataset.cf[List[str]]` will return a Dataset.

Notes

In all cases, associated CF variables will be attached as coordinate variables by parsing attributes such as bounds, ancillary_variables, etc.

bounds variables will not be attached when a DataArray is returned. This is a limitation of the xarray data model.

Add additional keys by specifying “custom criteria”. See Custom Criteria for more.