File: aia_example.py

package info (click to toggle)
sunpy 7.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,592 kB
  • sloc: python: 41,765; ansic: 1,710; makefile: 39
file content (43 lines) | stat: -rw-r--r-- 1,306 bytes parent folder | download | duplicates (2)
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
"""
==============
Plotting a map
==============

How to create a plot of a map.
"""
# sphinx_gallery_thumbnail_number = 2
import matplotlib.pyplot as plt

import astropy.units as u

import sunpy.map
from sunpy.data.sample import AIA_171_IMAGE

###############################################################################
# We start with the sample data.

aiamap = sunpy.map.Map(AIA_171_IMAGE)

##############################################################################
# Let's plot the result. Setting the projection is necessary to ensure that
# pixels can be converted accurately to coordinates values.

fig = plt.figure()
ax = fig.add_subplot(projection=aiamap)
aiamap.plot(axes=ax)
aiamap.draw_limb(axes=ax)
aiamap.draw_grid(axes=ax)
plt.show()

##############################################################################
# The above image looks "dark" because the color scale is accounting for the
# small set of pixels that are extremely bright. We can use the keyword
# ``clip_interval`` to clip out pixels with extreme values. Here, we clip out
# the darkest 1% of pixels and the brightest 0.01% of pixels.

fig = plt.figure()
ax = fig.add_subplot(projection=aiamap)
aiamap.plot(axes=ax, clip_interval=(1, 99.99)*u.percent)
aiamap.draw_limb(axes=ax)
aiamap.draw_grid(axes=ax)
plt.show()