# Elongation & position angle in WCS coordinates

I’m interested in using Astropy’s WCS machinery to work in coordinates of solar elongation and position angle (e.g. assigning elongation/position angle coordinates to positions in a FITS image, plotting in those coordinates with WCSAxes, etc.). I haven’t been able to find existing support for these coordinates and I’m wondering if anyone can offer pointers. If this is not currently supported, I’d also welcome suggestions on how I might help implement this.

`astropy.coordinates.SkyCoord` has `position_angle` and `separation` methods that could be used to convert individual helioprojective coordinates to elongation & PA, but I’d like to produce a WCS object describing this coordinate frame that can be e.g. used to display a coordinate grid with WCSAxes or used with the `reproject` module to convert between different projections of these coordinates.

What I’ve been hoping to find is a way to do something like:

``````wcs = WCS(naxis=2)
wcs.wcs.ctype = "ELON-ARC", "POSA-ARC"
...
``````

to create an elongation/position angle WCS system in any given projection that works with all tools that accept WCS objects. (In a perfect world, there might also be a utility to produce this WCS automatically from a given helioprojective WCS object.)

Solar elongation and position angle are a coordinate system measuring an angular distance away from the Sun (elongation) and an angular position around the Sun (position angle), as measured on the celestial sphere of the observer. Close to the Sun, they’re approximately a 2D polar coordinate system, where the radial position is measured in degrees. In general, they’re a spherical coordinate system with one pole centered on the Sun, so that longitude serves as position angle, and latitude serves as elongation angle—but with latitude running from 0 degrees at the Solar pole to 180 degrees at the anti-solar pole, rather than the normal +90 to -90.

I believe the coordinate system you want is equivalent to “helioprojective radial”, which corresponds to the WCS labels `HRLN` (or `HCPA`) and `HRLT`. Unfortunately, we in SunPy have not yet implemented this coordinate frame (see Add Helioprojective Radial frame to coordinates · Issue #5561 · sunpy/sunpy · GitHub for the tracking issue). The primary sticking point has been how to best handle the latitude/declination running from 0 to 180 instead of -90 to +90.

In the meantime, to achieve reprojection to helioprojective radial, you can craft a WCS where the pole of the spherical-coordinates WCS projection is at disk center. Here’s an example:

Go to the issue linked above for the code to generate this plot.

1 Like

I think that is the coordinate system and WCS label I’m interested in. That’s a really useful pointer, thanks! I’ll take a close look later at that stagnant PR and I may try to adopt & push forward the implementation.