mpas_analysis.shared.timekeeping.utility.date_to_days¶
-
mpas_analysis.shared.timekeeping.utility.
date_to_days
(year=1, month=1, day=1, hour=0, minute=0, second=0, calendar='gregorian', referenceDate='0001-01-01')[source]¶ Convert a date to days since the reference date.
- Parameters
year (int, optional) – The date to be converted to days since
referenceDate
on the givencalendar
.month (int, optional) – The date to be converted to days since
referenceDate
on the givencalendar
.day (int, optional) – The date to be converted to days since
referenceDate
on the givencalendar
.hour (int, optional) – The date to be converted to days since
referenceDate
on the givencalendar
.minute (int, optional) – The date to be converted to days since
referenceDate
on the givencalendar
.second (int, optional) – The date to be converted to days since
referenceDate
on the givencalendar
.calendar ({'gregorian', 'gregorian_noleap'}, optional) – A calendar to be used to convert days to a
datetime.datetime
object.referenceDate (str, optional) –
A reference date of the form:
0001-01-01 0001-01-01 00:00:00
- Returns
days (float) – The days since
referenceDate
on the givencalendar
.- Raises
ValueError – If an invalid
referenceDate
orcalendar
is supplied.