HMI Daily Synoptic Map

In this example we load the Daily Synoptic Maps produced by the HMI team. This data is an interesting demonstration of SunPy’s Map class as it is not in the more common Helioprojective coordinate system, it is in Heliographic Carrington coordinates and in a non-trivial Cylindrical Equal Area projection.

This example plots the HMI Daily Synoptic Maps, the file used in this example can be downloaded from here

import numpy as np
import matplotlib.pyplot as plt

from import download_file


Use astropy to download the file to a temp location.

filename = download_file(
    '', cache=True)

We read this file in as a Map.

syn_map =

There are a couple of oddities with this file, firstly the value of ‘CUNIT2’:



Sine Latitude

That is not a unit! What this is telling us is that the latitude coordinate is actually the sine of latitude. According to the Thompson (2006) paper, CUNIT2 should be in degrees and CDELT2 should be multiplied by 180/pi. Also the value of CDELT1 has the wrong sign.

syn_map.meta['CUNIT2'] = 'degree'
syn_map.meta['CDELT2'] = 180 / np.pi * syn_map.meta['CDELT2']
syn_map.meta['CDELT1'] *= -1

Now we create a SunPy Map from the data and header:

# Set the colorbar properties.
syn_map.plot_settings['cmap'] = 'hmimag'
syn_map.plot_settings['norm'] = plt.Normalize(-1500, 1500)

Create a figure with the Map’s projection:

fig = plt.figure(figsize=(12, 5))
axes = plt.subplot(projection=syn_map)

# Plot the image
im = syn_map.plot()

# Set up the Sine Latitude Grid
x = axes.coords[0]
y = axes.coords[1]

x.set_coord_type('longitude', coord_wrap=360.)


x.set_axislabel("Carrington Longitude [deg]")
y.set_axislabel("Latitude [deg]")

x.set_ticks(color='black', exclude_overlapping=True)
y.set_ticks(color='black', exclude_overlapping=True)

# Hide the grid
axes.coords.grid(color='black', alpha=0.6, linestyle='dotted', linewidth=0.5)

# Create a colorbar
cb = plt.colorbar(im, fraction=0.019, pad=0.1)
cb.set_label("LOS Magnetic Field [Gauss]")

# Another horrible hack to make the ticks draw on the RHS
axes.set_ylim((1,[0] - 1))

plt.title("{} {}-{}".format(syn_map.meta['content'], syn_map.meta['CAR_ROT'],
                            syn_map.meta['CAR_ROT'] + 1))

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

Gallery generated by Sphinx-Gallery