sunpy.io._file_tools.write_file(fname, data, header, filetype='auto', **kwargs)[source]#

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’}, optional) – Filetype to save if auto the filename extension will be detected, else specify a supported file extension.

  • **kwargs (dict) – All extra keyword arguments are passed to .write for the file specific reader.


  • This routine currently only supports saving a single HDU.