Created
August 19, 2017 12:56
-
-
Save dpshelio/290e94504d541f2cbaaec2b19fdb684a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from astropy import units as u | |
from astropy.coordinates import SkyCoord | |
import sunpy.map | |
pixels = 300 * u.pix | |
sun_radius = (980 * u.arcsec).to(u.deg) | |
fov = sun_radius * 3 | |
delta = fov / pixels | |
sky = np.zeros((int(pixels.value), int(pixels.value))) | |
mymeta = {'naxis1': pixels.value, 'naxis2': pixels.value, | |
'cdelt1': delta.value, 'cdelt2': delta.value, | |
'crpix1': 150.5, 'crpix2': 150.5, | |
'crval1': 0, 'crval2': 0, | |
'ctype1': 'HPLN-TAN', 'ctype2': 'HPLT-TAN', | |
'cunit1': 'arcsec', 'cunit2': 'arcsec', | |
'rsun_obs': sun_radius.value, 'dsun_obs': (1 * u.au).to(u.m).value} | |
mymap = sunpy.map.Map(sky, mymeta) | |
fig = plt.figure() | |
ax = plt.subplot(projection=mymap) | |
mymap.plot(axes=ax, vmin=-100, vmax=0) | |
mymap.draw_grid(axes=ax, color='black') | |
mymap.draw_limb(axes=ax, color='black') | |
ax.coords.grid(color='black', alpha=0.5, linestyle='solid') | |
#text | |
ax.text(sun_radius.value, 0, 'West limb', transform=ax.transAxes) | |
ax.text(-sun_radius.value, 0, 'East limb', transform=ax.transAxes, horizontalalignment='right') | |
ax.text(0, sun_radius.value, 'North pole') | |
ax.text(0, -sun_radius.value, 'South pole') | |
#arrows | |
ax.arrow(0, 0, 0.25 * sun_radius.value, 0, head_width=0.05, head_length=0.01, fc='k', ec='k') | |
ax.arrow(0, 0, 0, 0.25 * sun_radius.value, head_width=0.05, head_length=0.01, fc='k', ec='k') | |
ax.text(0, 0.12 * sun_radius.value, 'x', verticalalignment='top') | |
ax.text(0.12 * sun_radius.value, 0, 'y', horizontalalignment='right') | |
ax.set_title('') | |
fig.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment