mpas_analysis.shared.timekeeping.utility.days_to_datetime

mpas_analysis.shared.timekeeping.utility.days_to_datetime(days, calendar='gregorian', referenceDate='0001-01-01')[source]

Covert days to datetime.datetime objects given a reference date and an MPAS calendar (either ‘gregorian’ or ‘noleap’).

Parameters:
  • days (float or array-like of floats) – The number of days since the reference date.

  • calendar ({'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:

datetime (datetime.datetime (or array-like of datetimes)) – The days since referenceDate on the given calendar.

Raises:

ValueError – If an invalid days, referenceDate or calendar is supplied.