PRO safe_fits_read, file, ext, maxtry, data, header, status ; Description: This module tests that a FITS image file is available on disk ; before reading in the image data corresponding to the specified ; image extension. If the file is not available, then the ; module waits 1 second before trying again. The module will ; attempt to read in the image data a total of "maxtry" times ; before giving up and returning a status of zero. ; ; Input Parameters: ; ; file - STRING - The full directory path and file name of the FITS image file ; to be read in. ; ext - INTEGER/LONG - The FITS file image extension for which the image data is ; to be read in. If "ext" is set to a negative number, then ; the image extension is not given explicitly to the module ; "fits_read", which means that "fits_read" will consequently ; determine the image extension in which the image data ; resides. ; maxtry - INTEGER/LONG - Maximum number of attempts at reading the image data ; before giving up and returning the "status" value of ; "0" (Default value = 1). ; ; Output parameters: ; ; data - SAME AS FITS FILE - The image data that has been read in from the FITS file. ; header - STRING VECTOR - The corresponding image header read in from the FITS file. ; The module removes the keywords BZERO and BSCALE, since ; the image is read in without any offset or scaling applied. ; status - INTEGER - If the module successfully read in 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: ; ; 19/04/2008 - Module created (dmb) ;Check that "file" is a variable of STRING type ;If "ext" is not a number of the correct type, then let the module "fits_read" determine ;the image extension to be read in ;If "maxtry" is not a positive number of the correct type, then reset its value to "1" ;Wait until the input file is available ;If "ext" is non-negative, then feed the specified extension number to the module ;"fits_read" ;If "ext" is negative, then let "fits_read" determine which image extension contains ;the image data ;Remove the BZERO and BSCALE keywords from the header