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/v1.1.4/lib/python3.8/site-packages/parfive/downloader.py:100: 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/v1.1.4/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/v1.1.4/lib/python3.8/site-packages/parfive/downloader.py:101: 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/v1.1.4/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/v1.1.4/lib/python3.8/site-packages/parfive/downloader.py:102: 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/v1.1.4/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/v1.1.4/lib/python3.8/site-packages/parfive/downloader.py:103: 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/v1.1.4/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/v1.1.4/lib/python3.8/site-packages/parfive/downloader.py:312: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
  done, _ = await asyncio.wait(futures, loop=self.loop)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/v1.1.4/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/v1.1.4/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]/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/v1.1.4/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(


aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   0%|          | 100/7.54M [00:00<15:22:40, 136B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   1%|          | 46.9k/7.54M [00:00<10:41:59, 194B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   1%|1         | 110k/7.54M [00:01<7:25:42, 278B/s]  

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   2%|2         | 167k/7.54M [00:01<5:09:40, 397B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   3%|3         | 249k/7.54M [00:01<3:34:22, 567B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   4%|4         | 321k/7.54M [00:01<2:28:38, 809B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   6%|5         | 439k/7.54M [00:01<1:42:23, 1.16kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   8%|7         | 584k/7.54M [00:01<1:10:13, 1.65kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  10%|#         | 754k/7.54M [00:01<47:58, 2.36kB/s]  

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  12%|#2        | 935k/7.54M [00:01<32:42, 3.36kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  15%|#4        | 1.12M/7.54M [00:01<22:16, 4.80kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  18%|#8        | 1.36M/7.54M [00:01<15:01, 6.85kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  22%|##1       | 1.65M/7.54M [00:02<10:01, 9.78kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  25%|##5       | 1.89M/7.54M [00:02<06:44, 14.0kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  30%|##9       | 2.25M/7.54M [00:02<04:25, 19.9kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  35%|###4      | 2.60M/7.54M [00:02<02:54, 28.4kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  40%|####      | 3.02M/7.54M [00:02<01:51, 40.4kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  46%|####6     | 3.48M/7.54M [00:02<01:10, 57.5kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  54%|#####3    | 4.03M/7.54M [00:02<00:42, 81.7kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  61%|######    | 4.57M/7.54M [00:02<00:25, 116kB/s] 

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  70%|#######   | 5.31M/7.54M [00:02<00:13, 165kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  80%|########  | 6.05M/7.54M [00:02<00:06, 233kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  93%|#########2| 7.00M/7.54M [00:03<00:01, 329kB/s]

                                                                                                           
Files Downloaded: 100%|##########| 1/1 [00:04<00:00,  4.54s/file]
Files Downloaded: 100%|##########| 1/1 [00:04<00:00,  4.54s/file]
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/v1.1.4/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)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/v1.1.4/lib/python3.8/asyncio/selector_events.py:694: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=18>
  _warn(f"unclosed transport {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()
AIA $1600 \; \mathrm{\mathring{A}}$ 2012-06-06 04:07:29

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

Gallery generated by Sphinx-Gallery