make_fitswcs_header

sunpy.map.make_fitswcs_header(data, coordinate, reference_pixel: Unit("pix") = None, scale: Unit("arcsec / pix") = None, rotation_angle: Unit("deg") = None, rotation_matrix=None, instrument=None, telescope=None, observatory=None, wavelength: Unit("Angstrom") = None, exposure: Unit("s") = None, projection_code='TAN')[source] [edit on github]

Function to create a FITS-WCS header from a coordinate object (SkyCoord) that is required to create a GenericMap.

Parameters
  • data (ndarray) – Array data of Map for which a header is required.

  • coordinates (SkyCoord or BaseFrame) – Coordinate object to get meta information for map header.

  • reference_pixel (Quantity of size 2, optional) – Reference pixel along each axis. These are expected to be Cartestian ordered, i.e the first index is the x axis, second index is the y axis. Defaults to the center of data array, (data.shape[1] - 1)/2., (data.shape[0] - 1)/2.), this argument is zero indexed (Python convention) not 1 indexed (FITS convention).

  • scale (Quantity of size 2, optional) – Pixel scaling along x and y axis (i.e. the spatial scale of the pixels (dx, dy)). These are expected to be Cartestian ordered, i.e [dx, dy]. Defaults to ([1., 1.] arcsec/pixel).

  • rotation_angle (Quantity, optional) – Coordinate system rotation angle, will be converted to a rotation matrix and stored in the PCi_j matrix. Can not be specified with rotation_matrix.

  • rotation_matrix (ndarray of dimensions 2x2, optional) – Matrix describing the rotation required to align solar North with the top of the image in FITS PCi_j convention. Can not be specified with rotation_angle.

  • instrument (str, optional) – Name of the instrument of the observation.

  • telescope (str, optional) – Name of the telescope of the observation.

  • observatory (str, optional) – Name of the observatory of the observation.

  • wavelength (Quantity, optional) – Wavelength of the observation as an astropy quanitity, e.g. 171*u.angstrom. From this keyword, the meta keywords wavelnth and waveunit will be populated.

  • exposure (Quantity, optional) – Exposure time of the observation

  • projection_code (str, optional) – The FITS standard projection code for the new header.

Returns

MetaDict – The header information required for making a sunpy.map.GenericMap.

Examples

>>> import sunpy.map
>>> from sunpy.coordinates import frames
>>> from astropy.coordinates import SkyCoord
>>> import astropy.units as u
>>> import numpy as np
>>> data = np.random.rand(1024, 1024)
>>> my_coord = SkyCoord(0*u.arcsec, 0*u.arcsec, obstime="2017-08-01",
...                     observer = 'earth', frame=frames.Helioprojective)
>>> my_header = sunpy.map.make_fitswcs_header(data, my_coord)
>>> my_map = sunpy.map.Map(data, my_header)