diff --git a/doc/api.rst b/doc/api.rst index bce4e0d1c8e..ff708dc4c1b 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -522,6 +522,13 @@ GroupByObjects core.groupby.DatasetGroupBy.apply core.groupby.DatasetGroupBy.reduce +Custom Indexes +============== +.. autosummary:: + :toctree: generated/ + + CFTimeIndex + Plotting ======== diff --git a/xarray/__init__.py b/xarray/__init__.py index 1a2bf3fe283..94e8029edbb 100644 --- a/xarray/__init__.py +++ b/xarray/__init__.py @@ -22,6 +22,8 @@ from .conventions import decode_cf, SerializationWarning +from .coding.cftimeindex import CFTimeIndex + try: from .version import version as __version__ except ImportError: # pragma: no cover diff --git a/xarray/coding/cftimeindex.py b/xarray/coding/cftimeindex.py index fb51ace5d69..5fca14ddbb1 100644 --- a/xarray/coding/cftimeindex.py +++ b/xarray/coding/cftimeindex.py @@ -135,6 +135,10 @@ def assert_all_valid_date_type(data): class CFTimeIndex(pd.Index): + """Custom Index for working with CF calendars and dates + + All elements of a CFTimeIndex must be cftime.datetime objects. + """ year = _field_accessor('year', 'The year of the datetime') month = _field_accessor('month', 'The month of the datetime') day = _field_accessor('day', 'The days of the datetime')