chaosmagpy.data_utils.mjd_to_dyear

chaosmagpy.data_utils.mjd_to_dyear(time, leap_year=None)[source]

Convert time from modified Julian date 2000 to decimal years.

Leap years are accounted for by default.

Parameters:
timefloat, ndarray, shape (…)

Time in modified Julian date 2000.

leap_year{True, False}, optional

Take leap years into account by using a conversion factor of 365 or 366 days in a year (leap year, used by default). If False a conversion factor of 365.25 days in a year is used.

Returns:
timendarray, shape (…)

Time in decimal years.

Examples

>>> mjd_to_dyear([183. , 548.5])  # account for leap years
    array([2000.5, 2001.5])
>>> mjd_to_dyear([0. , -1., 365.])
    array([2000., 1999.99726027, 2000.99726776])
>>> mjd_to_dyear([182.625, 547.875], leap_year=False)
    array([2000.5, 2001.5])