Skip to content

Commit

Permalink
Add a short example to time-series.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerkclark committed Jul 21, 2018
1 parent fbba12b commit 70f3cd0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion doc/time-series.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,16 @@ coordinate with a no-leap calendar within a context manager setting the
calendar, its times will be decoded into ``cftime.datetime`` objects,
regardless of whether or not they can be represented using
``np.datetime64[ns]`` objects.


xarray also includes a :py:func:`date_range` function, which enables creating a
``CFTimeIndex`` with regularly-spaced dates. For instance, we can create the
same dates and DataArray we created above using:

.. ipython:: python
dates = xr.date_range(start='0001', periods=24, freq='MS', calendar='noleap')
da = xr.DataArray(np.arange(24), coords=[dates], dims=['time'], name='foo')
For data indexed by a ``CFTimeIndex`` xarray currently supports:

- `Partial datetime string indexing`_ using strictly `ISO 8601-format`_ partial
Expand Down

0 comments on commit 70f3cd0

Please sign in to comment.