Date

Functions for dates

roundTime([dt, roundTo])

Round a datetime object to any time laps in seconds

add_timedelta_sweeptimes(sweep_times, lag)

Add a lagtime to a list of dates.

months_between(date1, date2)

Return the number of months between date1 and date2

last_day_of_month(date)

Return the number of days in the month

from_to(tstart, tend, tdelta[, xformat])

Return a list of timesteps from <tstart> to <tend> of length <tdelta>

json_serial(obj)

JSON serializer for objects not serializable by default json code extended from here: https://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable-in-python

DateTimeEncoder(*[, skipkeys, ensure_ascii, ...])

Class for JSON encodings of datetimes.

time_mhd(inp)

Return the timestep as string for the given int in seconds

doy(Y[, M, D])

Given year, month, day return day of year Astronomical Algorithms, Jean Meeus, 2d ed, 1998, chap 7

ymd(Y, N)

Given year = Y and day of year = N, return year, month, day Astronomical Algorithms, Jean Meeus, 2d ed, 1998, chap 7

woy(time_curr[, year])

Given a datetime or a list with doy and year, lookup the week of the year

full_steps_timediff(d1, d2)

Calculate the timesteps in weeks, months and days between 2 dates.

calc_period(ss, se)

Return two list with months (seasons) such that ss is the beginning of the first season and se the end of the first season.

is_leap_year(year)

If year is a leap year return True else return False