File: differentially_rotated_gridlines.py

package info (click to toggle)
sunpy 2.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 17,716 kB
  • sloc: python: 36,852; ansic: 1,776; makefile: 19
file content (51 lines) | stat: -rw-r--r-- 1,908 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
===========================================
Overlaying differentially rotated gridlines
===========================================

How to overlay differentially rotated gridlines on a Map.

The example uses the `~sunpy.coordinates.metaframes.RotatedSunFrame` coordinate
metaframe in `sunpy.coordinates` to overlay differentially rotated gridlines on
a Map.  See :ref:`sunpy-coordinates-rotatedsunframe` for more details on using
`~sunpy.coordinates.metaframes.RotatedSunFrame`.
"""
import matplotlib.pyplot as plt

import astropy.units as u

import sunpy.map
from sunpy.coordinates import HeliographicStonyhurst, RotatedSunFrame
from sunpy.data.sample import AIA_171_IMAGE

##############################################################################
# Let's use an AIA observation, and plot lines of constant longtiude in
# heliographic Stonyhurst.  We'll plot the normal lines (prior to applying
# differential rotation) in white and the differentially rotated lines in
# blue.  Be aware that the differentially rotated lines are plotted in the
# original coordinate frame, so it doesn't account for any motion of the
# observer over 27 days.

aiamap = sunpy.map.Map(AIA_171_IMAGE)

fig = plt.figure()
ax = plt.subplot(projection=aiamap)
aiamap.plot(clip_interval=(1., 99.95)*u.percent)

# Lines of constant longitude prior to differential rotation

overlay1 = ax.get_coords_overlay('heliographic_stonyhurst')
overlay1[0].set_ticks(spacing=15. * u.deg)
overlay1[1].set_ticks(spacing=90. * u.deg)
overlay1.grid(ls='-', color='white')

# Differentially rotating the lines of constant longitude by 27 days

rs_hgs = RotatedSunFrame(base=HeliographicStonyhurst(obstime=aiamap.date),
                         duration=27*u.day)
overlay2 = ax.get_coords_overlay(rs_hgs)
overlay2[0].set_ticks(spacing=15. * u.deg)
overlay2[1].set_ticks(spacing=90. * u.deg)
overlay2.grid(ls='-', color='blue')

plt.show()