mpas_analysis.shared.timekeeping.utility.string_to_relative_delta¶
- mpas_analysis.shared.timekeeping.utility.string_to_relative_delta(dateString, calendar='gregorian')[source]¶
Given a date string and a calendar, returns an instance of
MpasRelativeDelta
- Parameters
dateString (str) –
A date and time in one of the following formats:
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh.mm.ss YYYY-MM-DD SSSSS DDD hh:mm:ss DDD hh.mm.ss DDD SSSSS hh.mm.ss hh:mm:ss YYYY-MM-DD YYYY-MM SSSSS
Note: either underscores or spaces can be used to separate the date from the time portion of the string.
calendar ({'gregorian', 'gregorian_noleap'}, optional) – The name of one of the calendars supported by MPAS cores
- Returns
relativedelta (An
MpasRelativeDelta
object)- Raises
ValueError – If an invalid
dateString
is supplied.