Drawing heliographic longitude and latitude lines¶

How to draw your own (Stonyhurst) longitude and latitude lines.

import matplotlib.pyplot as plt
import numpy as np

import astropy.units as u
from astropy.coordinates import SkyCoord

import sunpy.map
from sunpy.coordinates import frames
from sunpy.data.sample import AIA_171_IMAGE

The purpose of this example is to demonstrate the coordinate transformations that occur under the hood to show the heliographic grid lines of longitude latitude. We first create the Map using the sample data.

aia = sunpy.map.Map(AIA_171_IMAGE)

Let’s first transform a single heliographic point coordinate.

Next we transform it into the coordinate frame of our map which is in helioprojective coordinates.

Out:

<SkyCoord (Helioprojective: obstime=2011-06-07T06:33:02.770, rsun=696000.0 km, observer=<HeliographicStonyhurst Coordinate (obstime=2011-06-07T06:33:02.770, rsun=696000.0 km): (lon, lat, radius) in (deg, deg, m)
(-0.00406234, 0.04787238, 1.51846026e+11)>): (Tx, Ty, distance) in (arcsec, arcsec, km)
(193.09898111, 196.58816167, 1.51180424e+08)>

Now let’s define two lines, one of longitude and one of of latitude. We don’t need to explicitly transform them to the coordinate frame of our map because they will be transformed automatically when plotted.

Now let’s plot the results. We’ll overlay the autogenerated lon/lat grid as well for comparison.

fig = plt.figure()
ax = plt.subplot(projection=aia)
aia.plot(clip_interval=(1, 99.99)*u.percent)
ax.plot_coord(lat0, color="C0")
ax.plot_coord(lon0, color="C0")
aia.draw_grid()

plt.show() Total running time of the script: ( 0 minutes 1.176 seconds)

Gallery generated by Sphinx-Gallery