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, solar_system_ephemeris

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

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: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/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: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/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: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/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: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/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/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/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]/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(


aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   0%|          | 100/7.54M [00:07<149:05:27, 14.0B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   1%|          | 48.7k/7.54M [00:07<103:41:29, 20.1B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   1%|1         | 112k/7.54M [00:07<71:58:04, 28.7B/s]  

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   3%|2         | 196k/7.54M [00:07<49:48:41, 40.9B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   4%|3         | 301k/7.54M [00:07<34:22:05, 58.5B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   6%|5         | 434k/7.54M [00:07<23:36:55, 83.5B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:   8%|7         | 591k/7.54M [00:07<16:10:01, 119B/s] 

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  10%|#         | 787k/7.54M [00:07<10:59:51, 170B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  14%|#3        | 1.05M/7.54M [00:07<7:23:44, 244B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  18%|#8        | 1.38M/7.54M [00:08<4:55:01, 348B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  23%|##3       | 1.77M/7.54M [00:08<3:13:30, 497B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  30%|##9       | 2.23M/7.54M [00:08<2:04:37, 710B/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  36%|###6      | 2.75M/7.54M [00:08<1:18:39, 1.01kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  44%|####4     | 3.35M/7.54M [00:08<48:12, 1.45kB/s]  

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  51%|#####1    | 3.88M/7.54M [00:08<29:27, 2.07kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  60%|#####9    | 4.52M/7.54M [00:08<17:02, 2.96kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  67%|######7   | 5.05M/7.54M [00:08<09:48, 4.22kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  75%|#######4  | 5.65M/7.54M [00:08<05:13, 6.03kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  83%|########2 | 6.24M/7.54M [00:08<02:31, 8.61kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  91%|######### | 6.84M/7.54M [00:09<00:56, 12.3kB/s]

aia_lev1_1600a_2012_06_06t04_07_29_12z_image_lev1.fits:  98%|#########8| 7.40M/7.54M [00:09<00:07, 17.5kB/s]
Files Downloaded: 100%|##########| 1/1 [00:18<00:00, 18.25s/file]
Files Downloaded: 100%|##########| 1/1 [00:18<00:00, 18.25s/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)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/asyncio/selector_events.py:694: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=17>
  _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.

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 = 200 * u.arcsec
bottom_left = SkyCoord(venus_hpc.Tx - fov/2, venus_hpc.Ty - fov/2, frame=aiamap.coordinate_frame)
smap = aiamap.submap(bottom_left, width=fov, height=fov)

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 24.762 seconds)

Gallery generated by Sphinx-Gallery