Drawing the AIA limb on a STEREO EUVI image

In this example we use a STEREO-B and an SDO image to demonstrate how to overplot the limb as seen by AIA on an EUVI-B image. Then we overplot the AIA coordinate grid on the STEREO image.

import numpy as np
import matplotlib.pyplot as plt

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

import sunpy.map
import sunpy.coordinates.wcs_utils
from sunpy.net import Fido, attrs as a

The first step is to download some data, we are going to get an image from early 2011 when the STEREO spacecraft were roughly 90 deg separated from the Earth.

stereo = (a.vso.Source('STEREO_B') &
          a.Instrument('EUVI') &
          a.Time('2011-01-01', '2011-01-01T00:10:00'))

aia = (a.Instrument('AIA') &
       a.vso.Sample(24 * u.hour) &
       a.Time('2011-01-01', '2011-01-02'))

wave = a.Wavelength(30 * u.nm, 31 * u.nm)
result = Fido.search(wave, aia | stereo)

Out:

/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/sunpy-1.0.3.dev1+gece6362cd-py3.7-linux-x86_64.egg/sunpy/net/vso/attrs.py:162: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  if not (isinstance(self.start, collections.Hashable) and

Let’s inspect the result

print(result)

Out:

Results from 2 Providers:

1 Results from the VSOClient:
   Start Time [1]       End Time [1]    Source ...   Type   Wavelength [2]
                                               ...             Angstrom
       str19               str19         str3  ...   str8      float64
------------------- ------------------- ------ ... -------- --------------
2011-01-01 00:00:08 2011-01-01 00:00:09    SDO ... FULLDISK 304.0 .. 304.0

1 Results from the VSOClient:
   Start Time [1]       End Time [1]     Source  ...   Type   Wavelength [2]
                                                 ...             Angstrom
       str19               str19          str8   ...   str8      float64
------------------- ------------------- -------- ... -------- --------------
2011-01-01 00:07:01 2011-01-01 00:07:05 STEREO_B ... FULLDISK 304.0 .. 304.0

and download the files

downloaded_files = Fido.fetch(result)
print(downloaded_files)

Out:

Files Downloaded:   0%|          | 0/2 [00:00<?, ?file/s]


secchi_l0_b_img_euvi_20110101_20110101_000615_n4eub.fts:   0%|          | 0.00/8.41M [00:00<?, ?B/s]


secchi_l0_b_img_euvi_20110101_20110101_000615_n4eub.fts:  13%|#3        | 1.11M/8.41M [00:00<00:00, 11.1MB/s]


secchi_l0_b_img_euvi_20110101_20110101_000615_n4eub.fts:  40%|###9      | 3.36M/8.41M [00:00<00:00, 13.1MB/s]


secchi_l0_b_img_euvi_20110101_20110101_000615_n4eub.fts:  68%|######8   | 5.72M/8.41M [00:00<00:00, 15.1MB/s]


secchi_l0_b_img_euvi_20110101_20110101_000615_n4eub.fts:  86%|########6 | 7.24M/8.41M [00:00<00:00, 15.1MB/s]


                                                                                                             
Files Downloaded:  50%|#####     | 1/2 [00:00<00:00,  1.16file/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   0%|          | 0.00/9.83M [00:00<?, ?B/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   0%|          | 29.2k/9.83M [00:00<00:37, 261kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   1%|          | 88.4k/9.83M [00:00<00:31, 314kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   1%|1         | 118k/9.83M [00:00<00:32, 299kB/s] 

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   2%|1         | 196k/9.83M [00:00<00:26, 366kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   3%|2         | 261k/9.83M [00:00<00:22, 419kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   4%|3         | 360k/9.83M [00:00<00:18, 507kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   5%|4         | 452k/9.83M [00:00<00:16, 585kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   6%|5         | 578k/9.83M [00:00<00:13, 695kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   7%|7         | 701k/9.83M [00:00<00:11, 798kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:   9%|8         | 862k/9.83M [00:01<00:09, 940kB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  10%|#         | 1.03M/9.83M [00:01<00:08, 1.08MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  13%|#2        | 1.23M/9.83M [00:01<00:06, 1.25MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  14%|#4        | 1.40M/9.83M [00:01<00:06, 1.37MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  17%|#6        | 1.64M/9.83M [00:01<00:05, 1.57MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  19%|#8        | 1.86M/9.83M [00:01<00:04, 1.72MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  22%|##1       | 2.14M/9.83M [00:01<00:03, 1.93MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  25%|##4       | 2.44M/9.83M [00:01<00:03, 2.16MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  28%|##8       | 2.76M/9.83M [00:01<00:02, 2.39MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  32%|###1      | 3.12M/9.83M [00:01<00:02, 2.66MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  36%|###5      | 3.53M/9.83M [00:02<00:02, 2.98MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  40%|###9      | 3.92M/9.83M [00:02<00:01, 3.21MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  45%|####5     | 4.44M/9.83M [00:02<00:01, 3.62MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  50%|#####     | 4.92M/9.83M [00:02<00:01, 3.92MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  56%|#####5    | 5.49M/9.83M [00:02<00:01, 4.29MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  62%|######2   | 6.13M/9.83M [00:02<00:00, 4.75MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  70%|######9   | 6.85M/9.83M [00:02<00:00, 5.29MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  78%|#######7  | 7.64M/9.83M [00:02<00:00, 5.88MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  86%|########6 | 8.48M/9.83M [00:02<00:00, 6.45MB/s]

aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits:  94%|#########4| 9.28M/9.83M [00:02<00:00, 6.86MB/s]

                                                                                                           
Files Downloaded: 100%|##########| 2/2 [00:03<00:00,  1.50s/file]
['/home/docs/sunpy/data/secchi_l0_b_img_euvi_20110101_20110101_000615_n4eub.fts', '/home/docs/sunpy/data/aia_lev1_304a_2011_01_01t00_00_08_12z_image_lev1.fits']

Let’s create a dictionary with the two maps, which we crop to full disk.

maps = {m.detector: m.submap(SkyCoord([-1100, 1100], [-1100, 1100],
                                      unit=u.arcsec, frame=m.coordinate_frame))
        for m in sunpy.map.Map(downloaded_files)}

Next, let’s calculate points on the limb in the AIA image for the half that can be seen from STEREO’s point of view.

r = maps['AIA'].rsun_obs - 1 * u.arcsec  # remove one arcsec so it's on disk.
# Adjust the following range if you only want to plot on STEREO_A
th = np.linspace(-180 * u.deg, 0 * u.deg)
x = r * np.sin(th)
y = r * np.cos(th)
coords = SkyCoord(x, y, frame=maps['AIA'].coordinate_frame)

Now, let’s plot both maps

fig = plt.figure(figsize=(10, 4))
ax1 = fig.add_subplot(1, 2, 1, projection=maps['AIA'])
maps['AIA'].plot(axes=ax1)
maps['AIA'].draw_limb()

ax2 = fig.add_subplot(1, 2, 2, projection=maps['EUVI'])
maps['EUVI'].plot(axes=ax2)
ax2.plot_coord(coords, color='w')
../../../_images/sphx_glr_AIA_limb_STEREO_001.png

Let’s also plot the helioprojective coordinate grid as seen by SDO on the STEREO image.

fig = plt.figure()
ax = plt.subplot(projection=maps['EUVI'])

maps['EUVI'].plot()

# Move the title so it does not clash with the extra labels.
tx, ty = ax.title.get_position()
ax.title.set_position([tx, ty + 0.08])

# Change the default grid labels.
stereo_x, stereo_y = ax.coords
stereo_x.set_axislabel("Helioprojective Longitude (STEREO B) [arcsec]")
stereo_y.set_axislabel("Helioprojective Latitude (STEREO B) [arcsec]")

# Add a new coordinate overlay in the SDO frame.
overlay = ax.get_coords_overlay(maps['AIA'].coordinate_frame)
overlay.grid()

# Configure the grid:
x, y = overlay

# Set the ticks to be on the top and left axes.
x.set_ticks_position('tr')
y.set_ticks_position('tr')

# Wrap the longitude at 180 deg rather than the default 360.
x.set_coord_type('longitude', 180.)

# Change the defaults to arcseconds
x.set_major_formatter('s.s')
y.set_major_formatter('s.s')

# Add axes labels
x.set_axislabel("Helioprojective Longitude (SDO) [arcsec]")
y.set_axislabel("Helioprojective Latitude (SDO) [arcsec]")
plt.show()
../../../_images/sphx_glr_AIA_limb_STEREO_002.png

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

Gallery generated by Sphinx-Gallery