earthkit.time.calendar - Calendar-related utilities

class earthkit.time.calendar.Weekday(*values)

enum.IntEnum representing week days

MONDAY = 0
TUESDAY = 1
WEDNESDAY = 2
THURSDAY = 3
FRIDAY = 4
SATURDAY = 5
SUNDAY = 6
earthkit.time.calendar.to_weekday(arg: int | str) Weekday

Convert integers and strings to weekdays

Any unambiguous prefix of a weekday name will be accepted, and case is ignored.

earthkit.time.calendar.month_length(year: int, month: int) int

Return the number of days of a given month

earthkit.time.calendar.day_exists(year: int, month: int, day: int) bool

Check whether a given day exists in the calendar

class earthkit.time.calendar.MonthInYear(year: int, month: int)

Represent a given month in a year

year: int
month: int
length() int

Returns the number of days in the given month

next() MonthInYear

Return the following month

previous() MonthInYear

Return the previous month

earthkit.time.calendar.parse_mmdd(arg: Tuple[int, int] | str) Tuple[int, int]

Convert pairs of ints or MMDD strings into (month, day) pairs

earthkit.time.calendar.parse_date(arg: str | Tuple[int, int, int]) date

Convert triples of ints or YYYYMMDD strings into date objects

earthkit.time.calendar.parse_datetime(arg: str | Tuple[int, int, int, int]) datetime

Convert quadruplets of ints or YYYYMMDDHH strings into datetime objects