PRO safe_fits_write, dir, file, maxtry, data, header, status ; Description: This module writes out a FITS image file, along with its header. ; The module first checks that the target directory is available ; on disk before writing. If the directory is not available, ; then the module waits 1 second before trying again. The module ; will attempt to write out the image data a total of "maxtry" times ; before giving up and returning a status of zero. ; ; Input Parameters: ; ; dir - STRING - The full directory path of where the FITS image file is to be ; written out. ; file - STRING - The file name of the FITS image file to be written out. ; maxtry - INTEGER/LONG - Maximum number of attempts at writing the image data ; before giving up and returning the "status" value of ; "0" (Default value = 1). ; data - BYTE/INTEGER/LONG/FLOAT/DOUBLE ARRAY (ANY DIMENSIONS) - The image data that is to be ; written to the FITS image file. ; header - STRING ARRAY - The header to be written out to the FITS image file. ; The module removes the keywords BZERO and BSCALE, since the ; image is written out without any offset or scaling applied. ; Set this to 'NONE' to write out a standard minimal header. ; If this parameter is not a vector with values of STRING ; type, then the module will write out a standard minimal ; header. ; ; Output parameters: ; ; status - INTEGER - If the module successfully wrote out the image data, then "status" ; is returned with a value of "1", otherwise it is returned with ; a value of "0". ; ; Author: Dan Bramich (dan.bramich@hotmail.co.uk) ; ; History: ; ; 29/04/2008 - Module created (dmb) ;Check that "dir" and "file" are variables of STRING type ;If "maxtry" is not a positive number of the correct type, then reset its value to "1" ;Check that "data" contains number data ;Check that "header" is a vector with values of STRING type ;If a header is to be written out with the image, then remove the BZERO and BSCALE keywords ;from the header ;Wait until the output directory is available ;If no header is to be written out with the image, then write out the image data with a ;minimal header ;If a header is to be written out with the image, then write out the image data with the ;required header information