NCAS-CMS / NCAS-CMS/cf-python

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

Offen
#327 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

documentation
Vorherrschende Sprache
Python
Sterne
150
Forks
23
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
2

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Lesen Sie zuerst die Abschnitte „Date-time“ und „Time“ des Tutorials, einschließlich der verlinkten Beispiele zu Operationen mit Kalendermonaten. Fassen Sie sie unter einer Struktur für Datum und Zeit zusammen und fügen Sie Beispiele für Datum-Zeit-Arithmetik, Dauern, Intervalle und gleichmäßig verteilte Datums- und Zeitangaben hinzu; das Tutorial sollte diese unterstützten Operationen auffindbar machen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.