File: upside_down_hmi.py

package info (click to toggle)
sunpy 4.1.2-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,972 kB
  • sloc: python: 39,301; ansic: 1,780; makefile: 35
file content (43 lines) | stat: -rw-r--r-- 1,555 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
"""
==============================================
Rotating HMI maps so they're not 'upside-down'
==============================================

This example shows how to rotate a HMI magnetogram, so when you plot it
it appears with solar North pointing up.
"""
import matplotlib.pyplot as plt

import sunpy.map
from sunpy.data.sample import HMI_LOS_IMAGE

###############################################################################
# We will use the ``sunpy`` HMI sample image, load it into a map and plot it.
# We see that solar North is pointed down instead of up in this image, which is
# indicated by the coordinates (that range from positive to negative, rather
# than negative to positive).

hmi_map = sunpy.map.Map(HMI_LOS_IMAGE)
plt.figure()
hmi_map.plot()

plt.show()

###############################################################################
# Now rotate the image such that solar North is pointed up.
# We have to do this because the HMI instrument is mounted upside-down
# relative to the AIA instrument on the SDO satellite, which means most
# of the images are taken with solar North pointed up.
# The roll angle of the instrument is reported in the FITS header
# keyword ``CROTA2`` (see Figure 17 of
# `Couvidat et al. (2016) <https://dx.doi.org/10.1007/s11207-016-0957-3>`_,
# which states that "the nominal CROTA2 for HMI is ≈179.93").
#
# The order keyword, below, specifies the type of interpolation;
# in this case, 3 refers to bi-cubic.

hmi_rotated = hmi_map.rotate(order=3)
plt.figure()
hmi_rotated.plot()

plt.show()