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:   1%|          | 51.7k/7.54M [00:00<00:20, 367kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   2%|1         | 135k/7.54M [00:00<00:17, 414kB/s] 

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   3%|3         | 238k/7.54M [00:00<00:15, 475kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   5%|5         | 382k/7.54M [00:00<00:12, 566kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   7%|7         | 557k/7.54M [00:00<00:10, 676kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  10%|#         | 771k/7.54M [00:00<00:08, 810kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  14%|#3        | 1.04M/7.54M [00:00<00:06, 977kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  18%|#8        | 1.36M/7.54M [00:01<00:05, 1.18MB/s]

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

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  30%|##9       | 2.25M/7.54M [00:01<00:02, 1.82MB/s]

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

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  44%|####4     | 3.32M/7.54M [00:01<00:01, 2.62MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  53%|#####3    | 4.01M/7.54M [00:01<00:01, 3.07MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  64%|######4   | 4.82M/7.54M [00:01<00:00, 3.78MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  77%|#######6  | 5.78M/7.54M [00:01<00:00, 4.61MB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  90%|######### | 6.80M/7.54M [00:02<00:00, 5.52MB/s]

                                                                                                            
Files Downloaded: 100%|##########| 1/1 [00:02<00:00,  2.96s/file]
Files Downloaded: 100%|##########| 1/1 [00:02<00:00,  2.96s/file]
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/asyncio/base_events.py:650: 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 8.932 seconds)

Gallery generated by Sphinx-Gallery