I’m trying to match of the view of a 3-D rendered PFSS model with the view from SDO.
I have a kind of messy way to get the heliographic longitude and latitude via SpiceyPy and appropriate kernels, but wonder if there might be a more elegant way in SunPy.
Most of the SunPy coordinate examples seem focused on Earth-based observatories, but certainly someone has done this for spacecraft observatories.
Converting to Carrington heliographic coordinates can be unintuitive because Carrington longitude is implemented in sunpy in a way that may be unfamiliar to you (and may disagree with some sources). See Calculating Carrington longitude — sunpy 6.0.1 documentation
>>> from sunpy.coordinates import HeliographicCarrington
>>> sdo_hgc = sdo.transform_to(HeliographicCarrington(obstime=sdo.obstime, observer="self"))
>>> print(sdo_hgc)
<SkyCoord (HeliographicCarrington: obstime=2024-09-04T00:00:00.000, rsun=695700.0 km, observer=self): (lon, lat, radius) in (deg, deg, AU)
(205.90158338, 7.24335971, 1.00849196)>
import sunpy.coordinates
from sunpy.time import parse_time
from astropy.time import Time
import astropy.units as u
# Import get_horizons_coord for SDO coordinates retrieval
from sunpy.coordinates.ephemeris import get_horizons_coord
# Define the time for which you want the SDO location
time = Time('2024-09-04T00:00:00')
# Get the SDO coordinates from JPL Horizons
sdo_coord = get_horizons_coord('SDO', time)
# Convert to Heliographic Stonyhurst coordinates
heliographic_coord = sdo_coord.transform_to(sunpy.coordinates.HeliographicStonyhurst)