Docs: integrate & extend date-time & time tutorial sections
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 150
- Forks
- 23
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 2
Description
Summarising from an external (Slack) conversation, a power user (@bnlawrence) couldn't gauge if we supported date interval operations from the current documentation:
is it possible to carry out date interval operations on those dates, such as add (1 month, 3days and 8h to an existing cf.date instance
Solution: more examples
After discussing this we agreed that examples of datetime and time duration arithmetic along the lines of:
>>> t = cf.Data(array=np.array([1,2,3]), units="days since 2018-12-01")
>>> t
<CF Data(3): [2018-12-02 00:00:00, 2018-12-03 00:00:00, 2018-12-04 00:00:00]>
>>> dt = cf.TimeDuration(3, "day")
>>> dt
<CF TimeDuration: P3D (Y-M-D 00:00:00)>
>>> t + dt
<CF Data(3): [2018-12-05 00:00:00, 2018-12-06 00:00:00, 2018-12-07 00:00:00] standard>
>>> t - dt
<CF Data(3): [2018-11-29 00:00:00, 2018-11-30 00:00:00, 2018-12-01 00:00:00] standard>
would be good to add explicitly to the tutorial to make it transparent that we do support it in a simple way. Some current facets of the docs in this sense weren't sufficiently direct or discoverable:
I think the example around adding a calendar month is really obscured and doesn't really signal the use case which is: Incrementing a cf.dt object by a cf.TimeDuration object to create, say, a set of equally spanned date times
where the suggestion there (creating a set of equally spanned date times) would be another good code example to include in a similar place in the tutorial.
Solution: combining datetime- and time-related content in tutorial
Furthermore, after looking at the sections in the tutorial relating to datetimes, at present being a 'Data -> Date-time' sub-section and a 'Time' section, I noted they are in very different places under the tutorial structuring. I suggested that it might be a good idea to combine those sections into one all-encompassing datetime functionality related section, for one because interval operations wouldn't sit nicely in either section, really pertaining to both, but also because the sections are quite related. Bryan also thinks this would be an improvement:
I agree, putting them together would be really good
Then the new examples can sit nicely under this new umbrella section, with suggested structuring of something like:
|--- Datetime and time components
| |--- Datetime data
| |--- Time constructs
| |--- Durations and intervals
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the tutorial's Date-time and Time sections first, including the linked examples around calendar-month operations. Combine them under a datetime-and-time structure and add examples for date-time arithmetic, durations, intervals, and equally spaced date times; the tutorial should make these supported operations discoverable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100