NCAS-CMS / NCAS-CMS/cf-python

Docs: integrate & extend date-time & time tutorial sections

Aperta
#327 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

documentation
Lingua principale
Python
Stelle
150
Fork
23
Merge medio
1g 11h
PR unite (30g)
2

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Leggi prima le sezioni «Date-time» e «Time» del tutorial, inclusi gli esempi collegati sulle operazioni con i mesi del calendario. Riuniscile in una struttura per data e ora e aggiungi esempi di aritmetica di data e ora, durate, intervalli e date e ore equidistanti; il tutorial dovrebbe rendere individuabili queste operazioni supportate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.