coconut_tools.solarmach_plot

SolarMACH helper: plot and list positions of planets/spacecraft.

This module provides thin wrappers around solarmach to: - create a publication-ready SolarMACH plot, and - export the position table to CSV.

Notes

  • SolarMACH expects UTC timestamps (e.g. "YYYY-MM-DD HH:MM:SS").

  • Coordinate systems supported here: "Carrington" and "Stonyhurst".

  • We import solarmach lazily inside functions so Sphinx/RTD can import this module even if solarmach is not installed.

Examples

As a module:

from coconut_tools.solarmach_plot import run_solarmach, DEFAULT_BODIES

run_solarmach(
    date="2025-08-13 12:00:00",
    bodies=DEFAULT_BODIES,
    outfile="fig_solarmach.png",
    csv_out="positions.csv",
    coords="Carrington",
)

From the command line (when executing this file directly):

python solarmach_plot.py

Functions

list_bodies()

Print a subset of body keys supported by SolarMACH.

main([date, bodies, coords, outfile, ...])

Convenience wrapper to call run_solarmach() without CLI parsing.

run_solarmach(date[, bodies, outfile, ...])

Create a SolarMACH plot and dump positions to CSV.

coconut_tools.solarmach_plot.list_bodies()[source]

Print a subset of body keys supported by SolarMACH.

Return type:

None

coconut_tools.solarmach_plot.main(date=None, bodies=None, coords='Carrington', outfile='solarmach_plot.png', csv_out='positions.csv', plot_spirals=True, plot_sun_body_line=True)[source]

Convenience wrapper to call run_solarmach() without CLI parsing.

Parameters:
  • date (str | None)

  • bodies (List[str] | None)

  • coords (str)

  • outfile (str | None)

  • csv_out (str | None)

  • plot_spirals (bool)

  • plot_sun_body_line (bool)

coconut_tools.solarmach_plot.run_solarmach(date, bodies=None, outfile='solarmach_plot.png', csv_out='positions.csv', coords='Carrington', reference_long=180, reference_lat=0, plot_spirals=True, plot_sun_body_line=True, reference_vsw=400.0, long_offset=0.0)[source]

Create a SolarMACH plot and dump positions to CSV.

Args

date:

UTC datetime string, e.g. "2025-08-13 12:00:00".

bodies:

Bodies/spacecraft to include. If None, uses DEFAULT_BODIES.

outfile:

PNG path to save the plot. If None, the figure is not saved.

csv_out:

CSV path to save the coordinate table. If None, not saved.

coords:

Coordinate system, "Carrington" or "Stonyhurst".

reference_long, reference_lat:

Reference longitude/latitude passed to SolarMACH (degrees).

plot_spirals, plot_sun_body_line:

Toggle Parker spirals and Sun–body line.

reference_vsw:

Reference solar-wind speed (km/s) used for spirals.

long_offset:

Longitude offset (degrees) added to plotted positions.

Returns

pandas.DataFrame

The coordinate table returned by SolarMACH (also printed).

Parameters:
  • date (str)

  • bodies (List[str] | None)

  • outfile (str | None)

  • csv_out (str | None)

  • coords (str)

  • reference_long (float | None)

  • reference_lat (float | None)

  • plot_spirals (bool)

  • plot_sun_body_line (bool)

  • reference_vsw (float)

  • long_offset (float)