Usage

First, importing:

[1]:
from solarmach import SolarMACH, print_body_list, get_sw_speed, get_gong_map, calculate_pfss_solution

1. Minimal example

Necessary options are a list of wanted spacecraft/bodies and the date of interest.

Note that since version 0.2.3, you don’t need to provide a list with solar wind speeds (in km/s) corresponding to the spacecraft/bodies, but you can. If vsw_list is not provided (or as an empty list, vsw_list=[]), it is automatically tried to obtain measured solar wind speeds per spacecraft. If this does not succeed for a spacecraft, a default solar wind speed of 400 km/s is assumed (this can be adjusted with default_vsw, e.g., default_vsw=300).

[16]:
body_list = ['Earth', 'Solar Orbiter', 'PSP']
date = '2022-3-1 12:00:00'

Initialize the SolarMACH object for these options:

[17]:
sm1 = SolarMACH(date=date, body_list=body_list)
No solar wind speeds defined, trying to obtain measurements...
Using 'ACE' measurements for 'Earth'.

And produce the final plot:

[18]:
sm1.plot(plot_sun_body_line=True)
_images/usage_7_0.png

This plot shows a view from the top on the ecliptic plane with the Sun in the center and the Earth (indicated by green symbol) at “6 o’clock”. The solid lines give estimations of single field lines of an ideal Parker heliospheric magnetic field connecting the corresponding observers to the Sun, while the dashed lines just indicate the line of sight from each of them to the Sun.

If you do not want or need that the solar wind speeds are obtained from online sources, you can manually define them with vsw_list. Note that each speed corresponds position-wise with the corresponding spacecraft/bodies list:

[5]:
vsw_list = [400, 400, 400]    # position-sensitive solar wind speed per body in body_list
body_list = ['Earth', 'Solar Orbiter', 'PSP']
date = '2022-3-1 12:00:00'

sm1a = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list)
sm1a.plot(plot_sun_body_line=True)
_images/usage_10_0.png

2. Example with all the details

First, get a list of available bodies/spacecraft:

[19]:
print(print_body_list().index)
Index(['Earth', 'ACE', 'BepiColombo', 'Cassini', 'Europa Clipper', 'JUICE',
       'Juno', 'Jupiter', 'L1', 'Mars', 'Mars Express', 'MAVEN', 'Mercury',
       'MESSENGER', 'PSP', 'Pioneer10', 'Pioneer11', 'Rosetta', 'SOHO',
       'Solar Orbiter', 'STEREO B', 'STEREO A', 'Ulysses', 'Venus', 'Voyager1',
       'Voyager2', 'WIND'],
      dtype='object', name='Key')

Provide the necessary options, this time for more spacecraft:

[20]:
body_list = ['Mercury', 'Venus', 'Earth', 'Mars', 'STEREO A', 'STEREO B', 'Solar Orbiter', 'PSP', 'BepiColombo']
date = '2021-6-1 12:00:00'

Leave the position-sensitive solar wind speed list empty, so that they are obtained from actual measurements, and define the solar wind speed that should be used if no measurements can be obtained for a spacecraft:

[21]:
vsw_list = []
default_vsw = 350  # km/s

The default coordinate system is Carrington coordinates, alternatively one could select the Earth-centered Stonyhurst coordinate system:

[ ]:
coord_sys = 'Carrington'     # 'Carrington' (default) or 'Stonyhurst'

Now we also want to indicate the position and direction of a flare, and the (assumed) solar wind speed at its location:

[23]:
reference_long = 0            # Carrington longitude of reference (None to omit)
reference_lat = 0             # Carrington latitude of reference (None to omit)
reference_vsw = 400           # define solar wind speed at reference in km/s

In addition, we explicitly provide all availabe plotting options:

[24]:
plot_spirals = True           # plot Parker spirals for each body
plot_sun_body_line = False    # plot straight line between Sun and body
long_offset = 0               # longitudinal offset for polar plot; defines where Earth's longitude is (by default 270, i.e., at "6 o'clock")
transparent = False           # make output figure background transparent
markers = 'numbers'           # use 'numbers' or 'letters' for the body markers (use False for colored squares)
filename = f'Solar-MACH_{date.replace(" ", "_")}.png'  # define filename of output figure

