apps120911_iotorus.app14_iofrm_sc_ioΒΆ

''' 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 numpy as np
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, 5, 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 = np.array(jspice.get_position(t))   # In JSE
#        print jspice.get_velocity(t)   # In JSE
        iopos = np.array(jspice.get_position(t, target='IO'))
        theta = np.arctan2(iopos[1], iopos[0])

        matx = np.array([[np.cos(theta), np.sin(theta), 0],
                         [-np.sin(theta), np.cos(theta), 0],
                         [0, 0, 1]])

        scpos = matx.dot(scpos)
        iopos = matx.dot(iopos)

        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('app14_iofrm_sc_io.png')


if __name__ == "__main__":
    main()