Coordinates
This section of the guide introduces how coordinates are represented in sunpy.
Reference: corresponding sunpy webpage.
using SunPy
using SunPy: SkyCoord
using PythonCall
@py import astropy.units as u
@py import sunpy.coordinates.frames as framescoord = SkyCoord(70*u.deg, -30*u.deg, obstime="2017-08-01",
frame=frames.HeliographicStonyhurst)Python:
<SkyCoord (HeliographicStonyhurst: obstime=2017-08-01T00:00:00.000, rsun=695700…
(70., -30.)>coord.transform_to(frames.Helioprojective(observer="earth"))Python:
<SkyCoord (Helioprojective: obstime=2017-08-01T00:00:00.000, rsun=695700.0 km, …
(769.96270814, -498.89715922, 1.51668773e+08)>@py import sunpy.data.sample: AIA_171_IMAGE
@py import matplotlib.pyplot as plt
amap = sunpy.map.Map(AIA_171_IMAGE)
coord = SkyCoord(100 * u.arcsec, 10*u.arcsec, frame=amap.coordinate_frame)
pixels = amap.wcs.world_to_pixel(coord)Python: (array(551.7680511), array(515.18266871))fig = plt.figure()
ax = plt.subplot(projection=amap)
amap.plot()
ax.plot_coord(coord, 'o')
fig