This page was generated by
nbsphinx from
docs/examples/SSCWeb.ipynb.
Interactive online version:
SSCWeb first steps
Only for Google Colab users:
[ ]:
%pip install --upgrade ipympl speasy
[ ]:
try:
from google.colab import output
output.enable_custom_widget_manager()
except:
print("Not running inside Google Collab")
For all users:
[1]:
[2]:
plt.figure()
moon_orbit = spz.get_data(ssc_tree.Trajectories.moon,
datetime(2019,6,2), datetime(2019,8,24), coordinate_system='gse')
moon_orbit.plot()
plt.tight_layout()
plt.show()
[3]:
def plot_traj(var, ax, label):
ax.plot(var.values[:,0],var.values[:,1],var.values[:,2], label=label)
def plot_earth(ax):
u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)
x = 6371 * np.outer(np.cos(u), np.sin(v))
y = 6371 * np.outer(np.sin(u), np.sin(v))
z = 6371 * np.outer(np.ones(np.size(u)), np.cos(v))
ax.plot_surface(x, y, z, color='b')
themisb_orbit = spz.get_data(ssc_tree.Trajectories.themisb,
datetime(2019,6,2), datetime(2019,6,30), coordinate_system='gse')
mms1_orbit = spz.get_data(ssc_tree.Trajectories.mms1,
datetime(2019,6,2), datetime(2019,6,30), coordinate_system='gse')
moon_orbit = spz.get_data(ssc_tree.Trajectories.moon,
datetime(2019,6,2), datetime(2019,6,30), coordinate_system='gse')
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
plot_traj(moon_orbit, ax, 'Moon')
plot_traj(themisb_orbit, ax, 'Themis-B')
plot_traj(mms1_orbit, ax, 'MMS1')
plot_earth(ax)
ax.set_xlim(-50e4,50e4)
ax.set_ylim(-50e4,50e4)
ax.set_zlim(-50e4,50e4)
ax.legend()
plt.tight_layout()
plt.show()
Bonus: another trajectory provider, UiowaEphTool
For a few missions not covered by SSCWeb (Cassini, Ulysses, Voyager), Speasy also integrates the University of Iowa Cassini Ephemeris Tool, organized the same way — origin, coordinate system, then object:
[2]:
uiowa_trajectories = spz.inventories.tree.uiowaephtool.Trajectories
cassini_traj = spz.get_data(uiowa_trajectories.Callisto.Co_rotational.Cassini, "2010-01-02", "2010-01-03")
cassini_traj.shape, cassini_traj.columns
[2]:
((1440, 3), ['X', 'Y', 'Z'])