write#

sunpy.io._fits.write(fname, data, header, hdu_type=None, **kwargs)[source]#

Take a data header pair and write a FITS file.

Parameters:
  • fname (str) – File name, with extension.

  • data (numpy.ndarray) – n-dimensional data array.

  • header (dict) – A header dictionary.

  • hdu_type (ExtensionHDU instance or class, optional) – By default, a FITS file is written with the map in its primary HDU. If a type is given, a new HDU of this type will be created. If a HDU instance is given, its data and header will be updated from the map. Then that HDU instance will be written to the file.

  • kwargs – Additional keyword arguments are given to writeto.