1.383. simpleFitsWriter

Full Name: herschel.ia.toolbox.util.SimpleFitsWriterTask
Alias: simpleFitsWriter
Type: Java Task - Java Task
Import: from herschel.ia.toolbox.util import SimpleFitsWriterTask



Saves a product in a FITS file.

SimpleFitsWriterTask flow:

  • if no filename is given, flow is finished with RuntimeException "File is required."

  • if the file already exists and warn is checked: user is asked to confirm overwriting

  • if the user does not confirm overwriting (or mode is not interactive), flow is finished with RuntimeException "Execution cancelled."

  • if the user asked for compression, the output will be compressed

  • Otherwise the product or dataset (wrapped) is saved in HCSS' FITS format in the chosen file

To read FITS files use fitsReader (SimpleFitsReader is quite limited).


Example 1: Saving a product into a file
p = Product()
f = "path_to_file/filename.fits"
Example 2: Saving a product into a file asking before overwriting
p = Product()
f = "path_to_file/filename.fits"
Example 3: Saving a product into a zipped file
p = Product()
f = "path_to_file/filename.zip"


SimpleFitsReader does not support zipped fits. SimpleFitsWriter allows it for compatibility with external tools.

API details


Annotatable product [INPUT, MANDATORY, default=null]

Product or Dataset to be saved. Will not accept Contexts.

String file [INPUT, MANDATORY, default=null]

FITS filename to save the product into.

Boolean warn [INPUT, OPTIONAL, default=False]

If true, asks confirmation before overwriting.

String compression [INPUT, OPTIONAL, default="NONE"]

The type of compression in the output file. Valid values are "NONE", "ZIP" and "GZIP"

See also


  • 2008-07-08 - JCS: first release
  • 2008-08-19 - JDS: SCR 4573: asking before overwriting
  • 2009-01-07 - JDS: SCR-8864: support compression
  • 2010-06-10 - JDS: reject Contexts