Finally, initializing and plotting with these options. If outfile is provided, the plot will be saved next to the Notebook with the provided filename. This can be a .png or .pdf file.

[25]:
sm2 = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list,
                reference_long=reference_long, reference_lat=reference_lat,
                coord_sys=coord_sys)

sm2.plot(plot_spirals=plot_spirals,
         plot_sun_body_line=plot_sun_body_line,
         long_offset=long_offset,
         reference_vsw=reference_vsw,
         transparent=transparent,
         markers=markers,
         outfile=filename
         )
/Users/jagies/miniforge3/envs/serpentine/lib/python3.12/site-packages/speasy/core/data_containers.py:17: UserWarning: no explicit representation of timezones available for np.datetime64
  return np.searchsorted(time, np.datetime64(key, 'ns'), side='left')
2025-05-06 11:52:35 - speasy.core.dataprovider - WARNING: You are requesting vpbulk_stb outside of its definition range <DateTimeRange: 2007-03-01T00:00:12+00:00 -> 2014-10-31T23:59:30+00:00>
No solar wind speeds defined, trying to obtain measurements...
Body 'Mercury' not supported, assuming default Vsw value of 400.0 km/s.
Body 'Venus' not supported, assuming default Vsw value of 400.0 km/s.
Using 'ACE' measurements for 'Earth'.
Body 'Mars' not supported, assuming default Vsw value of 400.0 km/s.
No Vsw data found for 'STEREO B' on 2021-06-01 12:00:00, assuming default Vsw value of 400.0 km/s.
No Vsw data found for 'Solar Orbiter' on 2021-06-01 12:00:00, assuming default Vsw value of 400.0 km/s.
Body 'BepiColombo' not supported, assuming default Vsw value of 400.0 km/s.
_images/usage_24_2.png

All the data can also be obtained as a Pandas DataFrame for further use. Note that here you can also see the actually measured solar wind speeds at some spacecraft (Vsw):

[26]:
df = sm2.coord_table
display(df)
Spacecraft/Body Carrington longitude (°) Carrington latitude (°) Heliocentric distance (AU) Longitudinal separation to Earth's longitude Latitudinal separation to Earth's latitude Vsw Magnetic footpoint longitude (Carrington) Longitudinal separation between body and reference_long Longitudinal separation between body's magnetic footpoint and reference_long Latitudinal separation between body and reference_lat
0 Mercury 64.572366 -3.374752 0.456577 -17.161028 -2.767176 400.000000 92.869075 64.572366 92.869075 -3.374752
1 Venus 304.308841 -2.405230 0.718663 -137.424553 -1.797654 400.000000 349.068938 -55.691159 -10.931062 -2.405230
2 Earth 81.733394 -0.607576 1.014084 0.000000 0.000000 299.720001 166.282213 81.733394 166.282213 -0.607576
3 Mars 328.690673 -4.569037 1.657439 -113.042721 -3.961461 400.000000 71.968889 -31.309327 71.968889 -4.569037
4 STEREO A 31.671472 -5.969301 0.963303 -50.061921 -5.361726 321.267857 106.021566 31.671472 106.021566 -5.969301
5 STEREO B 125.736482 4.448713 1.086015 44.003089 5.056289 400.000000 193.323584 125.736482 -166.676416 4.448713
6 Solar Orbiter 342.893742 -1.038420 0.952075 -98.839652 -0.430845 400.000000 42.345517 -17.106258 42.345517 -1.038420
7 PSP 142.038810 3.210198 0.715577 60.305417 3.817774 501.488278 177.552209 142.038810 177.552209 3.210198
8 BepiColombo 331.970837 -3.538780 0.807266 -109.762557 -2.931204 400.000000 22.213248 -28.029163 22.213248 -3.538780
[14]:
df['Heliocentric distance (AU)'].values
[14]:
array([0.45657717, 0.71866253, 1.0140839 , 1.65743876, 0.9633026 ,
       1.08601488, 0.95207518, 0.7155775 , 0.80726552])

