jgieseler / solarmach

Python package of the multi-spacecraft longitudinal configuration plotter Solar-MACH
https://solarmach.readthedocs.io
BSD 3-Clause "New" or "Revised" License
28 stars 6 forks source link

Add trajectories of bodies #9

Open jgieseler opened 2 years ago

jgieseler commented 2 years ago

Provide the option to provide (plot) trajectories of bodies. For example, over 24 hours plot the hourly positions of Parker Solar Probe, connecting them with a line. This line could also have some color/saturation coding to allow for time-dependency.

jgieseler commented 2 years ago

An example of this would be the following figure from @cmoestl:

Twitter image

jgieseler commented 1 year ago

Example code from sunpy that is going into this direction (source):

import numpy as np
from sunpy.coordinates import frames, get_body_heliographic_stonyhurst, get_horizons_coord, transform_with_sun_center
from sunpy.time import parse_time
from astropy import units as u

perihelion_time = parse_time("2022-03-26")
perihelion_seq = perihelion_time + np.arange(-30, 30)*u.day

solo_coord = get_horizons_coord("solar orbiter", perihelion_seq)
psp_coord = get_horizons_coord("psp", perihelion_seq)
sdo_coord = get_horizons_coord("sdo", perihelion_seq)

fig = plt.figure(dpi=120)
ax = fig.add_subplot(projection='polar')

# Transform to HGS
psp_coord_hgs = psp_coord.heliocentricinertial
solo_coord_hgs = solo_coord.heliocentricinertial
sdo_coord_hgs = sdo_coord.heliocentricinertial

ax.plot(psp_coord_hgs.lon.to('rad'), psp_coord_hgs.distance, '.-', markersize=5, label='PSP')
ax.plot(solo_coord_hgs.lon.to('rad'), solo_coord_hgs.distance, '.', markersize=5, label='SolO')
ax.plot(sdo_coord_hgs.lon.to('rad'), sdo_coord_hgs.distance, '.', markersize=5, label='SDO')

ax.legend(loc='lower right')
ax.set_theta_zero_location("S")
ax.set_title('Positions in Heliographic Stonyhurst (HGS)')
plt.show()

Figure_1

jgieseler commented 1 month ago

See also https://docs.sunpy.org/en/stable/generated/gallery/units_and_coordinates/ParkerSolarProbe_trajectory.html#sphx-glr-generated-gallery-units-and-coordinates-parkersolarprobe-trajectory-py