mpas_analysis.shared.timekeeping.utility.datetime_to_days¶
-
mpas_analysis.shared.timekeeping.utility.datetime_to_days(dates, calendar='gregorian', referenceDate='0001-01-01')[source]¶ Given date(s), a calendar and a reference date, returns the days since the reference date, either as a single float or an array of floats.
- Parameters
- datetimeinstance or array-like of datetime.datetime
The date(s) to be converted to days since
referenceDateon the givencalendar.- calendar{‘gregorian’, ‘gregorian_noleap’}, optional
A calendar to be used to convert days to a
datetime.datetimeobject.- referenceDatestr, optional
A reference date of the form:
0001-01-01 0001-01-01 00:00:00
- Returns
- daysfloat or array of floats
The days since
referenceDateon the givencalendar.
- Raises
- ValueError
If an invalid
datetimes,referenceDateorcalendaris supplied.