''' Calculate the height profile of the JUICE for the given time range.
'''
import datetime
import dateutil
import numpy as np
import matplotlib.pyplot as plt
import pyana.util.timeseries
import pyana.juice.jspice as js
js.init()
def main(t0, t1, dt, origin='Jupiter', ax=None, *argv, **kwds):
'''Main script'''
tlist = pyana.util.timeseries.dtrange(t0, t1, dt)
xyzlist = np.array([js.get_position(t, origin=origin) for t in tlist])
print(xyzlist.shape)
hlist = np.sqrt((xyzlist ** 2).sum(1))
if ax == None:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(tlist, hlist, *argv, **kwds)
return ax
if __name__ == "__main__":
from optparse import OptionParser
usage = "usage: %prog [options] t0 t1 dt(s) origin"
parser = OptionParser(usage)
(options, args) = parser.parse_args()
if len(args) != 4:
parser.error("incorrect number of arguments")
main(dateutil.parser.parse(args[0]), dateutil.parser.parse(args[1]), datetime.timedelta(seconds=int(args[2])), origin=args[3])