3. Example using Stonyhurst coordinates for reference

Let’s take a look at the situation at the first ground-level enhancement (GLE) of solar cycle 25 on 28 October 2021

First, we just provide some options as before:

[ ]:
body_list = ['STEREO-A', 'Earth', 'BepiColombo', 'PSP', 'Solar Orbiter', 'Mars']
vsw_list = [340, 300, 350, 350, 320, 350]        # position-sensitive solar wind speed per body in body_list
date = '2021-10-28 15:20:00'
coord_sys = 'Stonyhurst'

# optional parameters
plot_spirals = True           # plot Parker spirals for each body
plot_sun_body_line = True     # plot straight line between Sun and body
transparent = False           # make output figure background transparent
markers = 'letters'           # use 'numbers' or 'letters' for the body markers (use False for colored squares)
filename = f'Solar-MACH_{date.replace(" ", "_")}.png'  # define filename of output figure

But now we want to provide the coordinates of the flare in Stonyhurst coordinates (instead of Carrington).

[ ]:
reference_long = 2            # Stonyhurst longitude of reference (None to omit)
reference_lat = 26            # Stonyhurst latitude of reference (None to omit)
reference_vsw = 300           # define solar wind speed at reference

Finally, initializing and plotting with these options:

[ ]:
sm3 = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list,
                reference_long=reference_long, reference_lat=reference_lat,
                coord_sys=coord_sys)
sm3.plot(plot_spirals=plot_spirals,
         plot_sun_body_line=plot_sun_body_line,
         reference_vsw=reference_vsw,
         transparent=transparent,
         markers=markers,
         outfile=filename
         )
_images/usage_34_0.png

4. Only obtain data as Pandas DataFrame

We can also just obtain a table with the spatial data, without producing a plot at all.

First provide necessary options:

[27]:
body_list = ['STEREO-A', 'Earth', 'BepiColombo', 'PSP', 'Solar Orbiter', 'Mars']
vsw_list = []  # leave empty to obtain measurements
date = '2022-6-1 12:00:00'

Then initialize SolarMACH and obtain data as Pandas DataFrame:

[28]:
sm4 = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list)
df = sm4.coord_table
display(df)
No solar wind speeds defined, trying to obtain measurements...
Using 'ACE' measurements for 'Earth'.
Body 'BepiColombo' not supported, assuming default Vsw value of 400.0 km/s.
/Users/jagies/miniforge3/envs/serpentine/lib/python3.12/site-packages/speasy/core/data_containers.py:17: UserWarning: no explicit representation of timezones available for np.datetime64
  return np.searchsorted(time, np.datetime64(key, 'ns'), side='left')
No Vsw data found for 'Parker Solar Probe' on 2022-06-01 12:00:00, assuming default Vsw value of 400.0 km/s.
No Vsw data found for 'Solar Orbiter' on 2022-06-01 12:00:00, assuming default Vsw value of 400.0 km/s.
Body 'Mars' not supported, assuming default Vsw value of 400.0 km/s.
Spacecraft/Body Carrington longitude (°) Carrington latitude (°) Heliocentric distance (AU) Longitudinal separation to Earth's longitude Latitudinal separation to Earth's latitude Vsw Magnetic footpoint longitude (Carrington)
0 STEREO-A 275.723519 -3.999101 0.961350 -28.467770 -3.361511 359.677966 342.276014
1 Earth 304.191289 -0.637590 1.014043 0.000000 0.000000 439.109985 1.898317
2 BepiColombo 330.303663 -1.980526 0.570656 26.112374 -1.342935 400.000000 5.799579
3 PSP 162.142527 -2.129720 0.068022 -142.048762 -1.492130 400.000000 166.116201
4 Solar Orbiter 108.356480 2.066308 0.933521 -195.834809 2.703898 400.000000 166.604421
5 Mars 16.893904 4.867268 1.384205 -287.297385 5.504858 400.000000 103.046865

If we also provide the reference information, it will be available in the table, too:

[29]:
sm4 = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list,
                reference_long=273, reference_lat=7)
