pymgp.tleorb.tledatenum#

pymgp.tleorb.tledatenum(daterange)[source]#

Compute datenumber range from start date, end date and interval.

Parameters:
daterangestring, list, array_like with string, float or datetime64

The daterange is either:

  • three element list with start date, end date (or duration in minutes) and data interval in minutes,

  • string with the date or a list with date strings, or,

  • ndarray with serial datenumbers, datestrings, or datetime64

The function return of a previous call is a valid input.

Returns:
tndarray, float64

Array with serial datenumbers (days since 1-1-1970)

Examples

Examples with start date, period (min) or end date, and interval (min)

>>> tledatenum(['2013-9-13 0:00:00', 24*60 ,1])
array([15961.        , 15961.00069444, 15961.00138889, ...,
       15961.99861111, 15961.99930556, 15962.        ])
>>> tledatenum(['2013-9-13 0:00:00', '2013-9-14 0:00:00', 1])
array([15961.        , 15961.00069444, 15961.00138889, ...,
       15961.99861111, 15961.99930556, 15962.        ])

Examples with string input

>>> tledatenum('2013-9-13')  
array([15961.])
>>> tledatenum(['2013-9-13 0:0:00', '2013-9-13 1:0:00', '2013-9-13 2:0:00'])
array([15961.        , 15961.04166667, 15961.08333333])

Example showing the return of a previous call is a valid input

>>> t = tledatenum(['2013-9-13 0:00:00', 24*60 ,1])
>>> tledatenum(t) 
array([15961.        , 15961.00069444, 15961.00138889, ...,
       15961.99861111, 15961.99930556, 15962.        ])