An object JulianDatein Skyfield is a convenient way to quickly create and hold a set of time values in Julian Days, and pass them to the Skyfield method at()to calculate astronomical positions in different coordinates. (see example script )
However, I cannot find a method addor offset, so that I can add a time offset or an iterable bias to the object JulianDate. I always think the struggle with dates and times.
Here is a very simple, abstract example. I generate jd60, which is shifted from arbitrary jd0by 60 days. As a simple check, I calculate the position of the earth twice and make sure that it moves about 60 degrees.
from skyfield.api import load, JulianDate
import numpy as np
data = load('de421.bsp')
earth = data['earth']
Start with arbitrary t_zero:
jd0 = JulianDate(utc=(2016, 1, 17.4329, 22.8, 4, 39.3))
Now do a second JulianDate object shift of 60 days
It works:
tim = list(jd0.tt_tuple())
tim[2] += 60
jd60 = JulianDate(utc=tuple(tim))
But I would like something like:
jd60 = jd0.add(delta_utc=(0, 0, 60, 0, 0, 0))
Now calculate the positions and find the approximate angle to make sure it worked.
p0 = earth.at(jd0).position.km
p60 = earth.at(jd60).position.km
dot = (p0*p60).sum()
cos_theta = dot / np.sqrt( (p0**2).sum() * (p61**2).sum() )
print (180./np.pi) * np.arccos(cos_theta)
print "should be roughly 60 degrees"
gives
60.6215331601
should be roughly 60 degrees