Reprojecting a Helioprojective Map to Helioprojective Radial#

In this example we use reproject to transform a helioprojective Map to helioprojective radial.

import matplotlib.pyplot as plt

import astropy.units as u

import sunpy.data.sample
import sunpy.map
from sunpy.coordinates import HelioprojectiveRadial
from sunpy.map.header_helper import make_hpr_header
from sunpy.visualization import show_hpr_impact_angle

Let’s start with an AIA map in the helioprojective Cartesian (Helioprojective) frame.

We now plot the map and overlay grid lines for position angle in the helioprojective radial (HelioprojectiveRadial) frame.

fig = plt.figure()
ax = fig.add_subplot(projection=aia_map)
aia_map.plot(axes=ax)

overlay = ax.get_coords_overlay(
    HelioprojectiveRadial(
        obstime=aia_map.reference_date,
        observer=aia_map.observer_coordinate
    )
)

overlay['delta'].add_tickable_gridline('limb', 960*u.arcsec - 90*u.deg)

overlay['psi'].grid(color='red', linestyle='dashed')
overlay['psi'].set_ticks(spacing=30*u.deg)
overlay['psi'].set_ticks_visible(False)
overlay['psi'].set_ticklabel(color='red')
overlay['psi'].set_ticklabel_position(('limb',))
overlay['psi'].set_axislabel('Helioprojective Position Angle', color='red')
overlay['psi'].set_axislabel_position('r')

overlay['delta'].set_ticks_visible(False)
overlay['delta'].set_ticklabel_visible(False)
overlay['delta'].set_axislabel('')
AIA $193 \; \mathrm{\mathring{A}}$ 2011-06-07 06:33:07

In order to reproject this map to a helioprojective radial frame, we use sunpy.map.make_hpr_header() to create an appropriate FITS WCS header.

With the new header, reproject the data into the new coordinate frame. The reproject_to() defaults to using the fast reproject.reproject_interp() algorithm, but a different algorithm can be specified (e.g., reproject.reproject_adaptive()).

Now we plot the reprojected map. First we add an overlay for the original helioprojective Cartesian frame, but disable its associated ticks and labels.

Due to the FITS WCS machinery, the impact-angle component of helioprojective radial is instead stored as a declination by subtracting 90 degrees, and the vertical axis being declination can be unfamiliar. To change the declination tick labels to impact-angle tick labels, we use show_hpr_impact_angle() to modify the rendering of the tick labels on the appropriate axis (ax.coords[1]).

show_hpr_impact_angle(ax.coords[1])
ax.coords[1].set_format_unit('arcsec')

plt.show()
2011-06-07 06:33:08

Total running time of the script: (0 minutes 1.022 seconds)

🏷 Tags: Map, Reproject, AIA, Coordinates

Gallery generated by Sphinx-Gallery