sunpy.io.write_file(fname, data, header, filetype='auto', **kwargs)[source] [edit on github]

Write a file from a data & header pair using one of the defined file types.

  • fname (str) – Filename of file to save.
  • data (numpy.ndarray) – Data to save to a fits file.
  • header (collections.OrderedDict) – Meta data to save with the data.
  • filetype (str) – {‘auto’, ‘fits’, ‘jp2’} Filetype to save if auto fname extension will be detected, else specify a supported file extension.


  • Other keyword arguments will be passes to the writer function used.
  • This routine currently only supports saving a single HDU.