chaosmagpy.data_utils.mjd2000

chaosmagpy.data_utils.mjd2000(year, month=1, day=1, hour=0, minute=0, second=0, microsecond=0)[source]

Computes the modified Julian date as floating point number (epoch 2000).

It assigns 0 to 0h00 January 1, 2000. Leap seconds are not accounted for.

Parameters:
timedatetime.datetime, ndarray, shape (…)

Datetime class instance, OR …

yearint, ndarray, shape (…)
monthint, ndarray, shape (…), optional

Month of the year [1, 12] (defaults to 1).

dayint, ndarray, shape (…), optional

Day of the corresponding month (defaults to 1).

hourint , ndarray, shape (…), optional

Hour of the day (default is 0).

minuteint, ndarray, shape (…), optional

Minutes (default is 0).

secondint, ndarray, shape (…), optional

Seconds (default is 0).

microsecondint, ndarray, shape (…), optional

Microseconds (default is 0).

Returns:
timendarray, shape (…)

Modified Julian date (units of days).

Examples

>>> a = np.array([datetime.datetime(2000, 1, 1), datetime.datetime(2002, 3, 4)])
>>> mjd2000(a)
    array([  0., 793.])
>>> mjd2000(2003, 5, 3, 13, 52, 15)  # May 3, 2003, 13:52:15 (hh:mm:ss)
    1218.5779513888888
>>> mjd2000(np.arange(2000, 2005))  # January 1 in each year
    array([   0.,  366.,  731., 1096., 1461.])
>>> mjd2000(np.arange(2000, 2005), 2, 1)  # February 1 in each year
    array([  31.,  397.,  762., 1127., 1492.])
>>> mjd2000(np.arange(2000, 2005), 2, np.arange(1, 6))
    array([  31.,  398.,  764., 1130., 1496.])