Overplotting the position of the Venus transit

How to accurately plot the position of Venus as it transitted in front of the Sun as observed by SDO/AIA.

import matplotlib.pyplot as plt

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

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

Let’s download an image of the Venus transit.

result = Fido.search(a.Time('2012/06/06 04:07:25', '2012/06/06 04:07:35'),
                     a.Instrument('aia'),
                     a.Wavelength(1600*u.angstrom))
files = Fido.fetch(result)
aiamap = sunpy.map.Map(files[0])

Out:

/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/site-packages/parfive/downloader.py:86: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self.http_queue = asyncio.Queue(loop=self.loop)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/asyncio/queues.py:48: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self._finished = locks.Event(loop=loop)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/site-packages/parfive/downloader.py:87: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self.http_tokens = asyncio.Queue(maxsize=self.max_conn, loop=self.loop)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/asyncio/queues.py:48: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self._finished = locks.Event(loop=loop)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/site-packages/parfive/downloader.py:88: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self.ftp_queue = asyncio.Queue(loop=self.loop)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/asyncio/queues.py:48: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self._finished = locks.Event(loop=loop)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/site-packages/parfive/downloader.py:89: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self.ftp_tokens = asyncio.Queue(maxsize=self.max_conn, loop=self.loop)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/asyncio/queues.py:48: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self._finished = locks.Event(loop=loop)

Files Downloaded:   0%|          | 0/1 [00:00<?, ?file/s]/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/site-packages/aiohttp/connector.py:964: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  hosts = await asyncio.shield(self._resolve_host(
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/site-packages/aiohttp/locks.py:21: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  self._event = asyncio.Event(loop=loop)


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

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   0%|          | 29.9k/7.54M [00:00<00:26, 279kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   1%|1         | 90.0k/7.54M [00:00<00:23, 315kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   2%|1         | 142k/7.54M [00:00<00:21, 349kB/s] 

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   3%|3         | 236k/7.54M [00:00<00:18, 400kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   5%|4         | 368k/7.54M [00:00<00:14, 487kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   6%|6         | 473k/7.54M [00:00<00:12, 569kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   9%|8         | 665k/7.54M [00:00<00:10, 681kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  12%|#1        | 899k/7.54M [00:01<00:07, 835kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  14%|#4        | 1.09M/7.54M [00:01<00:06, 983kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  19%|#8        | 1.40M/7.54M [00:01<00:05, 1.16MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  23%|##3       | 1.74M/7.54M [00:01<00:04, 1.45MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  26%|##5       | 1.95M/7.54M [00:01<00:03, 1.58MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  31%|###1      | 2.35M/7.54M [00:01<00:02, 1.85MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  36%|###5      | 2.68M/7.54M [00:01<00:02, 2.09MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  43%|####2     | 3.23M/7.54M [00:01<00:01, 2.38MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  51%|#####     | 3.84M/7.54M [00:02<00:01, 2.78MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  57%|#####6    | 4.28M/7.54M [00:02<00:01, 3.06MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  66%|######5   | 4.95M/7.54M [00:02<00:00, 3.35MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  74%|#######4  | 5.60M/7.54M [00:02<00:00, 3.92MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  80%|########  | 6.06M/7.54M [00:02<00:00, 3.99MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  88%|########8 | 6.65M/7.54M [00:02<00:00, 4.19MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  95%|#########5| 7.17M/7.54M [00:02<00:00, 4.31MB/s]

                                                                                                            
Files Downloaded: 100%|##########| 1/1 [00:04<00:00,  4.92s/file]
Files Downloaded: 100%|##########| 1/1 [00:04<00:00,  4.92s/file]
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/asyncio/base_events.py:654: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
  _warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)

For this example, we require high-precision ephemeris information. The built-in ephemeris provided by astropy is not accurate enough. This call requires jplephem to be installed. This will also trigger a download of about ~10 MB.

solar_system_ephemeris.set('de432s')

Out:

<ScienceState solar_system_ephemeris: 'de432s'>

Now we get the position of Venus and convert it into the SDO/AIA coordinates. The apparent position of Venus accounts for the time it takes for light to travel from Venus to SDO.

venus = get_body_heliographic_stonyhurst('venus', aiamap.date, observer=aiamap.observer_coordinate)
venus_hpc = venus.transform_to(aiamap.coordinate_frame)

Out:

INFO: Apparent body location accounts for 144.14 seconds of light travel time [sunpy.coordinates.ephemeris]

Let’s crop the image with Venus at its center.

fov = 100 * u.arcsec
top_right = SkyCoord(venus_hpc.Tx + fov, venus_hpc.Ty + fov, frame=aiamap.coordinate_frame)
bottom_left = SkyCoord(venus_hpc.Tx - fov, venus_hpc.Ty - fov, frame=aiamap.coordinate_frame)
smap = aiamap.submap(top_right, bottom_left)

Let’s plot the results.

ax = plt.subplot(projection=smap)
smap.plot()
smap.draw_limb()
ax.grid(False)
ax.plot_coord(venus_hpc, 'x', color='deepskyblue', label='Venus')
plt.legend()
plt.show()
../../../_images/sphx_glr_venus_transit_001.png

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

Gallery generated by Sphinx-Gallery