Converting line-of-sight measurements to Heliographic (Carrington) coordinates

Hello! I am trying to convert some line-of-sight measurements to Heliographic (Carrington) coordinates, and display it in a similar way to how it is done in Grail, et al. 1996 (Rapid acceleration of the polar solar wind | Nature).

In Fig. 2 in the above paper, they have an X-ray emission Carrington map of the solar surface, with the line-of-sight path plotted on top, mapped back down to the surface of the Sun.

Currently, the solution that I have is, say we have a set of coordinates defined by an RA, a Delc., and a distance from the centre of the Earth, in a GCRS frame. The distances that are supplied are just a linear spacing from 0 to 2 AU in 20 increments. Below is an example of such a set of coordinates:
(ra, dec, distance) in (deg, deg, AU):
[(19.3, 11.4, 0.1), (19.3, 11.4, 0.2), (19.3, 11.4, 0.3),
(19.3, 11.4, 0.4), (19.3, 11.4, 0.5), (19.3, 11.4, 0.6),
(19.3, 11.4, 0.7), (19.3, 11.4, 0.8), (19.3, 11.4, 0.9),
(19.3, 11.4, 1. ), (19.3, 11.4, 1.1), (19.3, 11.4, 1.2),
(19.3, 11.4, 1.3), (19.3, 11.4, 1.4), (19.3, 11.4, 1.5),
(19.3, 11.4, 1.6), (19.3, 11.4, 1.7), (19.3, 11.4, 1.8),
(19.3, 11.4, 1.9), (19.3, 11.4, 2. )]

Using Astropy we are able to transform this into a Heliocentric Mean Ecliptic frame, leaving us with the following:
(lon, lat, distance) in (deg, deg, AU)
[(239.7810603 , 0.32515096, 0.93044418),
(243.88060586, 0.70662423, 0.85362793),
(248.76056114, 1.15575947, 0.78207093),
(254.57258668, 1.6792986 , 0.71734874),
(261.45303386, 2.27600686, 0.66147071),
(269.46843315, 2.92869061, 0.61684503),
(278.53436457, 3.59661993, 0.58604784),
(288.34345566, 4.21695063, 0.57131984),
(298.37679583, 4.72341964, 0.5738995 ),
(308.04237273, 5.07492997, 0.59356122),
(316.86577095, 5.27061941, 0.62870438),
(324.598759 , 5.34015259, 0.67692206),
(331.20270391, 5.3230799 , 0.73564785),
(336.7683473 , 5.25410949, 0.80257837),
(341.43974238, 5.15813434, 0.87583464),
(345.36731083, 5.05100295, 0.95396048),
(348.68629384, 4.94201515, 1.03585466),
(351.5101431 , 4.83624985, 1.12069137),
(353.93088445, 4.73623771, 1.20785075),
(356.02203633, 4.64303628, 1.29686457)]

With good results from Astropy, it seems simple enough to convert the original array to SunPy’s Heliographic Carrington, but it doesn’t seem to be working!

Would anyone know how to tackle such a problem using SunPy?

1 Like

It’d be helpful if you provided an example of what exactly isn’t working for you. I’m guessing you are missing that HeliographicCarrington requires the specification of the observer location. Here’s an example:

>>> import numpy as np
>>> import astropy.units as u
>>> from astropy.coordinates import SkyCoord
>>> from sunpy.coordinates import HeliographicCarrington

>>> carr_frame = HeliographicCarrington(observer='earth', obstime='2022-07-04')
>>> print(carr_frame)
<HeliographicCarrington Frame (obstime=2022-07-04T00:00:00.000, rsun=695700.0 km, observer=<HeliographicStonyhurst Coordinate for 'earth'>)>

>>> los = SkyCoord(100*u.deg, 25*u.deg, np.linspace(0.1, 2., 20)*u.AU, frame='gcrs', obstime=carr_frame.obstime)
>>> print(los)
<SkyCoord (GCRS: obstime=2022-07-04T00:00:00.000, obsgeoloc=(0., 0., 0.) m, obsgeovel=(0., 0., 0.) m / s): (ra, dec, distance) in (deg, deg, AU)
    [(100., 25., 0.1), (100., 25., 0.2), (100., 25., 0.3),
     (100., 25., 0.4), (100., 25., 0.5), (100., 25., 0.6),
     (100., 25., 0.7), (100., 25., 0.8), (100., 25., 0.9),
     (100., 25., 1. ), (100., 25., 1.1), (100., 25., 1.2),
     (100., 25., 1.3), (100., 25., 1.4), (100., 25., 1.5),
     (100., 25., 1.6), (100., 25., 1.7), (100., 25., 1.8),
     (100., 25., 1.9), (100., 25., 2. )]>

>>> print(los.transform_to(carr_frame))
<SkyCoord (HeliographicCarrington: obstime=2022-07-04T00:00:00.000, rsun=695700.0 km, observer=<HeliographicStonyhurst Coordinate for 'earth'>): (lon, lat, radius) in (deg, deg, AU)
    [(234.36881052,  3.40689981, 0.91689447),
     (234.69952888,  3.7008736 , 0.81711766),
     (235.12253619,  4.07641589, 0.71740301),
     (235.68265375,  4.5727952 , 0.61778061),
     (236.45925214,  5.25914055, 0.51830367),
     (237.60733781,  6.2691879 , 0.41907576),
     (239.47508646,  7.89830175, 0.32032843),
     (243.03511346, 10.94221225, 0.22270183),
     (252.31114218, 18.34451093, 0.12877077),
     (303.19427132, 40.48896984, 0.05973036),
     ( 24.95000717, 21.13313537, 0.10273031),
     ( 38.59971763, 10.49540567, 0.19375065),
     ( 43.09060233,  6.62619473, 0.29073203),
     ( 45.29425151,  4.68653612, 0.38924402),
     ( 46.59963476,  3.52869723, 0.48836125),
     ( 47.46216786,  2.76096748, 0.5877776 ),
     ( 48.07426871,  2.21513601, 0.6873633 ),
     ( 48.53108277,  1.80734326, 0.78705407),
     ( 48.88500972,  1.49118826, 0.88681447),
     ( 49.16727096,  1.23894322, 0.98662338)]>
3 Likes

Thank you very much for this. This solution has fixed my issue, I believe I was not specifying the observation time correctly in both the GCRS and HeliographicCarrington frame.