Generating a map from data array¶
A simple demonstration of creating a map from a numpy array of data.
import matplotlib.pyplot as plt import numpy as np import astropy.units as u from astropy.coordinates import SkyCoord import sunpy.map from sunpy.coordinates import frames
Let’s create some data
Next we need to create the metadata. This is made easier using the
function which will create a header object for you. First define the reference coordinate
which requires a time and an observer location.
Let’s pass that into the helper function along with some parameters. The reference pixel is the pixel is the one at the reference coordinate. The scale sets the size of the pixels. You can also to set a number of other metadata as well such as the instrument name and wavelength.
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.8/site-packages/astropy/units/quantity.py:1058: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError. warnings.warn('The truth value of a Quantity is ambiguous. '
Let’s now create our map.
manual_map = sunpy.map.Map(data, header)
Let’s plot the result
Total running time of the script: ( 0 minutes 0.267 seconds)