''' Just to get spacecraft velocity around Jupiter
As a model data, 2031-05-03 to 05-04 to be one candiate.
It is at the ganymede orbit with inclination of 17deg.
As a model data, 2031-08-20 to 08-21 to be second candiate.
It is at the ganymede orbit with inclination of -23.5 deg.
17.5 Rj.
'''
import datetime
import matplotlib.pyplot as plt
from pyana.juice import jspice
def main():
'''Main script'''
jspice.init()
dt = datetime.timedelta(minutes=10)
# t1 = datetime.datetime(2031, 5, 4, 18, 0, 0)
# t0 = datetime.datetime(2031, 5, 3, 18, 0, 0)
t1 = datetime.datetime(2031, 8, 21, 18, 0, 0)
t0 = datetime.datetime(2031, 8, 20, 18, 0, 0)
t = t1
while t >= t0:
print(t)
t = t - dt
scpos = jspice.get_position(t) # In JSE
# print jspice.get_velocity(t) # In JSE
iopos = jspice.get_position(t, target='IO')
plt.plot([scpos[0]], [scpos[1]], 'bo')
plt.plot([iopos[0]], [iopos[1]], 'ro')
plt.text(scpos[0], scpos[1], t.strftime('%FT%T'))
plt.text(iopos[0], iopos[1], t.strftime('%FT%T'))
plt.gca().set_aspect('equal')
plt.savefig('app13_jse_sc_io.png')
if __name__ == "__main__":
main()