df = sm4.coord_table
display(df)
No solar wind speeds defined, trying to obtain measurements...
Using 'ACE' measurements for 'Earth'.
Body 'BepiColombo' not supported, assuming default Vsw value of 400.0 km/s.
No Vsw data found for 'Parker Solar Probe' on 2022-06-01 12:00:00, assuming default Vsw value of 400.0 km/s.
No Vsw data found for 'Solar Orbiter' on 2022-06-01 12:00:00, assuming default Vsw value of 400.0 km/s.
Body 'Mars' not supported, assuming default Vsw value of 400.0 km/s.
/Users/jagies/miniforge3/envs/serpentine/lib/python3.12/site-packages/speasy/core/data_containers.py:17: UserWarning: no explicit representation of timezones available for np.datetime64
  return np.searchsorted(time, np.datetime64(key, 'ns'), side='left')
Spacecraft/Body Carrington longitude (°) Carrington latitude (°) Heliocentric distance (AU) Longitudinal separation to Earth's longitude Latitudinal separation to Earth's latitude Vsw Magnetic footpoint longitude (Carrington) Longitudinal separation between body and reference_long Longitudinal separation between body's magnetic footpoint and reference_long Latitudinal separation between body and reference_lat
0 STEREO-A 275.723519 -3.999101 0.961350 -28.467770 -3.361511 359.677966 342.276014 2.723519 69.276014 -10.999101
1 Earth 304.191289 -0.637590 1.014043 0.000000 0.000000 439.109985 1.898317 31.191289 88.898317 -7.637590
2 BepiColombo 330.303663 -1.980526 0.570656 26.112374 -1.342935 400.000000 5.799579 57.303663 92.799579 -8.980526
3 PSP 162.142527 -2.129720 0.068022 -142.048762 -1.492130 400.000000 166.116201 -110.857473 -106.883799 -9.129720
4 Solar Orbiter 108.356480 2.066308 0.933521 -195.834809 2.703898 400.000000 166.604421 -164.643520 -106.395579 -4.933692
5 Mars 16.893904 4.867268 1.384205 -287.297385 5.504858 400.000000 103.046865 -256.106096 -169.953135 -2.132732

Note again that by default all coordinates are given in Carrington coordinates (as indicated in the column titles). To have this data in Stonyhurst coordinates, define the coord_sys when initilizing SolarMACH:

[ ]:
sm4a = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list, coord_sys='Stonyhurst')
df = sm4a.coord_table
display(df)
No solar wind speeds defined, trying to obtain measurements...
Using 'ACE' measurements for 'Earth'.
Body 'BepiColombo' not supported, assuming default Vsw value of 400.0 km/s.
No Vsw data found for 'Parker Solar Probe' on 2022-06-01 12:00:00, assuming default Vsw value of 400.0 km/s.
No Vsw data found for 'Solar Orbiter' on 2022-06-01 12:00:00, assuming default Vsw value of 400.0 km/s.
Body 'Mars' not supported, assuming default Vsw value of 400.0 km/s.
/Users/jagies/miniforge3/envs/serpentine/lib/python3.12/site-packages/speasy/core/data_containers.py:17: UserWarning: no explicit representation of timezones available for np.datetime64
  return np.searchsorted(time, np.datetime64(key, 'ns'), side='left')
Spacecraft/Body Stonyhurst longitude (°) Stonyhurst latitude (°) Heliocentric distance (AU) Longitudinal separation to Earth's longitude Latitudinal separation to Earth's latitude Vsw Magnetic footpoint longitude (Stonyhurst)
0 STEREO-A -28.467772 -3.999101 0.961350 -28.467770 -3.361511 359.677966 38.084723
1 Earth -0.000002 -0.637590 1.014043 0.000000 0.000000 439.109985 57.707026
2 BepiColombo 26.112372 -1.980526 0.570656 26.112374 -1.342935 400.000000 61.608288
3 PSP -142.048764 -2.129720 0.068022 -142.048762 -1.492130 400.000000 -138.075090
4 Solar Orbiter 164.165189 2.066308 0.933521 164.165191 2.703898 400.000000 222.413129
5 Mars 72.702613 4.867268 1.384205 72.702615 5.504858 400.000000 158.855574

5. Advanced plotting options

Since version 0.1.6, solarmach provides the option to color a cone-shaped area or an area between two Parker spirals in the heliographic plane. For this, SolarMACH.plot() has three new options:

  • long_sector: list of 2 numbers: start and stop longitude of a shaded area; e.g. [350, 20] to get a cone from 350 to 20 degree longitude (for long_sector_vsw=None`).

  • long_sector_vsw: list of 2 numbers: Solar wind speed used to calculate Parker spirals (at start and stop longitude provided by long_sector) between which a reference cone should be drawn; e.g. [400, 400] to assume for both edges of the fill area a Parker spiral produced by solar wind speeds of 400 km/s. If None, instead of Parker spirals, straight lines are used, i.e. a simple cone will be plotted. By default, None.

  • long_sector_color: String defining the matplotlib color used for the shading defined by long_sector. By default, 'red'.

In addition, it is now possible to plot a set of evenly distributed Parker spirals in the background, see 5.3 Example 3: plot background Parker spirals.

5.1 Example 1: plot cone-shaped area

[ ]:
body_list = ['STEREO-A', 'Earth', 'BepiColombo', 'PSP', 'Solar Orbiter']
vsw_list = [400, 400, 400, 400, 400]
date = '2022-3-11 12:00:00'

sm5a = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list)
sm5a.plot(long_sector=[290, 328], long_sector_vsw=None, long_sector_color='red')
_images/usage_46_0.png

5.2 Example 2: shade area between two Parker spirals

[ ]:
body_list = ['STEREO-A', 'Earth', 'BepiColombo', 'PSP', 'Solar Orbiter']
vsw_list = [400, 400, 400, 400, 400]
date = '2022-3-11 12:00:00'

sm5b = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list)
sm5b.plot(long_sector=[290, 328], long_sector_vsw=[400,600], long_sector_color='cyan')
_images/usage_48_0.png

Note that there still is a bug if the speeds in long_sector_vsw differ to some extent; then the plotting might not work as intended.

5.3 Example 3: plot background Parker spirals

Since version 0.1.6, solarmach provides the option to plot a set of evenly distributed Parker spirals in the background, using the option background_spirals in SolarMACH.plot():

background_spirals: list of 2 numbers (and 3 optional strings). If defined, plot evenly distributed Parker spirals over 360°. background_spirals[0] defines the number of spirals, background_spirals[1] the solar wind speed in km/s used for their calculation.

Optionally, background_spirals[2], background_spirals[3], and background_spirals[4] change the plotting line style, color, and alpha setting, respectively (default values ':', 'grey', and 0.1).

[ ]:
body_list = ['STEREO-A', 'Earth', 'BepiColombo', 'PSP', 'Solar Orbiter']
vsw_list = [400, 400, 400, 400, 400]
date = '2022-3-11 12:00:00'

sm = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list)
sm.plot(background_spirals=[6, 600])
_images/usage_51_0.png
[ ]:
body_list = ['STEREO-A', 'Earth', 'BepiColombo', 'PSP', 'Solar Orbiter']
vsw_list = [400, 400, 400, 400, 400]
date = '2022-3-11 12:00:00'

sm = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list)
sm.plot(background_spirals=[6, 600, '-', 'red', 0.5])
_images/usage_52_0.png

6. Advanced: edit the figure

Let’s produce again the figure for the Oct 2021 GLE event.

[ ]:
body_list = ['STEREO-A', 'Earth', 'BepiColombo', 'PSP', 'Solar Orbiter', 'Mars']
vsw_list = [340, 300, 350, 350, 320, 350]  # position-sensitive solar wind speed per body in body_list
date = '2021-10-28 15:20:00'
reference_long = 130           # Carrington longitude of reference (None to omit)
reference_lat = 0             # Carrington latitude of reference (None to omit)
reference_vsw = 400           # define solar wind speed at reference
sm6 = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list,
                reference_long=reference_long, reference_lat=reference_lat)

But now we prodive the option return_plot_object=True to the plot() call, so that the matplotlib figure and axis object will be returned:

[ ]:
fig, ax = sm6.plot(plot_spirals=True,
                   plot_sun_body_line=True,
                   transparent=False,
                   markers='numbers',
                   return_plot_object=True
                  )
_images/usage_56_0.png

Now we can make some post-adjustments to the figure (requires of course some Python knowledge):

[ ]:
ax.set_title("What's that?! A new title!", pad=60)
Text(0.5, 1.0, "What's that?! A new title!")
[ ]:
fig
_images/usage_59_0.png

We can also add another red reference arrow to the figure, e.g., to indicate another flare:

[ ]:
import numpy as np

new_reference_long = 60

arrow_dist = min([sm6.max_dist/3.2, 2.])  # arrow length
ax.arrow(np.deg2rad(new_reference_long), 0.01, 0, arrow_dist, head_width=0.2, head_length=0.07, edgecolor='red', facecolor='red', lw=1.8, zorder=5, overhang=0.2)
ax.set_rmax(sm6.max_dist + 0.3)  # re-set max. radial dist. of plot
[ ]:
fig
_images/usage_62_0.png

If you want to programmatically save the modified figure, you can do this with:

[ ]:
filename = 'solarmach_mod.png'
fig.savefig(filename, bbox_inches='tight')

7. Ideas for further usage

7.1 Loop over multiple datetimes (plots)

This might be useful to either:

  • read-in an event catalog, and loop over those datetimes to quickly get the constellations of all these events,

  • create a series of daily constellation plots, and combine them into one animation:

[ ]:
body_list = ['Mercury', 'Venus', 'Earth', 'Mars', 'STEREO A', 'STEREO B', 'Solar Orbiter', 'PSP', 'BepiColombo']
vsw_list = len(body_list) * [350]   # position-sensitive solar wind speed per body in body_list
plot_spirals = True                 # plot Parker spirals for each body
plot_sun_body_line = False          # plot straight line between Sun and body
transparent = False                 # make output figure background transparent
markers = 'numbers'                 # use 'numbers' or 'letters' for the body markers (use False for colored squares)
coord_sys='Stonyhurst'              # 'Carrington' (default) or 'Stonyhurst'
fix_earth=True                      # if True, Earth is always at a fixed longitude position. If False, the plot is oriented with 0° fixed.

for i in range(2,19,1):
    j = str(i).rjust(2, '0')
    date = f'2022-6-{j} 12:00:00'
    filename = f'animate_{date[:-9]}.png'        # define filename of output figure

    sm7 = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list, coord_sys=coord_sys)
    sm7.plot(plot_spirals=plot_spirals,
             plot_sun_body_line=plot_sun_body_line,
             fix_earth=fix_earth,
             transparent=transparent,
             markers=markers,
             outfile=filename
             )

Get a sorted list of the files just created using glob:

[ ]:
import glob
files = sorted(glob.glob(filename.replace(f'{i}', '*')))

Build an animated GIF out of these files using imageio.

Note: The fix_earth option above should be changed according to the used coordinate system. For coord_sys'=Carrington', you should use fix_earth=False; for coord_sys='Stonyhurst' fix_earth=True. Otherwise the coordinate systems will be mixed up in the animation.

[ ]:
import imageio
images_data = []
for filename in files:
    data = imageio.v2.imread(filename)
    images_data.append(data)

# write to animated gif; duration (in ms) defines how fast the animation is.
imageio.mimwrite('solarmach.gif', images_data, format= '.gif', duration=100, loop=0)

When completed, this will have created an animated GIF file solarmach.gif in the same directory as this notebook (as well as a series of files animate_DATE.png that can be deleted).

7.2 Loop over multiple datetimes (only data)

For example, to look for spacecraft alignments, like “When are PSP and Solar Orbiter at the same magnetic footpoint?”

[ ]:
body_list = ['Mercury', 'Venus', 'Earth', 'Mars', 'STEREO A', 'Solar Orbiter', 'PSP', 'BepiColombo']
vsw_list = len(body_list) * [350]  # position-sensitive solar wind speed per body in body_list

df = []
dates = []
for i in range(1,31,1):
    date = f'2022-6-{i} 12:00:00'

    sm7b = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list)
    df = df + [sm7b.coord_table]
    dates = dates + [date]
[ ]:
display(df[0])
display(df[1])
display(df[2])
Spacecraft/Body Carrington longitude (°) Carrington latitude (°) Heliocentric distance (AU) Longitudinal separation to Earth's longitude Latitudinal separation to Earth's latitude Vsw Magnetic footpoint longitude (Carrington)
0 STEREO-A 233.080604 7.169518 0.958294 -37.595981 2.455532 340 302.733100
1 Earth 270.676585 4.713986 0.993489 0.000000 0.000000 300 353.039432
2 BepiColombo 0.634907 0.905419 0.411322 -270.041678 -3.808567 350 29.801105
3 PSP 217.026554 3.853925 0.623148 -53.650031 -0.860061 350 261.252554
4 Solar Orbiter 267.858104 2.189101 0.803886 -2.818480 -2.524885 320 330.499586
5 Mars 79.738619 -4.884758 1.610970 -190.937966 -9.598744 350 194.379501
Spacecraft/Body Carrington longitude (°) Carrington latitude (°) Heliocentric distance (AU) Longitudinal separation to Earth's longitude Latitudinal separation to Earth's latitude Vsw Magnetic footpoint longitude (Carrington)
0 STEREO-A 233.080604 7.169518 0.958294 -37.595981 2.455532 340 302.733100
1 Earth 270.676585 4.713986 0.993489 0.000000 0.000000 300 353.039432
2 BepiColombo 0.634907 0.905419 0.411322 -270.041678 -3.808567 350 29.801105
3 PSP 217.026554 3.853925 0.623148 -53.650031 -0.860061 350 261.252554
4 Solar Orbiter 267.858104 2.189101 0.803886 -2.818480 -2.524885 320 330.499586
5 Mars 79.738619 -4.884758 1.610970 -190.937966 -9.598744 350 194.379501
Spacecraft/Body Carrington longitude (°) Carrington latitude (°) Heliocentric distance (AU) Longitudinal separation to Earth's longitude Latitudinal separation to Earth's latitude Vsw Magnetic footpoint longitude (Carrington)
0 STEREO-A 233.080604 7.169518 0.958294 -37.595981 2.455532 340 302.733100
1 Earth 270.676585 4.713986 0.993489 0.000000 0.000000 300 353.039432
2 BepiColombo 0.634907 0.905419 0.411322 -270.041678 -3.808567 350 29.801105
3 PSP 217.026554 3.853925 0.623148 -53.650031 -0.860061 350 261.252554
4 Solar Orbiter 267.858104 2.189101 0.803886 -2.818480 -2.524885 320 330.499586
5 Mars 79.738619 -4.884758 1.610970 -190.937966 -9.598744 350 194.379501
[ ]:
display(dates)
['2022-6-1 12:00:00',
 '2022-6-2 12:00:00',
 '2022-6-3 12:00:00',
 '2022-6-4 12:00:00',
 '2022-6-5 12:00:00',
 '2022-6-6 12:00:00',
 '2022-6-7 12:00:00',
 '2022-6-8 12:00:00',
 '2022-6-9 12:00:00',
 '2022-6-10 12:00:00',
 '2022-6-11 12:00:00',
 '2022-6-12 12:00:00',
 '2022-6-13 12:00:00',
 '2022-6-14 12:00:00',
 '2022-6-15 12:00:00',
 '2022-6-16 12:00:00',
 '2022-6-17 12:00:00',
 '2022-6-18 12:00:00',
 '2022-6-19 12:00:00',
 '2022-6-20 12:00:00',
 '2022-6-21 12:00:00',
 '2022-6-22 12:00:00',
 '2022-6-23 12:00:00',
 '2022-6-24 12:00:00',
 '2022-6-25 12:00:00',
 '2022-6-26 12:00:00',
 '2022-6-27 12:00:00',
 '2022-6-28 12:00:00',
 '2022-6-29 12:00:00',
 '2022-6-30 12:00:00']

8. Interactive 3D figure

Solar-MACH can also provide a fully interactive 3D view of the heliospheric observer situation. This is especially interesting for out of the ecliptic missions like Ulysses or Solar Orbiter.

The initialization is the same as for the classic Solar-MACH plot:

[2]:
date = '2030-7-1 13:00:00'
body_list = ['Earth', 'Mars', 'Venus', 'Solar Orbiter']
vsw_list = len(body_list) * [350]
sm8 = SolarMACH(date=date, body_list=body_list, vsw_list=vsw_list)
/Users/jagies/miniforge3/envs/dev_smach/lib/python3.12/site-packages/erfa/core.py:133: ErfaWarning: ERFA function "dtf2d" yielded 1 of "dubious year (Note 6)"
  warn(f'ERFA function "{func_name}" yielded {wmsg}', ErfaWarning)
/Users/jagies/miniforge3/envs/dev_smach/lib/python3.12/site-packages/erfa/core.py:133: ErfaWarning: ERFA function "utctai" yielded 1 of "dubious year (Note 3)"
  warn(f'ERFA function "{func_name}" yielded {wmsg}', ErfaWarning)
/Users/jagies/miniforge3/envs/dev_smach/lib/python3.12/site-packages/erfa/core.py:133: ErfaWarning: ERFA function "taiutc" yielded 1 of "dubious year (Note 4)"
  warn(f'ERFA function "{func_name}" yielded {wmsg}', ErfaWarning)
/Users/jagies/miniforge3/envs/dev_smach/lib/python3.12/site-packages/erfa/core.py:133: ErfaWarning: ERFA function "d2dtf" yielded 1 of "dubious year (Note 5)"
  warn(f'ERFA function "{func_name}" yielded {wmsg}', ErfaWarning)

Now, instead of sm8.plot(), sm8.plot_3d() is used. It has partly the same options, but also some new ones:

[3]:
sm8.plot_3d?
Signature:
sm8.plot_3d(
    plot_spirals=True,
    plot_sun_body_line=True,
    plot_vertical_line=False,
    markers=False,
    numbered_markers=False,
    plot_equatorial_plane=True,
    plot_3d_grid=True,
    reference_vsw=400,
    return_plot_object=False,
)
Docstring:
Generates a 3D plot of the solar system with various optional features.

Parameters:
-----------
plot_spirals : bool, optional
    If True, plots the magnetic field lines as spirals. Default is True.
plot_sun_body_line : bool, optional
    If True, plots direct lines from the Sun to each body. Default is True.
plot_vertical_line : bool, optional
    If True, plots vertical lines from the heliographic equatorial plane to each body. Default is False.
markers : bool or str, optional
    If True or 'letters'/'numbers', plot markers at body positions. Default is False.
plot_equatorial_plane : bool, optional
    If True, plots the equatorial plane. Default is True.
plot_3d_grid : bool, optional
    If True, plots grid and axis for x, y, z. Default is True.
reference_vsw : int, optional
    The reference solar wind speed in km/s. Default is 400.
return_plot_object: bool, optional
    if True, figure object of plotly is returned, allowing further adjustments to the figure
numbered_markers: bool, deprecated
    Deprecated option, use markers='numbers' instead!

Returns
-------
plotly figure or None
    Returns the plotly figure if return_plot_object=True (by default set to False), else nothing.
File:      ~/uni/serpentine/solarmach/solarmach/__init__.py
Type:      method

The resulting figure can be tilted/rotated (panned) by pressing the left (right) mouse botton and moving it. Mouse wheel zooms in and out.

[4]:
fig = sm8.plot_3d(plot_spirals=True, plot_sun_body_line=True, plot_vertical_line=True, markers=False,
                  plot_equatorial_plane=True, plot_3d_grid=False, reference_vsw=400, return_plot_object=True)
/Users/jagies/miniforge3/envs/dev_smach/lib/python3.12/site-packages/erfa/core.py:133: ErfaWarning:

ERFA function "d2dtf" yielded 1 of "dubious year (Note 5)"