Extended IDL Help

This page was created by the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Fri Feb 2 17:44:49 2001.


List of Routines


Routine Descriptions

CHECK_FITS

[Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	CHECK_FITS
 Purpose     : 
	Checks validity of FITS header.
 Explanation : 
	Given a FITS array IM, and a associated FITS or SDAS header HDR, this
	procedure will check that

      (1) HDR is a string array, and IM is defined and numeric   
      (2) The NAXISi values in HDR are appropiate to the dimensions of IM
      (3) The BITPIX value in HDR is appropiate to the datatype of IM.
          If HDR contain a DATATYPE keyword (as in SDAS files), then this is 
          also checked against the datatype of of IM

	If the UPDATE keyword is present, then FITS header will be modified, if
	necesary, to force agreement with the image array
 Use         : 
	check_FITS, im, hdr, [ dimen, idltype, /UPDATE, /NOTYPE, /SDAS ]
 Inputs      : 
	IM -  FITS or  STSDAS array, (e.g. as read by SXREAD or READFITS )
	HDR - FITS or  STSDAS header (string array) associated with IM
 Opt. Inputs : 
	None.
 Outputs     : 
	None.
 Opt. Outputs: 
	dimen - vector containing actual array dimensions
	idltype- data type of the FITS array as specified in the IDL SIZE
           function (1 for BYTE, 2 for INTEGER*2, 3 for INTEGER*4, etc.)
 Keywords    : 
	/NOTYPE - If this keyword is set, then only agreement of the array
		  dimensions with the FITS header are checked, and not the 
		  data type.
	/UPDATE - If this keyword is set then the BITPIX, NAXIS and DATATYPE
		  FITS keywords will be updated to agree with the arra
	/SDAS   - If this keyword is set then the header is assumed to be from
		  an SDAS (.hhh) file.    CHECK_FITS will then ensure that (1)
		  a DATATYPE keyword is included in the header and (2) BITPIX
		  is always written with positive values.
	/FITS   - If this keyword is present then CHECK_FITS assumes that it is
		  dealing with a FITS header and not an SDAS header, see notes
		  below.
 Calls       : 
	SXPAR
	SXDELPAR
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
	If there is a fatal problem with the FITS array or header then !ERR is
	set to -1.  ( If the UPDATE keyword was supplied, and the header could
	be fixed then !ERR = 0.)

	An important distinction between an STSDAS header and a FITS header is
	that the BITPIX value in an STSDAS is always positive, e.g. BITPIX=32
	for REAL*4 data.  Users should use either the /SDAS or the /FITS
	keyword if it is important whether the STSDAS or FITS convention for
	REAL*4 data is used.  Otherwise, CHECK_FITS assumes that if a DATATYPE
	keyword is present then it is dealing with an STSDAS header.

 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	Written, December 1991  W. Landsman Hughes/STX to replace CHKIMHD
	No error returned if NAXIS=0 and IM is a scalar   W. Landsman  Feb 93
	Fixed bug for REAL*8 STSDAS data W. Landsman July 93
	Make sure NAXIS agrees with NAXISi  W. Landsman  October 93
 Written     : 
	Wayne Landsman, GSFC/UIT, December 1991.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 26 October 1994
		Brought up-to-date with idlastro version.
 Version     : 
	Version 2, 26 October 1994

(See .//check_fits.pro)


FITSTAPE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FITSTAPE()
 Purpose     : 
	Function to perform FITS tape I/O.
 Explanation : 
	Function to perform FITS tape I/O.  Called by FITSREAD.   
	FOR VMS IDL ONLY!
 Use         : 
	status=fitstape(command,unit,bitpix,data)
 Inputs      : 
	command - string command from the following choices
             'init' - initialization (must be first call to fitstape)
             'read' - get next 2880 byte data buffer
             'eof'  - check for end of tape file
             'write'- write 2880 byte data buffer
             'woef' - empty buffer and write end-of-file
	unit -   tape unit number
	bitpix - bits/per data element (used to control byte swapping)
            (required for 'read' and 'write')
            (for 'init' command this parameter gives
             the blocking factor, number of 2880 byte
             records per tape record. if not supplied 1 is
             assumed)
	data - 2880 byte data array if 'write' command
 Opt. Inputs : 
	None.
 Outputs     : 
	data - 2880 byte data array if 'read' command
	status is returned as the function value
	with the following meanings.
		'init' = 1
		'read' = !err returned by taprd
		'write' = 1
		'eof'  = 1 if at end of file
			 0 if not at end of file
		'weof' = 1
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	QFITSTAPE
 Restrictions: 
	None.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	Version 1  D. Lindler  Nov 1986
	Converted to IDL Version 2.  M. Greason, STX, June 1990.
	Recognize BITPIX = -32 and BITPIX = -64   W. Landsman April 1992
 Written     : 
	Don Lindler, GSFC/HRS November 1986.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//fitstape.pro)


FITS_INFO

[Previous Routine] [Next Routine] [List of Routines]
 Project     :	SOHO - CDS

 Name        :	
	FITS_INFO

 Purpose     :	Provides info about FITS file, primary and extensions.

 Explanation :	
	Provide information about the contents of a FITS file, (primary header
	and data if any + extensions).  Information is printed at the terminal
	and/or stored in a common block

 Use         :	
	FITS_INFO, filename, [ SILENT = , TEXTOUT = , N_ext = ]

	Example:  Display info about all FITS files of the form '*.fit' in the
	current directory

		IDL> fits_info, '*.fit'

	Any time a *.fit file is found which is *not* in FITS format, an error 
	message is displayed at the terminal and the program continues

 Inputs      :	
	FILENAME = Scalar or vector string giving the name of the FITS file(s)
		Can include wildcards such as '*.fits'

 Opt. Inputs :	None.

 Outputs     :	Information is printed to the screen.

 Opt. Outputs:	None.

 Keywords    :	
	SILENT - This key word will suppress display of the file description
		on the terminal
	TEXTOUT - specifies output device.
		textout=1        TERMINAL using /more option
		textout=2        TERMINAL without /more option
		textout=3        .prt
		textout=4        laser.tmp
		textout=5        user must open file, see TEXTOPEN
		textout = filename (default extension of .prt)
	N_ext - Returns an integer scalar giving the number of extensions in
		the FITS file

 Calls       :	
	GETTOK, STRN, SXPAR, TEXTOPEN, TEXTCLOSE 

 Common      :	
	DESCRIPTOR = File descriptor string of the form N_hdrrec Naxis IDL_type
		Naxis1 Naxis2 ... Naxisn [N_hdrrec table_type Naxis
		IDL_type Naxis1 ... Naxisn] (repeated for each extension) 
		See the procedure RDFITS_STRUCT for an example of the
		use of this common block

 Restrictions:	
	Uses the non-standard system variable !TEXTOUT to select an output
	device if the TEXTOUT keyword is not supplied

 Side effects:	None.

 Category    :	Data handling, I/O, FITS, Generic

 Prev. Hist. :	
	Written, K. Venkatakrishna, Hughes STX, May 1992
	Added N_ext keyword, and table_name info, G. Reichert
	Some cleaning up of the code W. Landsman   October 1992
	Work on *very* large FITS files   October 92

 Written     :	K. Venkatakrishna, Hughes STX, May 1992

 Modified    :	Version 1, William Thompson, GSFC, 10 June 1994
			Incorporated into CDS library.
		Version 2, William Thompson, GSFC, 9 January 1995
			Incorporated following changes:

       More checks to recognize corrupted FITS files     February, 1993
	Proper check for END keyword    December 1994
	Correctly size variable length binary tables   December 1994

 Version     :	Version 2, 9 January 1995

(See .//fits_info.pro)


FXADDPAR

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXADDPAR
 Purpose     : 
	Add or modify a parameter in a FITS header array.
 Explanation : 

 Use         : 
	FXADDPAR, HEADER, NAME, VALUE, COMMENT
 Inputs      : 
	HEADER	= String array containing FITS header.  The maximum string
		  length must be equal to 80.  If not defined, then FXADDPAR
		  will create an empty FITS header array.

	NAME	= Name of parameter.  If NAME is already in the header the
		  value and possibly comment fields are modified. Otherwise a
		  new record is added to the header.  If NAME is equal to
		  either "COMMENT" or "HISTORY" then the value will be added to
		  the record without replacement.  In this case the comment
		  parameter is ignored.

	VALUE	= Value for parameter.  The value expression must be of the
		  correct type, e.g. integer, floating or string.  String
		  values of 'T'	or 'F' are considered logical values.

 Opt. Inputs : 
	COMMENT	= String field.  The '/' is added by this routine.  Added
		  starting in position 31.  If not supplied, or set equal to ''
		  (the null string), then any previous comment field in the
		  header for that keyword is retained (when found).
 Outputs     : 
	HEADER	= Updated header array.
 Opt. Outputs: 
	None.
 Keywords    : 
	BEFORE	= Keyword string name.  The parameter will be placed before the
		  location of this keyword.  For example, if BEFORE='HISTORY'
		  then the parameter will be placed before the first history
		  location.  This applies only when adding a new keyword;
		  keywords already in the header are kept in the same position.

	AFTER	= Same as BEFORE, but the parameter will be placed after the
		  location of this keyword.  This keyword takes precedence over
		  BEFORE.

       FORMAT	= Specifies FORTRAN-like format for parameter, e.g. "F7.3".  A
		  scalar string should be used.  For complex numbers the format
		  should be defined so that it can be applied separately to the
		  real and imaginary parts.
 Calls       : 
	FXPAR, FXPARPOS
 Common      : 
	None.
 Restrictions: 
	Warning -- Parameters and names are not checked against valid FITS
	parameter names, values and types.

	The required FITS keywords SIMPLE (or XTENSION), BITPIX, NAXIS, NAXIS1,
	NAXIS2, etc., must be entered in order.  The actual values of these
	keywords are not checked for legality and consistency, however.

 Side effects: 
	All HISTORY records are inserted in order at the end of the header.

	All COMMENT records are also inserted in order at the end of the
	header, but before the HISTORY records.  The BEFORE and AFTER keywords
	can override this.

	All records with no keyword (blank) are inserted in order at the end of
	the header, but before the COMMENT and HISTORY records.  The BEFORE and
	AFTER keywords can override this.

	All other records are inserted before any of the HISTORY, COMMENT, or
	"blank" records.  The BEFORE and AFTER keywords can override this.

 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan 1992, from SXADDPAR by D. Lindler and J. Isensee.
	Differences include:

		* LOCATION parameter replaced with keywords BEFORE and AFTER.
		* Support for COMMENT and "blank" FITS keywords.
		* Better support for standard FITS formatting of string and
		  complex values.
		* Built-in knowledge of the proper position of required
		  keywords in FITS (although not necessarily SDAS/Geis) primary
		  headers, and in TABLE and BINTABLE extension headers.

	William Thompson, May 1992, fixed bug when extending length of header,
	and new record is COMMENT, HISTORY, or blank.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//fxaddpar.pro)


FXBADDCOL

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBADDCOL
 Purpose     : 
	Adds a column to a binary table extension.
 Explanation : 
	Modify a basic FITS binary table extension (BINTABLE) header array to
	define a column.
 Use         : 
	FXBADDCOL, INDEX, HEADER, ARRAY  [, TTYPE [, COMMENT ]]
 Inputs      : 
	HEADER	= String array containing FITS extension header.
	ARRAY	= IDL variable used to determine the data size and type
		  associated with the column.  If the column is defined as
		  containing variable length arrays, then ARRAY must be of the
		  maximum size to be stored in the column.
 Opt. Inputs : 
	TTYPE	= Column label.
	COMMENT = Comment for TTYPE
 Outputs     : 
	INDEX	= Index (1-999) of the created column.
	HEADER	= The header is modified to reflect the added column.
 Opt. Outputs: 
	None.
 Keywords    : 
	VARIABLE= If set, then the column is defined to contain pointers to
		  variable length arrays in the heap area.
	DCOMPLEX= If set, and ARRAY is complex, with the first dimension being
		  two (real and imaginary parts), then the column is defined as
		  double-precision complex (type "M").
	BIT	= If passed, and ARRAY is of type byte, then the column is
		  defined as containg bit mask arrays (type "X"), with the
		  value of BIT being equal to the number of mask bits.
	LOGICAL	= If set, and array is of type byte, then the column is defined
		  as containing logical arrays (type "L").
	NO_TDIM	= If set, then the TDIMn keyword is not written out to the
		  header.  No TDIMn keywords are written for columns containing
		  variable length arrays.
	TUNIT	= If passed, then corresponding keyword is added to header.
	TSCAL	= Same.
	TZERO	= Same.
	TNULL	= Same.
	TDISP	= Same.
	TDMIN	= Same.
	TDMAX	= Same.
	TDESC	= Same.
	TCUNI	= Same.
	TROTA	= Same.
	TRPIX	= Same.
	TRVAL	= Same.
	TDELT	= Same.
	ERRMSG	= If defined and passed, then any error messages will be
		  returned to the user in this parameter rather than
		  depending on the MESSAGE routine in IDL.  If no errors are
		  encountered, then a null string is returned.  In order to
		  use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBADDCOL, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	FXADDPAR, FXPAR
 Common      : 
	None.
 Restrictions: 
	Warning: No checking is done of any of the parameters defining the
	values of optional FITS keywords.

	FXBHMAKE must first be called to initialize the header.

	If ARRAY is of type character, then it must be of the maximum length
	expected for this column.  If a character string array, then the
	largest string in the array is used to determine the maximum length.

	The DCOMPLEX keyword is ignored if ARRAY is not double-precision.
	ARRAY must also have a first dimension of two representing the real and
	imaginary parts.

	The BIT and LOGICAL keywords are ignored if ARRAY is not of type byte.
	BIT takes precedence over LOGICAL.

 Side effects: 
	If the data array is multidimensional, then a TDIM keyword is added to
	the header, unless either NO_TDIM or VARIABLE is set.

	No TDIMn keywords are written out for bit arrays (format 'X'), since
	the dimensions would refer to bits, not bytes.

 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan 1992.
	W. Thompson, Feb 1992, changed from function to procedure.
	W. Thompson, Feb 1992, modified to support variable length arrays.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 31 May 1994
		Added ERRMSG keyword.
       Version 3, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
	Version 4, William Thompson, GSFC, 30 December 1994
		Added keyword TCUNI.
 Version     :
       Version 4, 30 December 1994

(See .//fxbaddcol.pro)


FXBCLOSE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBCLOSE
 Purpose     : 
	Close a FITS binary table extension opened for read.
 Explanation : 
	Closes a FITS binary table extension that had been opened for read by
	FXBOPEN.
 Use         : 
	FXBCLOSE, UNIT
 Inputs      : 
	UNIT	= Logical unit number of the file.
 Opt. Inputs : 
	None.
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	ERRMSG	  = If defined and passed, then any error messages will be
		    returned to the user in this parameter rather than
		    depending on the MESSAGE routine in IDL.  If no errors are
		    encountered, then a null string is returned.  In order to
		    use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBCLOSE, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	None.
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	The file must have been opened with FXBOPEN.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Feb. 1992.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 June 1994
		Added ERRMSG keyword.
       Version 3, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 3, 23 June 1994

(See .//fxbclose.pro)


FXBCOLNUM

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBCOLNUM()
 Purpose     : 
	Returns a binary table column number.
 Explanation : 
	Given a column specified either by number or name, this routine will
	return the appropriate column number.
 Use         : 
	Result = FXBCOLNUM( UNIT, COL )
 Inputs      : 
	UNIT	= Logical unit number corresponding to the file containing the
		  binary table.
	COL	= Column in the binary table, given either as a character
		  string containing a column label (TTYPE), or as a numerical
		  column index starting from column one.
 Opt. Inputs : 
	None.
 Outputs     : 
	The result of the function is the number of the column specified, or
	zero if no column is found (when passed by name).
 Opt. Outputs: 
	None.
 Keywords    : 
	ERRMSG	  = If defined and passed, then any error messages will be
		    returned to the user in this parameter rather than
		    depending on the MESSAGE routine in IDL.  If no errors are
		    encountered, then a null string is returned.  In order to
		    use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			Result = FXBCOLNUM( ERRMSG=ERRMSG, ... )
			IF ERRMSG NE '' THEN ...

 Calls       : 
	None.
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	The binary table file must have been opened with FXBOPEN.

	If COL is passed as a number, rather than as a name, then it must be
	consistent with the number of columns in the table.

 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	None.
 Written     : 
	William Thompson, GSFC, 2 July 1993.
 Modified    : 
	Version 1, William Thompson, GSFC, 2 July 1993.
	Version 2, William Thompson, GSFC, 29 October 1993.
		Added error message for not finding column by name.
	Version 3, William Thompson, GSFC, 21 June 1994
		Added ERRMSG keyword.
       Version 4, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 4, 23 June 1994

(See .//fxbcolnum.pro)


FXBCREATE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBCREATE
 Purpose     : 
	Open a new binary table at the end of a FITS file.
 Explanation : 
	Write a binary table extension header to the end of a disk FITS file,
	and leave it open to receive the data.

	The FITS file is opened, and the pointer is positioned just after the
	last 2880 byte record.  Then the binary header is appended.  Calls to
	FXBWRITE will append the binary data to this file, and then FXBFINISH
	will close the file.

 Use         : 
	FXBCREATE, UNIT, FILENAME, HEADER
 Inputs      : 
	FILENAME = Name of FITS file to be opened.
	HEADER	 = String array containing the FITS binary table extension
		   header.
 Opt. Inputs : 
	None.
 Outputs     : 
	UNIT	 = Logical unit number of the opened file.
 Opt. Outputs: 
	None.
 Keywords    : 
	ERRMSG	  = If defined and passed, then any error messages will be
		    returned to the user in this parameter rather than
		    depending on the MESSAGE routine in IDL.  If no errors are
		    encountered, then a null string is returned.  In order to
		    use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBCREATE, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	FXADDPAR, FXBFINDLUN, FXBPARSE, FXFINDEND
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	The primary FITS data unit must already be written to a file.  The
	binary table extension header must already be defined (FXBHMAKE), and
	must match the data that will be written to the file.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Jan 1992, based on WRITEFITS by J. Woffard and W. Landsman.
	W. Thompson, Feb 1992, changed from function to procedure.
	W. Thompson, Feb 1992, removed all references to temporary files.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 July 1993.
		Fixed bug with variable length arrays.
	Version 3, William Thompson, GSFC, 21 June 1994
		Added ERRMSG keyword.
       Version 4, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 4, 23 June 1994

(See .//fxbcreate.pro)


FXBDIMEN

[Previous Routine] [Next Routine] [List of Routines]
 Project     :	SOHO - CDS

 Name        :	FXBDIMEN()

 Purpose     :	Returns the dimensions for a column in a FITS binary table.

 Explanation :	This procedure returns the dimensions associated with a column
		in a binary table opened for read with the command FXBOPEN.

 Use         :	Result = FXBDIMEN(UNIT,COL)

 Inputs      :	UNIT	= Logical unit number returned by FXBOPEN routine.
			  Must be a scalar integer.

		COL	= Column in the binary table to read data from, either
			  as a character string containing a column label
			  (TTYPE), or as a numerical column index starting from
			  column one.

 Opt. Inputs :	None.

 Outputs     :	The result of the function is an array containing the
		dimensions for the specified column in the FITS binary table
		that UNIT points to.

 Opt. Outputs:	None.

 Keywords :	ERRMSG	= If defined and passed, then any error messages will
			  be returned to the user in this parameter rather than
			  depending on the MESSAGE routine in IDL.  If no
			  errors are encountered, then a null string is
			  returned.  In order to use this feature, ERRMSG must
			  be defined first, e.g.

				ERRMSG = ''
				Result = FXBDIMEN( ERRMSG=ERRMSG, ... )
				IF ERRMSG NE '' THEN ...

 Calls       :	FXBCOLNUM, FXBFINDLUN

 Common      :	Uses common block FXBINTABLE--see "fxbintable.pro" for more
		information.

 Restrictions:	None.

 Side effects:	The dimensions will be returned whether or not the table is
		still open or not.

		If UNIT does not point to a binary table, then 0 is returned.

		If UNIT is an undefined variable, then 0 is returned.

 Category    :	Data Handling, I/O, FITS, Generic.

 Prev. Hist. :	None.

 Written     :	William Thompson, GSFC, 4 March 1994.

 Modified    :	Version 1, William Thompson, GSFC, 4 March 1994.
		Version 2, William Thompson, GSFC, 21 June 1994
			Added ERRMSG keyword.
		Version 3, William Thompson, GSFC, 23 June 1994
               	Modified so that ERRMSG is not touched if not defined.

 Version     :	Version 3, 23 June 1994

(See .//fxbdimen.pro)


FXBFIND

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBFIND
 Purpose     : 
	Find column keywords in a FITS binary table header.
 Explanation : 
	Finds the value of a column keyword for all the columns in the binary
	table for which it is set.  For example,

		FXBFIND, UNIT, 'TTYPE', COLUMNS, VALUES, N_FOUND

	Would find all instances of the keywords TTYPE1, TTYPE2, etc.  The
	array COLUMNS would contain the column numbers for which a TTYPEn
	keyword was found, and VALUES would contain the values.  N_FOUND would
	contain the total number of instances found.

 Use         : 
	FXBFIND, [UNIT or HEADER], KEYWORD, COLUMNS, VALUES, N_FOUND
		[, DEFAULT ]
 Inputs      : 
	Either UNIT or HEADER must be passed.

	UNIT	= Logical unit number of file opened by FXBOPEN.
	HEADER	= FITS binary table header.
	KEYWORD	= Prefix to a series of FITS binary table column keywords.  The
		  keywords to be searched for are formed by combining this
		  prefix with the numbers 1 through the value of TFIELDS in the
		  header.
 Opt. Inputs : 
	DEFAULT	= Default value to use for any column keywords that aren't
		  found.  If passed, then COLUMNS and VALUES will contain
		  entries for every column.  Otherwise, COLUMNS and VALUES only
		  contain entries for columns where values were found.
 Outputs     : 
	COLUMNS	= Array containing the column numbers for which values of the
		  requested keyword series were found.
	VALUES	= Array containing the found values.
	N_FOUND	= Number of values found.  The value of this parameter is
		  unaffected by whether or not DEFAULT is passed.
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	FXBFINDLUN, FXPAR
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	If UNIT is passed, then the file must have been opened with FXBOPEN.
	If HEADER is passed, then it must be a legal FITS binary table header.

	The type of DEFAULT must be consistent with the values of the requested
	keywords, i.e. both most be either of string or numerical type.

	The KEYWORD prefix must not have more than five characters to leave
	room for the three digits allowed for the column numbers.

 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Feb. 1992.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//fxbfind.pro)


FXBFINDLUN

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBFINDLUN()
 Purpose     : 
	Find logical unit number UNIT in FXBINTABLE common block.
 Explanation : 
	Finds the proper index to use for getting information about the logical
	unit number UNIT in the arrays stored in the FXBINTABLE common block.
	Called from FXBCREATE and FXBOPEN.
 Use         : 
	Result = FXBFINDLUN( UNIT )
 Inputs      : 
	UNIT	= Logical unit number.
 Opt. Inputs : 
	None.
 Outputs     : 
	The result of the function is an index into the FXBINTABLE common
	block.
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	None.
 Side effects: 
	If UNIT is not found in the common block, then it is added to the
	common block.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Feb. 1992.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 July 1993.
		Added DHEAP variable to fix bug with variable length arrays.
 Version     : 
	Version 2, 21 July 1993.

(See .//fxbfindlun.pro)


FXBFINISH

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBFINISH
 Purpose     : 
	Close a FITS binary table extension file opened for write.
 Explanation : 
	Closes a FITS binary table extension file that had been opened for
	write by FXBCREATE.
 Use         : 
	FXBFINISH, UNIT
 Inputs      : 
	UNIT	= Logical unit number of the file.
 Opt. Inputs : 
	None.
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	ERRMSG	= If defined and passed, then any error messages will be
		  returned to the user in this parameter rather than
		  depending on the MESSAGE routine in IDL.  If no errors are
		  encountered, then a null string is returned.  In order to
		  use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBFINISH, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	None.
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	The file must have been opened with FXBCREATE, and written with
	FXBWRITE.
 Side effects: 
	Any bytes needed to pad the file out to an integral multiple of 2880
	bytes are written out to the file.  Then, the file is closed.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Jan 1992.
	W. Thompson, Feb 1992, modified to support variable length arrays.
	W. Thompson, Feb 1992, removed all references to temporary files.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 July 1993.
		Fixed bug with variable length arrays.
	Version 3, William Thompson, GSFC, 31 May 1994
		Added ERRMSG keyword.
       Version 4, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 4, 23 June 1994

(See .//fxbfinish.pro)


FXBHEADER

[Previous Routine] [Next Routine] [List of Routines]
 Project     :	SOHO - CDS

 Name        :	FXBHEADER()

 Purpose     :	Returns the header of an open FITS binary table.

 Explanation :	This procedure returns the FITS extension header of a FITS
		binary table opened for read with the command FXBOPEN.

 Use         :	Result = FXBHEADER(UNIT)

 Inputs      :	UNIT	= Logical unit number returned by FXBOPEN routine.
			  Must be a scalar integer.

 Opt. Inputs :	None.

 Outputs     :	The result of the function is a string array containing the
		header for the FITS binary table that UNIT points to.

 Opt. Outputs:	None.

 Keywords    :	None.

 Calls       :	FXBFINDLUN

 Common      :	Uses common block FXBINTABLE--see "fxbintable.pro" for more
		information.

 Restrictions:	None.

 Side effects:	The string array returned always has as many elements as the
		largest header read by FXBOPEN.  Any extra elements beyond the
		true header are blank or null strings.

		The header will be returned whether or not the table is still
		open or not.

		If UNIT does not point to a binary table, then a string array
		of nulls is returned.

		If UNIT is an undefined variable, then the null string is
		returned.

 Category    :	Data Handling, I/O, FITS, Generic.

 Prev. Hist. :	None.

 Written     :	William Thompson, GSFC, 1 July 1993.

 Modified    :	Version 1, William Thompson, GSFC, 1 July 1993.

 Version     :	Version 1, 1 July 1993.

(See .//fxbheader.pro)


FXBHELP

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBHELP
 Purpose     : 
	Prints short description of columns in a FITS binary table.
 Explanation : 
	Prints a short description of the columns in a FITS binary table to the
	terminal screen.
 Use         : 
	FXBHELP, UNIT
 Inputs      : 
	UNIT	= Logical unit number of file opened by FXBOPEN.
 Opt. Inputs : 
	None.
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	FXBFIND, FXBFINDLUN, FXPAR
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	The file must have been opened with FXBOPEN.
 Side effects: 
	Certain fields may be truncated in the display.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Feb. 1992, from TBHELP by W. Landsman.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 12 May 1993.
		Modified to not write to a logical unit number assigned to the
		terminal.  This makes it compatible with IDL for Windows.
 Version     : 
	Version 2, 12 May 1993.

(See .//fxbhelp.pro)


FXBHMAKE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBHMAKE
 Purpose     : 
	Create basic FITS binary table extension (BINTABLE) header.
 Explanation : 
	Creates a basic header array with all the required keywords, but with
	none of the table columns defined.  This defines a basic structure
	which can then be added to or modified by other routines.
 Use         : 
	FXBHMAKE, HEADER, NROWS  [, EXTNAME  [, COMMENT ]]
 Inputs      : 
	NROWS	= Number of rows in the binary table.
 Opt. Inputs : 
	EXTNAME	= If passed, then the EXTNAME record is added with this value.
	COMMENT = Comment to go along with EXTNAME.
 Outputs     : 
	HEADER = String array containing FITS extension header.
 Opt. Outputs: 
	None.
 Keywords    : 
	INITIALIZE = If set, then the header is completely initialized, and any
		     previous entries are lost.
	DATE	   = If set, then the DATE keyword is added to the header.
	EXTVER	   = Extension version number (integer).
	EXTLEVEL   = Extension level number (integer).
	ERRMSG	   = If defined and passed, then any error messages will be
		     returned to the user in this parameter rather than
		     depending on the MESSAGE routine in IDL.  If no errors are
		     encountered, then a null string is returned.  In order to
		     use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBHMAKE, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	GET_DATE, FXADDPAR, FXHCLEAN
 Common      : 
	None.
 Restrictions: 
	Warning:  No checking is done of any of the parameters.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan 1992.
	William Thompson, Sep 1992, added EXTVER and EXTLEVEL keywords.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 June 1994
		Added ERRMSG keyword.
       Version 3, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 3, 23 June 1994

(See .//fxbhmake.pro)


FXBINTABLE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBINTABLE
 Purpose     : 
	Common block FXBINTABLE used by "FXB" routines.
 Explanation : 
	This is not an IDL routine as such, but contains the definition of the
	common block FXBINTABLE for inclusion into other routines.  By defining
	the common block in one place, the problem of conflicting definitions
	is avoided.

	This file is included into routines that need this common block with
	the single line (left justified)

				  @fxbintable

	FXBINTABLE contains the following arrays:

		LUN	= An array of logical unit numbers of currently (or
			  previously) opened binary table files.
		STATE	= Array containing the state of the FITS files
			  associated with the logical unit numbers, where
			  0=closed, 1=open for read, and 2=open for write.
		HEAD	= FITS binary table headers.
		MHEADER	= Array containing the positions of the first data byte
			  of the header for each file referenced by array LUN.
		NHEADER	= Array containing the positions of the first data byte
			  after the header for each file referenced by array
			  LUN.
		NAXIS1	= Values of NAXIS1 from the binary table headers.
		NAXIS2	= Values of NAXIS2 from the binary table headers.
		TFIELDS	= Values of TFIELDS from the binary table headers.
		HEAP	= The start of the first byte of the heap area
			  for variable length arrays.
		DHEAP	= The start of the first byte of the next variable
			  length array, if writing.
		BYTOFF	= Byte offset from the beginning of the row for each
			  column in the binary table headers.
		TTYPE	= Values of TTYPE for each column in the binary table
			  headers.
		FORMAT	= Character code formats of the various columns.
		IDLTYPE	= IDL type code for each column in the binary table
			  headers.
		N_ELEM	= Number of elements for each column in the binary
			  table headers.
		TSCAL	= Scale factors for the individual columns.
		TZERO	= Zero offsets for the individual columns.
		MAXVAL	= For variable length arrays, contains the maximum
			  number of elements for each column in the binary
			  table headers.
		N_DIMS	= Number of dimensions, and array of dimensions for
			  each column of type string in the binary table
			  headers.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Feb 1992.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 July 1993.
		Added DHEAP variable to fix bug with variable length arrays.
 Version     : 
	Version 2, 21 July 1993.

(See .//fxbintable.pro)


FXBISOPEN

[Previous Routine] [Next Routine] [List of Routines]
 Project     :	SOHO - CDS

 Name        :	FXBISOPEN()

 Purpose     :	Returns true if UNIT points to an open FITS binary table.

 Explanation :	This procedure checks to see if the logical unit number given
		by the variable UNIT corresponds to a FITS binary table opened
		for read with the command FXBOPEN, and which has not yet been
		closed with FXBCLOSE.

 Use         :	Result = FXBISOPEN(UNIT)

		If FXBISOPEN(UNIT) THEN ...

 Inputs      :	UNIT	= Logical unit number returned by FXBOPEN routine.
			  Must be a scalar integer.

 Opt. Inputs :	None.

 Outputs     :	The result of the function is either True (1) or False (0),
		depending on whether UNIT points to an open binary table or
		not.

 Opt. Outputs:	None.

 Keywords    :	None.

 Calls       :	FXBFINDLUN

 Common      :	Uses common block FXBINTABLE--see "fxbintable.pro" for more
		information.

 Restrictions:	None.

 Side effects:	If UNIT is an undefined variable, then False (0) is returned.

		If UNIT points to a FITS binary table file that is opened for
		write, then False (0) is returned.

 Category    :	Data Handling, I/O, FITS, Generic.

 Prev. Hist. :	None.

 Written     :	William Thompson, GSFC, 1 July 1993.

 Modified    :	Version 1, William Thompson, GSFC, 1 July 1993.

 Version     :	Version 1, 1 July 1993.

(See .//fxbisopen.pro)


FXBOPEN

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBOPEN
 Purpose     : 
	Open binary table extension in a disk FITS file for reading.
 Explanation : 
	Opens a binary table extension in a disk FITS file for reading.  The
	columns are then read using FXBREAD, and the file is closed when done
	with FXBCLOSE.
 Use         : 
	FXBOPEN, UNIT, FILENAME, EXTENSION  [, HEADER ]
 Inputs      : 
	FILENAME  = Name of FITS file to be opened.
	EXTENSION = Either the number of the FITS extension, starting with the
		    first extension after the primary data unit being one; or a
		    character string containing the value of EXTNAME to search
		    for.
 Opt. Inputs : 
	None.
 Outputs     : 
	UNIT	  = Logical unit number of the opened file.
 Opt. Outputs: 
	HEADER	  = String array containing the FITS binary table extension
		    header.
 Keywords    : 
	NO_TDIM	  = If set, then any TDIMn keywords found in the header are
		    ignored.

	ERRMSG	  = If defined and passed, then any error messages will be
		    returned to the user in this parameter rather than
		    depending on the MESSAGE routine in IDL.  If no errors are
		    encountered, then a null string is returned.  In order to
		    use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBOPEN, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	FXBFINDLUN, FXBPARSE, FXHREAD, FXPAR
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	The file must be a valid FITS file.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Feb 1992, based on READFITS by J. Woffard and W. Landsman.
	W. Thompson, Feb 1992, changed from function to procedure.
	W. Thompson, June 1992, fixed up error handling.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 27 May 1994
		Added ERRMSG keyword.
	Version 3, William Thompson, GSFC, 21 June 1994
		Extended ERRMSG to call to FXBPARSE
       Version 4, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 4, 23 June 1994

(See .//fxbopen.pro)


FXBPARSE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBPARSE
 Purpose     : 
	Parse the binary table extension header.
 Explanation : 
	Parses the binary table extension header, and store the information
	about the format of the binary table in the FXBINTABLE common
	block--called from FXBCREATE and FXBOPEN.
 Use         : 
	FXBPARSE, ILUN, UNIT, HEADER
 Inputs      : 
	ILUN	= Index into the arrays in the FXBINTABLE common block.
	HEADER	= FITS binary table extension header.
 Opt. Inputs : 
	None.
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	NO_TDIM	  = If set, then any TDIMn keywords found in the header are
		    ignored.
	ERRMSG	  = If defined and passed, then any error messages will be
		    returned to the user in this parameter rather than
		    depending on the MESSAGE routine in IDL.  If no errors are
		    encountered, then a null string is returned.  In order to
		    use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBPARSE, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	FXBFIND, FXBTDIM, FXBTFORM, FXPAR
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	None.
 Side effects: 
	Any TDIMn keywords found for bit arrays (format 'X') are ignored, since
	the dimensions would refer to bits, not bytes.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Feb. 1992.
	William Thompson, Jan. 1993, modified for renamed FXBTFORM and FXBTDIM.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 June 1994
		Added ERRMSG keyword.
       Version 3, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 3, 23 June 1994

(See .//fxbparse.pro)


FXBREAD

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBREAD
 Purpose     : 
	Read a data array from a disk FITS binary table file.
 Explanation : 
	Each call to FXBREAD will read the data from one column and one row
	from the FITS data file, which should already have been opened by
	FXBOPEN.  One needs to call this routine for every column and every row
	in the binary table.  FXBCLOSE will then close the FITS data file.
 Use         : 
	FXBREAD, UNIT, DATA, COL  [, ROW ]
 Inputs      : 
	UNIT	= Logical unit number corresponding to the file containing the
		  binary table.
	COL	= Column in the binary table to read data from, either as a
		  character string containing a column label (TTYPE), or as a
		  numerical column index starting from column one.
 Opt. Inputs : 
	ROW	= Either row number in the binary table to read data from,
		  starting from row one, or a two element array containing a
		  range of row numbers to read.  If not passed, then the entire
		  column is read in.

		  Row must be passed for variable length arrays.

 Outputs     : 
	DATA	= IDL data array to be read from the file.
 Opt. Outputs: 
	None.
 Keywords    : 
	NOSCALE	= If set, then the ouput data will not be scaled using the
		  optional TSCAL and TZERO keywords in the FITS header.
		  Default is to scale.
	VIRTUAL	= If set, and COL is passed as a name rather than a number,
		  then if the program can't find a column with that name, it
		  will then look for a keyword with that name in the header.
		  Such a keyword would then act as a "virtual column", with the
		  same value for every row.
	DIMENSIONS = Vector array containing the dimensions to be used to read
		  in the data.  Bypasses any dimensioning information stored in
		  the header.  Ignored for bit arrays.  If the data type is
		  double-precision complex, then an extra dimension of 2 is
		  prepended to the dimensions passed by the user.
	NANVALUE= Value signalling data dropout.  All points corresponding to
		  IEEE NaN (not-a-number) are converted to this number.
		  Ignored unless DATA is of type float, double-precision or
		  complex.
	ERRMSG	= If defined and passed, then any error messages will be
		  returned to the user in this parameter rather than
		  depending on the MESSAGE routine in IDL.  If no errors are
		  encountered, then a null string is returned.  In order to
		  use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBREAD, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	IEEE_TO_HOST, FXPAR, WHERENAN
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	The binary table file must have been opened with FXBOPEN.

	The data must be consistent with the column definition in the binary
	table header.

	The row number must be consistent with the number of rows stored in the
	binary table header.

	The number of elements implied by the dimensions keyword must not
	exceed the number of elements stored in the file.

 Side effects: 
	If the DIMENSIONS keyword is used, then the number of data points read
	in may be less than the number of points stored in the table.

	If there are no elements to read in (the number of elements is zero),
	then the program sets !ERR to -1, and DATA is unmodified.

 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Jan 1992.
	W. Thompson, Feb 1992, modified to support variable length arrays.
	W. Thompson, Jun 1992, modified way that row ranges are read in.  No
			       longer works reiteratively.
	W. Thompson, Jun 1992, fixed bug where NANVALUE would be modified by
			       TSCAL and TZERO keywords.
	W. Thompson, Jun 1992, fixed bug when reading character strings.
			       Treats dimensions better when reading multiple
			       rows.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 30 June 1993.
		Added overwrite keyword to REFORM call to speed up.
	Version 3, William Thompson, GSFC, 21 July 1993.
		Fixed bug with variable length arrays.
	Version 4, William Thompson, GSFC, 29 October 1993.
		Added error message for not finding column by name.
	Version 5, William Thompson, GSFC, 31 May 1994
		Added ERRMSG keyword.
       Version 6, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
	Version 7, William Thompson, GSFC, 29 December 1994
		Fixed bug where single element dimensions were lost.
	Version 8, William Thompson, GSFC, 20 March 1995
		Fixed bug introduced in version 7.
 Version     :
       Version 8, 20 March 1995

(See .//fxbread.pro)


FXBSTATE

[Previous Routine] [Next Routine] [List of Routines]
 Project     :	SOHO - CDS

 Name        :	FXBSTATE()

 Purpose     :	Returns the state of a FITS binary table.

 Explanation :	This procedure returns the state of a FITS binary table that
		was either opened for read with the command FXBOPEN, or for
		write with the command FXBCREATE.

 Use         :	Result = FXBSTATE(UNIT)

 Inputs      :	UNIT	= Logical unit number returned by FXBOPEN routine.
			  Must be a scalar integer.

 Opt. Inputs :	None.

 Outputs     :	The result of the function is the state of the FITS binary
		table that UNIT points to.  This can be one of three values:

			0 = Closed
			1 = Open for read
			2 = Open for write

 Opt. Outputs:	None.

 Keywords    :	None.

 Calls       :	FXBFINDLUN

 Common      :	Uses common block FXBINTABLE--see "fxbintable.pro" for more
		information.

 Restrictions:	None.

 Side effects:	If UNIT is an undefined variable, then 0 (closed) is returned.

 Category    :	Data Handling, I/O, FITS, Generic.

 Prev. Hist. :	None.

 Written     :	William Thompson, GSFC, 1 July 1993.

 Modified    :	Version 1, William Thompson, GSFC, 1 July 1993.

 Version     :	Version 1, 1 July 1993.

(See .//fxbstate.pro)


FXBTDIM

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBTDIM()
 Purpose     : 
	Parse TDIM-like kwywords.
 Explanation : 
	Parses the value of a TDIM-like keyword (e.g. TDIMnnn, TDESC, etc.) to
	return the separate elements contained within.
 Use         : 
	Result = FXBTDIM( TDIM_KEYWORD )
 Inputs      : 
	TDIM_KEYWORD	= The value of a TDIM-like keyword.  Must be a
			  character string of the form "(value1,value2,...)".
			  If the parentheses characters are missing, then the
			  string is simply returned as is, without any further
			  processing.
 Opt. Inputs : 
	None.
 Outputs     : 
	The result of the function is a character string array containing the
	values contained within the keyword parameter.  If a numerical result
	is desired, then simply call, e.g.

		Result = FIX( FXBTDIM( TDIM_KEYWORD ))

 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	GETTOK
 Common      : 
	None.
 Restrictions: 
	The input parameter must have the proper format.  The separate values
	must not contain the comma character.  TDIM_KEYWORD must not be an
	array.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan. 1992.
	William Thompson, Jan. 1993, renamed to be compatible with DOS
		limitations.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//fxbtdim.pro)


FXBTFORM

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBTFORM
 Purpose     : 
	Returns information about FITS binary table columns.
 Explanation : 
	Procedure to return information about the format of the various columns
	in a FITS binary table.
 Use         : 
	FXBTFORM,HEADER,TBCOL,IDLTYPE,FORMAT,NUMVAL,MAXVAL
 Inputs      : 
	HEADER	= Fits binary table header.
 Opt. Inputs : 
	None.
 Outputs     : 
	TBCOL	= Array of starting column positions in bytes.
	IDLTYPE	= IDL data types of columns.
	FORMAT	= Character code defining the data types of the columns.
	NUMVAL	= Number of elements of the data arrays in the columns.
	MAXVAL	= Maximum number of elements for columns containing variable
		  length arrays, or zero otherwise.
 Opt. Outputs: 
	None.
 Keywords    : 
	ERRMSG	  = If defined and passed, then any error messages will be
		    returned to the user in this parameter rather than
		    depending on the MESSAGE routine in IDL.  If no errors are
		    encountered, then a null string is returned.  In order to
		    use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBTFORM, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	FXPAR
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Feb. 1992, from TBINFO by D. Lindler.
	W. Thompson, Jan. 1993, renamed to be compatible with DOS limitations.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 June 1994
		Added ERRMSG keyword.
       Version 3, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 3, 23 June 1994

(See .//fxbtform.pro)


FXBWRITE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXBWRITE
 Purpose     : 
	Write a binary data array to a disk FITS binary table file.
 Explanation : 
	Each call to FXBWRITE will write to the data file, which should already
	have been created and opened by FXBCREATE.  One needs to call this
	routine for every column and every row in the binary table.  FXBFINISH
	will then close the file.
 Use         : 
	FXBWRITE, UNIT, DATA, COL, ROW
 Inputs      : 
	UNIT	= Logical unit number corresponding to the file containing the
		  binary table.
	DATA	= IDL data array to be written to the file.
	COL	= Column in the binary table to place data in, starting from
		  column one.
	ROW	= Row in the binary table to place data in, starting from row
		  one.
 Opt. Inputs : 
	None.
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	BIT	= Number of bits in bit mask arrays (type "X").  Only used if
		  the column is of variable size.
	NANVALUE= Value signalling data dropout.  All points corresponding to
		  this value are set to be IEEE NaN (not-a-number).  Ignored
		  unless DATA is of type float, double-precision or complex.
	ERRMSG	= If defined and passed, then any error messages will be
		  returned to the user in this parameter rather than
		  depending on the MESSAGE routine in IDL.  If no errors are
		  encountered, then a null string is returned.  In order to
		  use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXBWRITE, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	HOST_TO_IEEE
 Common      : 
	Uses common block FXBINTABLE--see "fxbintable.pro" for more
	information.
 Restrictions: 
	The binary table file must have been opened with FXBCREATE.

	The data must be consistent with the column definition in the binary
	table header.

	The row number must be consistent with the number of rows stored in the
	binary table header.

 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Jan 1992, based on WRITEFITS by J. Woffard and W. Landsman.
	W. Thompson, Feb 1992, modified to support variable length arrays.
	W. Thompson, Feb 1992, removed all references to temporary files.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 July 1993.
		Fixed bug with variable length arrays.
	Version 3, William Thompson, GSFC, 31 May 1994
		Added ERRMSG keyword.
       Version 4, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 4, 23 June 1994

(See .//fxbwrite.pro)


FXFINDEND

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXFINDEND
 Purpose     : 
	Find the end of a FITS file.
 Explanation : 
	This routine finds the end of the last logical record in a FITS file,
	which may be different from that of the physical end of the file.  Each
	FITS header is read in and parsed, and the file pointer is moved to
	where the next FITS extension header would be if there is one, or to
	the end of the file if not.
 Use         : 
	FXFINDEND, UNIT
 Inputs      : 
	UNIT	= Logical unit number for the opened file.
 Opt. Inputs : 
	None.
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	FXHREAD, FXPAR
 Common      : 
	None.
 Restrictions: 
	The file must have been opened for block I/O.  There must not be any
	FITS "special records" at the end of the file.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Feb. 1992.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//fxfindend.pro)


FXHCLEAN

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXHCLEAN
 Purpose     : 
	Removes required keywords from FITS header.
 Explanation : 
	Removes any keywords relevant to array structure from a FITS header,
	preparatory to recreating it with the proper values.
 Use         : 
	FXHCLEAN, HEADER
 Inputs      : 
	HEADER	= FITS header to be cleaned.
 Opt. Inputs : 
	None.
 Outputs     : 
	HEADER	= The cleaned FITS header is returned in place of the input
		  array.
 Opt. Outputs: 
	None.
 Keywords    : 
	ERRMSG	= If defined and passed, then any error messages will be
		  returned to the user in this parameter rather than
		  depending on the MESSAGE routine in IDL.  If no errors are
		  encountered, then a null string is returned.  In order to
		  use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXHCLEAN, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	SXDELPAR, FXPAR
 Common      : 
	None.
 Restrictions: 
	HEADER must be a string array containing a properly formatted FITS
	header.
 Side effects: 
	Warning:  when cleaning a binary table extension header, not all of the
	keywords pertaining to columns in the table may be removed.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan 1992.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 31 May 1994
		Added ERRMSG keyword.
       Version 3, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
	Version 4, William Thompson, GSFC, 30 December 1994
		Added TCUNIn to list of column keywords to be removed.
 Version     :
       Version 4, 30 December 1994

(See .//fxhclean.pro)


FXHMAKE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXHMAKE
 Purpose     : 
	Create a basic FITS header array.
 Explanation : 
	Creates a basic header array with all the required keywords.  This
	defines a basic structure which can then be added to or modified by
	other routines.
 Use         : 
	FXHMAKE, HEADER  [, DATA ]
 Inputs      : 
	None required.
 Opt. Inputs : 
	DATA	= IDL data array to be written to file in the primary data unit
		  (not in an extension).  This is used to determine the values
		  of the BITPIX and NAXIS, etc. keywords.

		  If not passed, then BITPIX is set to eight, NAXIS is set to
		  zero, and no NAXISnnn keywords are included in this
		  preliminary header.
 Outputs     : 
	HEADER = String array containing FITS header.
 Opt. Outputs: 
	None.
 Keywords    : 
	INITIALIZE = If set, then the header is completely initialized, and any
		     previous entries are lost.
	EXTEND	= If set, then the keyword EXTEND is inserted into the file,
		  with the value of "T" (true).
	DATE	= If set, then the DATE keyword is added to the header.
	ERRMSG	= If defined and passed, then any error messages will be
		  returned to the user in this parameter rather than
		  depending on the MESSAGE routine in IDL.  If no errors are
		  encountered, then a null string is returned.  In order to
		  use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXHMAKE, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	GET_DATE, FXADDPAR, FXHCLEAN
 Common      : 
	None.
 Restrictions: 
	Groups are not currently supported.
 Side effects: 
	BITPIX, NAXIS, etc. are defined such that complex arrays are stored as
	floating point, with an extra first dimension of two elements (real and
	imaginary parts).
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan 1992, from FXHMAKE by D. Lindler and M. Greason.
	Differences include:

		* Use of FITS standard (negative BITPIX) to signal floating
		  point numbers instead of (SDAS/Geis) DATATYPE keyword.
		* Storage of complex numbers as pairs of real numbers.
		* Support for EXTEND keyword, and for cases where there is no
		  primary data array.
		* Insertion of DATE record made optional.  Only required FITS
		  keywords are inserted automatically.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 21 June 1994
		Added ERRMSG keyword.
       Version 3, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 3, 23 June 1994

(See .//fxhmake.pro)


FXHMODIFY

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXHMODIFY
 Purpose     : 
	Modify a FITS header in a file on disk.
 Explanation : 
	Opens a FITS file, and adds or modifies a parameter in the FITS header.
	Can be used for either the main header, or for an extension header. 
	The modification is performed directly on the disk file.
 Use         : 
	FXHMODIFY, FILENAME, NAME, VALUE, COMMENT
 Inputs      : 
	FILENAME = String containing the name of the file to be read.

	NAME	= Name of parameter.  If NAME is already in the header the
		  value and possibly comment fields are modified. Otherwise a
		  new record is added to the header.  If NAME is equal to
		  either "COMMENT" or "HISTORY" then the value will be added to
		  the record without replacement.  In this case the comment
		  parameter is ignored.

	VALUE	= Value for parameter.  The value expression must be of the
		  correct type, e.g. integer, floating or string.  String
		  values of 'T'	or 'F' are considered logical values.

 Opt. Inputs : 
	COMMENT	= String field.  The '/' is added by this routine.  Added
		  starting in position 31.  If not supplied, or set equal to ''
		  (the null string), then any previous comment field in the
		  header for that keyword is retained (when found).
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	EXTENSION = Either the number of the FITS extension, starting with the
		    first extension after the primary data unit being one; or a
		    character string containing the value of EXTNAME to search
		    for.  If not passed, then the primary FITS header is
		    modified.           

	BEFORE	= Keyword string name.  The parameter will be placed before the
		  location of this keyword.  For example, if BEFORE='HISTORY'
		  then the parameter will be placed before the first history
		  location.  This applies only when adding a new keyword;
		  keywords already in the header are kept in the same position.

	AFTER	= Same as BEFORE, but the parameter will be placed after the
		  location of this keyword.  This keyword takes precedence over
		  BEFORE.

       FORMAT	= Specifies FORTRAN-like format for parameter, e.g. "F7.3".  A
		  scalar string should be used.  For complex numbers the format
		  should be defined so that it can be applied separately to the
		  real and imaginary parts.
	ERRMSG	= If defined and passed, then any error messages will be
		  returned to the user in this parameter rather than
		  depending on the MESSAGE routine in IDL.  If no errors are
		  encountered, then a null string is returned.  In order to
		  use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXHMODIFY, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	FXHREAD, FXPAR, FXADDPAR
 Common      : 
	None.
 Restrictions: 
	Adding records to a FITS header is not allowed if it would increase the
	number of 2880 byte records needed to store the header.  Modifying
	existing records is always allowed.

	This routine can not be used to modify any of the keywords that control
	the structure of the FITS file, e.g. BITPIX, NAXIS, PCOUNT, etc.  Doing
	so could corrupt the readability of the FITS file.

 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	None.
 Written     : 
	William Thompson, GSFC, 3 March 1994.
 Modified    : 
	Version 1, William Thompson, GSFC, 3 March 1994.
	Version 2, William Thompson, GSFC, 31 May 1994
		Added ERRMSG keyword.
       Version 3, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 3, 23 June 1994

(See .//fxhmodify.pro)


FXHREAD

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXHREAD
 Purpose     : 
       Reads a FITS header from an opened disk file.
 Explanation : 
       Reads a FITS header from an opened disk file.
 Use         : 
	FXHREAD, UNIT, HEADER  [, STATUS ]
 Inputs      : 
	UNIT	= Logical unit number.
 Opt. Inputs : 

 Outputs     : 
	HEADER	= String array containing the FITS header.
 Opt. Outputs: 
	STATUS	= Condition code giving the status of the read.  Normally, this
		  is zero, but is set to !ERR if an error occurs, or if the
		  first byte of the header is zero (ASCII null).
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	The file must already be positioned at the start of the header.  It
	must be a proper FITS file.
 Side effects: 
	The file ends by being positioned at the end of the FITS header, unless
	an error occurs.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Feb 1992, from READFITS by J. Woffard and W. Landsman.
	W. Thompson, Aug 1992, added test for SIMPLE keyword.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//fxhread.pro)


FXPAR

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXPAR()
 Purpose     : 
	Obtain the value of a parameter in a FITS header.
 Explanation : 
	The first 8 chacters of each element of HDR are searched for a match to
	NAME.  If the keyword is one of those allowed to take multiple values
	("HISTORY", "COMMENT", or "        " (blank)), then the value is taken
	as the next 72 characters.  Otherwise, it is assumed that the next
	character is "=", and the value (and optional comment) is then parsed
	from the last 71 characters.  An error occurs if there is no parameter
	with the given name.

	Complex numbers are recognized as two numbers separated by one or more
	space characters.

	If a numeric value has no decimal point (or E or D) it is returned as
	type LONG.  If it contains more than 8 numerals, or contains the
	character 'D', then it is returned as type DOUBLE.  Otherwise it is
	returned as type FLOAT
 Use         : 
	Result = FXPAR( HDR, NAME  [, ABORT ] )

	Result = FXPAR(HEADER,'DATE')		;Finds the value of DATE
	Result = FXPAR(HEADER,'NAXIS*')		;Returns array dimensions as
						;vector
 Inputs      : 
	HDR	= FITS header string array (e.g. as returned by FXREAD).  Each
		  element should have a length of 80 characters
	NAME	= String name of the parameter to return.  If NAME is of the
		  form 'keyword*' then an array is returned containing values
		  of keywordN where N is an integer.  The value of keywordN
		  will be placed in RESULT(N-1).  The data type of RESULT will
		  be the type of the first valid match of keywordN found.
 Opt. Inputs : 
	ABORT	= String specifying that FXPAR should do a RETALL if a
		  parameter is not found.  ABORT should contain a string to be
		  printed if the keyword parameter is not found.  If not
		  supplied, FXPAR will return with a negative !err if a keyword
		  is not found.
 Outputs     : 
	The returned value of the function is the value(s) associated with the
	requested keyword in the header array.

	If the parameter is complex, double precision, floating point, long or
	string, then the result is of that type.  Apostrophes are stripped from
	strings.  If the parameter is logical, 1 is returned for T, and 0 is
	returned for F.

	If NAME was of form 'keyword*' then a vector of values are returned.
 Opt. Outputs: 
	None.
 Keywords    : 
	COUNT	= Optional keyword to return a value equal to the number of
		  parameters found by FXPAR.
	COMMENTS= Array of comments associated with the returned values.
 Calls       : 
	GETTOK, VALID_NUM
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
	Keyword COUNT returns the number of parameters found.

	The system variable !err is set to -1 if parameter not found, 0 for a
	scalar value returned.  If a vector is returned it is set to the number
	of keyword matches found.

	If a keyword occurs more than once in a header, a warning is given,
	and the first occurence is used.  However, if the keyword is "HISTORY",
	"COMMENT", or "        " (blank), then multiple values are returned.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	DMS, May, 1983, Written.
	D. Lindler Jan 90 added ABORT input parameter
	J. Isensee Jul,90 added COUNT keyword
	W. Thompson, Feb. 1992, added support for FITS complex values.
	W. Thompson, Oct. 1992, rewrote to change strategy for extracting
		values to allow for non-standard formats and renamed to FXPAR.
		Added COMMENT keyword.
 Written     : 
	David M. Stern, RSI, May 1983.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 14 October 1994
		Modified to use VALID_NUM instead of STRNUMBER.  Inserted
		additional call to VALID_NUM to trap cases where character
		strings did not contain quotation marks.
	Version 3, William Thompson, GSFC, 22 December 1994
		Fixed bug with blank keywords, following suggestion by Wayne
		Landsman.
 Version     : 
	Version 2, 14 October 1994

(See .//fxpar.pro)


FXPARPOS

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXPARPOS()
 Purpose     : 
	Finds position to insert record into FITS header.
 Explanation : 
	Finds the position to insert a record into a FITS header.  Called from
	FXADDPAR.
 Use         : 
	Result = FXPARPOS(KEYWRD, IEND  [, BEFORE=BEFORE ]  [, AFTER=AFTER ])
 Inputs      : 
	KEYWRD	= Array of eight-character keywords in header.
	IEND	= Position of END keyword.
 Opt. Inputs : 
	None.
 Outputs     : 
	Result of function is position to insert record.
 Opt. Outputs: 
	None.
 Keywords    : 
	BEFORE	= Keyword string name.  The parameter will be placed before the
		  location of this keyword.  For example, if BEFORE='HISTORY'
		  then the parameter will be placed before the first history
		  location.  This applies only when adding a new keyword;
		  keywords already in the header are kept in the same position.

	AFTER	= Same as BEFORE, but the parameter will be placed after the
		  location of this keyword.  This keyword takes precedence over
		  BEFORE.

	If neither BEFORE or AFTER keywords are passed, then IEND is returned.

 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	KEYWRD and IEND must be consistent with the relevant FITS header.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan 1992.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//fxparpos.pro)


FXREAD

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXREAD
 Purpose     : 
	Read basic FITS files.
 Explanation : 
	Read the primary array from a disk FITS file.  Optionally allows the
	user to read in only a subarray and/or every Nth pixel.
 Use         : 
	FXREAD, FILENAME, DATA  [, HEADER  [, I1, I2  [, J1, J2 ]]  [, STEP ]]
 Inputs      : 
	FILENAME = String containing the name of the file to be read.
 Opt. Inputs : 
	I1,I2	 = Data range to read in the first dimension.  If passed, then
		   HEADER must also be passed.  If not passed, or set to 0,0
		   then the entire range is read.
	J1,J2	 = Data range to read in the second dimension.  If passed, then
		   HEADER and I1,J2 must also be passed.  If not passed, or set
		   to 0,0 then the entire range is read.
	STEP	 = Step size to use in reading the data.  If passed, then
		   HEADER must also be passed.  Default value is 1.  Ignored if
		   less than 1.
 Outputs     : 
	DATA	 = Data array to be read from the file.
 Opt. Outputs: 
	HEADER	 = String array containing the header for the FITS file.
 Keywords    : 
	NANVALUE = Value signalling data dropout.  All points corresponding to
		   IEEE NaN (not-a-number) are set to this value.  Ignored
		   unless DATA is of type float or double-precision.
	PROMPT	 = If set, then the optional parameters are prompted for at the
		   keyboard.
	AVERAGE	 = If set, then the array size is reduced by averaging pixels
		   together rather than by subselecting pixels.  Ignored unless
		   STEP is nontrivial.  Note:  this is much slower.
	YSTEP	 = If passed, then STEP is the step size in the 1st dimension,
		   and YSTEP is the step size in the 2nd dimension.  Otherwise,
		   STEP applies to both directions.
	NOSCALE	 = If set, then the output data will not be scaled using the
		   optional BSCALE and BZERO keywords in the FITS header.
		   Default is to scale, if and only if BSCALE and BZERO are
		   present and nontrivial.
	NOUPDATE = If set, then the optional BSCALE and BZERO keywords in the
		   optional HEADER array will not be changed.  The default is
		   to reset these keywords to BSCALE=1, BZERO=0.  Ignored if
		   NOSCALE is set.
	ERRMSG   = If defined and passed, then any error messages will be
		   returned to the user in this parameter rather than
		   depending on the MESSAGE routine in IDL.  If no errors are
		   encountered, then a null string is returned.  In order to
		   use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXREAD, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	GET_DATE, IEEE_TO_HOST, FXADDPAR, FXHREAD, FXPAR, WHERENAN
 Common      : 
	None.
 Restrictions: 
	Groups are not supported.

	The optional parameters I1, I2, and STEP only work with one or
	two-dimensional arrays.  J1 and J2 only work with two-dimensional
	arrays.

	Use of the AVERAGE keyword is not compatible with arrays with missing
	pixels.

 Side effects: 
	If the keywords BSCALE and BZERO are present in the FITS header, and
	have non-trivial values, then the returned array DATA is formed by the
	equation

			DATA = BSCALE*original + BZERO

	However, this behavior can overridden by using the /NOSCALE keyword.

	If the data is scaled, then the optional HEADER array is changed so
	that BSCALE=1 and BZERO=0.  This is so that these scaling parameters
	are not applied to the data a second time by another routine.  Also,
	history records are added storing the original values of these
	constants.  Note that only the returned array is modified--the header
	in the FITS file itself is untouched.

	If the /NOUPDATE keyword is set, however, then the BSCALE and BZERO
	keywords are not changed.  It is then the user's responsibility to
	ensure that these parameters are not reapplied to the data.  In
	particular, these keywords should not be present in any header when
	writing another FITS file, unless the user wants their values to be
	applied when the file is read back in.  Otherwise, FITS readers will
	read in the wrong values for the data array.

 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, May 1992, based in part on READFITS by W. Landsman, and
			       STSUB by M. Greason and K. Venkatakrishna.
	W. Thompson, Jun 1992, added code to interpret BSCALE and BZERO
			       records, and added NOSCALE and NOUPDATE
			       keywords.
	W. Thompson, Aug 1992, changed to call FXHREAD, and to add history
			       records for BZERO, BSCALE.
 Written     : 
	William Thompson, GSFC, May 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 17 November 1993.
		Corrected bug with AVERAGE keyword on non-IEEE compatible
		machines.
		Corrected bug with subsampling on VAX machines.
	Version 3, William Thompson, GSFC, 31 May 1994
		Added ERRMSG keyword.
       Version 4, William Thompson, GSFC, 23 June 1994
               Modified so that ERRMSG is not touched if not defined.
 Version     :
       Version 4, 23 June 1994

(See .//fxread.pro)


FXTAPEREAD

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        :	FXTAPEREAD

 Purpose     : Procedure to copy FITS files from tape to disk with interactive
		capabilities.

 Explanation :	Copy FITS files from tape onto disk.  Data is left in FITS 
		format, and not converted to SDAS.  For use on VMS (any 
		version) and UNIX running IDL Version 3.1 or later (see 
		Restrictions).

 Use         :	FXTAPEREAD                      ; Prompt for all parameters.

		FXTAPEREAD, UNIT, LIST, KEYWORD, TAPENAME, FNAMES

		FXTAPEREAD, 1, INDGEN(5)+1, 'IMAGE'
			; Read the first 5 files on unit 1.  The filenames are
			; taken from the IMAGE keyword.

		FXTAPEREAD, 1, [2,4], '', '', ['GALAXY', 'STAR']
			; Read files 2 and 4 on unit 1.  Create files named
			; GALAXY and STAR.

		FXTAPEREAD, 1, [2,4]
			; Read files 2 and 4, and prompt for filenames.

 Inputs      :	None necessary.

 Opt. Inputs :	Interactive users will normally just type FXTAPEREAD and be 
		prompted for all parameters.  However, the following 
		parameters can be passed directly to FXTAPEREAD:

	UNIT	 = Tape unit number (scalar: 0-9).
	LIST	 = Vector containing list of file numbers to read.
	KEYWORD	 = Scalar string giving a FITS keyword which will be extracted
		   from the headers on tape and used for file names.  Set
		   KEYWORD to the null string '', if such a keyword is not to
		   be used.
	TAPENAME = Scalar string giving a name for the tape.  Filenames will be
		   constructed by concatenating TAPENAME with the file number.
		   TAPENAME is used only if KEYWORD is passed as the null
		   string ''.
	FNAMES	 = Vector string giving a file name for each file number given
		   in LIST.  FNAMES is used only if both KEYWORD = '' and
		   TAPENAME = ''.  Spaces are trimmed from names in FNAMES.

 Outputs     :	None.

 Opt. Outputs:	FNAMES	= If KEYWORD or TAPENAME is set to a non-null string, 
			  then the filename created by FXTPIO_READ is stored 
			  in this variable to be returned to the caller.

 Keywords    :	ERRMSG	= If defined and passed, then any error messages will
			  be returned to the user in this parameter rather 
			  than being handled by the IDL MESSAGE utility.  If
			  no errors are encountered, then a null string is
			  returned.  In order to use this feature, the string
			  ERRMSG must be defined first, e.g.,

				ERRMSG = ''
				FXTAPEREAD, 1, INDGEN(5)+1, 'IMAGE', $
					ERRMSG=ERRMSG
				IF ERRMSG(0) NE '' THEN ...

		NOSUFFIX = Normally FXTAPEREAD (via FXTPIO_READ) will 
			  automatically append a ".fits" to the end of a 
			  passed file name.  Setting this keyword prevents
			  that from happening.


		SFDU	= This keyword tells this routine that the first file
			  on the tape is an SFDU header file (defined to be
			  tape file number 0).  If this keyword is set, then
			  the first file on the tape is skipped after the
			  initial rewind is preformed.

 Calls       :	DATATYPE, FITSTAPE, GETFILES, FXTPIO_READ

 Common      :	None.

 Restrictions:	Supported under VMS and (NOW) under UNIX running IDL Versions
		3.1 or later when the UNIX versions of TAPRD, TAPWRT, etc. are
		included in a user library directory.

 Side effects:	FXTAPEREAD will always rewind the tape before processing.

		The FITS file is copied over record by record with no 
		conversion, until the  marker is reached.  No 
		testing is done of the validity of the FITS file.

		Images are NOT converted using BSCALE and BZERO factors in the 
		header.

		For each tape file a FITS disk file will be created with the 
		name ".FITS" unless /NOSUFFIX has been set..

 Category    :	Data Handling, I/O, FITS, Generic.

 Prev. Hist. :	William Thompson, March 1992, from FITSRD by D. Lindler.
		William Thompson, May 1992, fixed TPOS bug when reading 
			multiple files.
		William Thompson, Jan. 1993, changed for renamed FXTPIO_READ.

 Written     :	William Thompson, GSFC, March 1992.

 Modified    :	Version 1, William Thompson, GSFC, 12 April 1993.
			Incorporated into CDS library.
		Version 2, Donald G. Luttermoser, GSFC/ARC, 13 March 1995.
			Added ERRMSG keyword.  Reformatted and modified the
			documentation.
		Version 3, Donald G. Luttermoser, GSFC/ARC, 20 March 1995.
			Added NOSUFFIX & SFDU keyword.

 Version     :	Version 3, 20 March 1995.

(See .//fxtaperead.pro)


FXTAPEWRITE

[Previous Routine] [Next Routine] [List of Routines]
 Project     :	SOHO - CDS

 Name        :	FXTAPEWRITE

 Purpose     :	Procedure to copy disk FITS files to tape with interactive 
		capabilities.

 Explanation : Writes the FITS files to tape based upon the parameters 
		inputted or supplied.  If no parameters are supplied, then the 
		user is asked a series of questions to walk him or her through 
		copying a number of FITS files from disk to tape.  

 Use         : FXTAPEWRITE			; Prompt for all parameters.

		FXTAPEWRITE, UNIT, BLFAC, FNAMES, KEYWORD

		FXTAPEWRITE, 0, 1, FNAMES
			; Writes all FITS files listed in FNAMES to the tape 
			; associated to UNIT = 0 with 2880 bytes per record.
		FXTAPEWRITE, 1, 3, 'CDS', 'FILENAME'
			; Writes all FITS files beginning with the name 'CDS'
			; to the tape associated to UNIT = 1 with 8640 (2880*3)
			; bytes per record and includes the keyword 'FILENAME'
			; in the FITS header which contains the disk file name 
			; of the file being written.

 Inputs      : None necessary.

 Opt. Inputs : Interactive users will normally just type FXTAPEWRITE and be 
		prompted for all parameters.  However, the following 
		parameters can be passed directly to FXTAPEWRITE:

	UNIT	= Tape unit number (integer scalar).
	BLFAC	= Blocking factor (1-10) = # of 2880 byte records per block.
	FNAMES	= File names (string array).  If in interactive mode, the file 
		  names may either be specified individually, or a tapename 
		  may be specified, and all files in the form 
		  "tapename.FITS" will be written to tape.
	KEYWORD	= Name of a FITS keyword to put file names into.  This will
		  simplify subsequent reading of the FITS tape, since 
		  individual filenames will not have to be specified.  If you 
		  don't want to put the file names into the FITS header, then 
		  just hit  (interactive mode) or do not pass this 
		  parameter.

 Outputs     : None.

 Opt. Outputs: None.

 Keywords    : ERRMSG	= If defined and passed, then any error messages will 
			  be returned to the user in this parameter rather 
			  than being handled by the IDL MESSAGE utility.  If 
			  no errors are encountered, then a null string is 
			  returned.  In order to use this feature, the string 
			  ERRMSG must be defined first, e.g.,

				ERRMSG = ''
				FXTAPEWRITE, 1, 1, FNAMES, ERRMSG=ERRMSG
				IF ERRMSG(0) NE '' THEN ...

 Calls       : DATATYPE, FITSTAPE, GETFILES, FXTPIO_WRITE

 Common      : None.

 Restrictions:	Supported under VMS and (NOW) under UNIX running IDL Versions 
		3.1 or later when the UNIX versions of TAPRD, TAPWRT, etc. are 
		included in a user library directory.

 Side effects:	Tape is not rewound before files are written.  Tape should be
		positioned with REWIND or SKIPF before calling FXTAPEWRITE.  
		If you want to append new FITS files to a tape, then call 
		TINIT (tape init) to position tape between final double EOF.

 Category    :	Data Handling, I/O, FITS, Generic.

 Prev. Hist. :	William Thompson, March 1992, from FITSWRT by D. Lindler.
		William Thompson, May 1992, removed call to TINIT.
		William Thompson, Jan. 1993, changed for renamed FXTPIO_WRITE.

 Written     :	William Thompson, GSFC, March 1992.

 Modified    :	Version 1, William Thompson, GSFC, 12 April 1993.
			Incorporated into CDS library.
		Version 2, Donald G. Luttermoser, GSFC/ARC, 13 March 1995.
			Included "passed" input parameters and ERRMSG keyword.
			Reformatted and modified the documentation.

 Version     :	Version 2, 13 March 1995.

(See .//fxtapewrite.pro)


FXTPIO_READ

[Previous Routine] [Next Routine] [List of Routines]
 Project     :	SOHO - CDS

 Name        :	FXTPIO_READ

 Purpose     :	Copies FITS files from tape to disk -- internal routine.

 Explanation :	Procedure to copy a FITS file from a tape on the specified 
		tape unit to the disk file .FITS (unless the /NOSUFFIX
		keyword has been set).  Data is left in FITS format, and not
		converted to SDAS.  For use on VMS (any version) and UNIX 
		running IDL Version 3.1 or later (see Restrictions).

		The procedure FXTAPEREAD is normally used to read a FITS tape.
		FXTPIO_READ is a procedure call internal to FXTAPEREAD.

 Use         :	FXTPIO_READ, UNIT, NAME
		FXTPIO_READ, UNIT, NAME, KEYWORD

 Inputs      :	UNIT	= Tape unit number (scalar: 0-9).
		NAME	= File name (without an extension, unless /NOSUFFIX is
			   set).

 Opt. Inputs :	KEYWORD	= If supplied and not equal to the null string then 
			  the file name will be taken from the value of the 
			  header keyword specified.

 Outputs     :	NAME	= Name of file if input keyword parameter is supplied.

 Opt. Outputs:	None.

 Keywords    : ERRMSG	= If defined and passed, then any error messages will
			  be returned to the user in this parameter rather
			  than being handled by the IDL MESSAGE utility.  If
			  no errors are encountered, then a null string is
			  returned.  In order to use this feature, the string
			  ERRMSG must be defined first, e.g.,

				ERRMSG = ''
				FXTPIO_READ, 1, NAME, ERRMSG=ERRMSG
				IF ERRMSG(0) NE '' THEN ...

		NOSUFFIX = Normally FXTPIO_READ will automatically append a
			  ".fits" to the end of a passed file name.  Setting
			  this keyword prevents this from happening.

 Calls       :	REMCHAR, FITSTAPE, FXPAR

 Common      :	None.

 Restrictions:	Supported under VMS and (NOW) under UNIX running IDL Versions
		3.1 or later when the UNIX versions of TAPRD, TAPWRT, etc. are
		included in a user library directory.

 Side effects:	The FITS file is copied to a disk file called .FITS 
		(unless the /NOSUFFIX keyword has been set).

		The FITS file is copied over record by record with no 
		conversion, until the end-of-file marker is reached.  No 
		testing is done of the validity of the FITS file.

		Images are NOT converted using BSCALE and BZERO factors in the 
		header.

 Category    :	Data Handling, I/O, FITS, Generic.

 Prev. Hist. :	William Thompson, March 1992, from FITSREAD by D. Lindler, M. 
						Greason, and W. Landsman.
		W. Thompson, May 1992, changed open statement to force 2880 
			byte fixed length records (VMS).  The software here 
			does not depend on this file configuration, but other
			FITS readers might.
		William Thompson, Jan. 1993, renamed to be compatible with DOS 
			file naming limitations.

 Written     :	William Thompson, GSFC, March 1992.

 Modified    :	Version 1, William Thompson, GSFC, 12 April 1993.
			Incorporated into CDS library.
		Version 2, Donald G. Luttermoser, GSFC/ARC, 14 March 1995.
			Added ERRMSG and NOSUFFIX keywords.

 Version     :	Version 2, 14 March 1995.

(See .//fxtpio_read.pro)


FXTPIO_WRITE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        :	FXTPIO_WRITE

 Purpose     :	Copy FITS files from disk to tape -- internal routine.

 Explanation :	Procedure will copy a disk FITS file to the specified tape 
		unit, at the current tape position.  Used for true disk FITS 
		files, not SDAS/Geis files.  Called by FXTAPEWRITE.

 Use         :	FXTPIO_WRITE, UNIT, FILE
		FXTPIO_WRITE, UNIT, FILE, KEYWORD

 Inputs      :	UNIT	= IDL tape unit number (scalar: 0-9).
		FILE	= Disk FITS file name, with extension.

 Opt. Inputs :	KEYWORD	= Keyword to place file name into.  If not supplied or 
			  equal to the null string '' then the file name is 
			  not put into the header before writing it to tape.

 Outputs     :	None.

 Opt. Outputs:	None.

 Keywords    : ERRMSG	= If defined and passed, then any error messages will
			  be returned to the user in this parameter rather
			  than being handled by the IDL MESSAGE utility.  If
			  no errors are encountered, then a null string is 
			  returned.  In order to use this feature, the string
			  ERRMSG must be defined first, e.g.,

				ERRMSG = ''
				FXTPIO_WRITE, 1, FILE, ERRMSG=ERRMSG
				IF ERRMSG(0) NE '' THEN ...

 Calls       :	REMCHAR, FXHREAD, FXPAR, FDECOMP, FXADDPAR, FITSTAPE

 Common      :	None.

 Restrictions:	Supported under VMS and (NOW) under UNIX running IDL Versions
		3.1 or later when the UNIX versions of TAPRD, TAPWRT, etc. are
		included in a user library directory.

 Side effects:	None.

 Category    :	Data Handling, I/O, FITS, Generic.

 Prev. Hist. :	William Thompson, March 1992, from FITSWRITE by D. Lindler, W.
						Landsman, and M. Greason.
		William Thompson, Jan. 1993, renamed to be compatible with DOS 
						file naming limitations.

 Written     :	William Thompson, GSFC, March 1992.

 Modified    :	Version 1, William Thompson, GSFC, 12 April 1993.
			Incorporated into CDS library.
		Version 2, Donald G. Luttermoser, GSFC/ARC, 14 March 1995.
			Added ERRMSG keyword.  Updated documentation concerning
			UNIX.

 Version     :	Version 2, 14 March 1995.

(See .//fxtpio_write.pro)


FXWRITE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXWRITE
 Purpose     : 
	Write a disk FITS file.
 Explanation : 
	Creates a disk FITS file and writes a FITS primary header, and
	optionally a primary data array.
 Use         : 
	FXWRITE, FILENAME, HEADER [, DATA ]
 Inputs      : 
	FILENAME = String containing the name of the file to be written.
	HEADER	 = String array containing the header for the FITS file.
 Opt. Inputs : 
	DATA	 = IDL data array to be written to the file.  If not passed,
		   then it is assumed that extensions will be added to the
		   file.
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	NANVALUE = Value signalling data dropout.  All points corresponding to
		   this value are set to be IEEE NaN (not-a-number).  Ignored
		   unless DATA is of type float, double-precision or complex.
	NOUPDATE = If set, then the optional BSCALE and BZERO keywords in the
		   HEADER array will not be changed.  The default is to reset
		   these keywords to BSCALE=1, BZERO=0.
	ERRMSG	 = If defined and passed, then any error messages will be
		   returned to the user in this parameter rather than
		   depending on the MESSAGE routine in IDL.  If no errors are
		   encountered, then a null string is returned.  In order to
		   use this feature, ERRMSG must be defined first, e.g.

			ERRMSG = ''
			FXWRITE, ERRMSG=ERRMSG, ...
			IF ERRMSG NE '' THEN ...

 Calls       : 
	CHECK_FITS, GET_DATE, HOST_TO_IEEE, FXADDPAR, FXPAR
 Common      : 
	None.
 Restrictions: 
	If DATA is passed, then HEADER must be consistent with it.  If no data
	array is being written to the file, then HEADER must also be consistent
	with that.  The routine FXHMAKE can be used to create a FITS header.

	If found, then the optional keywords BSCALE and BZERO in the HEADER
	array is changed so that BSCALE=1 and BZERO=0.  This is so that these
	scaling parameters are not applied to the data a second time by another
	routine.  Also, history records are added storing the original values
	of these constants.

	If the /NOUPDATE keyword is set, however, then the BSCALE and BZERO
	keywords are not changed.  The user should then be aware that FITS
	readers will apply these numbers to the data, even if the data is
	already converted to floating point form.

	Groups are not supported.

 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Jan 1992, from WRITEFITS by J. Woffard and W. Landsman.
	Differences include:

		* Made DATA array optional, and HEADER array mandatory.
		* Changed order of HEADER and DATA parameters.
		* No attempt made to fix HEADER array.

	W. Thompson, May 1992, changed open statement to force 2880 byte fixed
			       length records (VMS).  The software here does not
			       depend on this file configuration, but other
			       FITS readers might.
	W. Thompson, Aug 1992, added code to reset BSCALE and BZERO records,
			       and added the NOUPDATE keyword.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 31 May 1994
		Added ERRMSG keyword.
	Version 3, William Thompson, GSFC, 23 June 1994
		Modified so that ERRMSG is not touched if not defined.
 Version     : 
	Version 3, 23 June 1994

(See .//fxwrite.pro)


GETFILES

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	GETFILES
 Purpose     : 
	Interactively asks for a list of tape file numbers.
 Explanation : 
	This procedure allows you to interatively specify a list of tape files
	by specifying a single file per line or a range of files separated by a
	dash or comma.
 Use         : 
	getfiles,list
 Inputs      : 
	None.
 Opt. Inputs : 
	None.
 Outputs     : 
	LIST - integer array containing file numbers
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	Written D. Lindler November, 1985
	Converted to Version 2 IDL,  August 1990
 Written     : 
	Don Lindler, GSFC/HRS, November 1985.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//getfiles.pro)


GET_DATE

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	GET_DATE
 Purpose     : 
	Gets date in format used by FITS headers.
 Explanation : 
	Return the current date in DD/MM/YY format.  This is the format
	required by the DATE and DATE-OBS keywords in a FITS header
 Use         : 
	GET_DATE, dte

	Add the current date to the DATE keyword in a FITS header,h

		GET_DATE,dte
		sxaddpar,h,'DATE',dte

 Inputs      : 
	None
 Opt. Inputs : 
	None.
 Outputs     : 
   dte = An eight character scalar string specifying the current day (0-31),
         current month (1-12), and last two digits of the current year
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	Written      W. Landsman          March 1991
 Written     : 
	Wayne Landsman, GSFC/UIT, March 1991.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//get_date.pro)


HEADFITS

[Previous Routine] [Next Routine] [List of Routines]
 Project     :	SOHO - CDS

 Name        :	HEADFITS()

 Purpose     :	Read a FITS file header record      

 Explanation :	Reads a FITS file header record.

 Use         :	Result = headfits( filename ,[ EXTEN = ])

		Example: Read the FITS header of a file 'test.fits' into a
		string variable, h

			IDL>  h = headfits( 'test.fits')

 Inputs      :	FILENAME = String containing the name of the FITS file to be
			   read.

 Opt. Inputs :	None.

 Outputs     :	Result of function = FITS header, string array

 Opt. Outputs:	None.

 Keywords    :	EXTEN  = integer scalar, specifying which FITS extension to
			 read.  For example, to read the header of the first
			 extension set EXTEN = 1.  Default is to read the
			 primary FITS header (EXTEN = 0).

 Calls       :	SXPAR

 Common      :	None.

 Restrictions:	None.

 Side effects:	None.

 Category    :	Utilities, FITS.

 Prev. Hist. :	
	adapted by Frank Varosi from READFITS by Jim Wofford, January, 24 1989
	Keyword EXTEN added, K.Venkatakrishna, May 1992
	Make sure first 8 characters are 'SIMPLE'  W. Landsman October 1993

 Written     :	Frank Varosi, GSFC, 24 January 1989

 Modified    :	Version 1, Liyun Wang, GSFC/ARC, September 19, 1994
			Incorporated into CDS library
		Version 2, William Thompson, GSFC/ARC, 9 January 1995
			Incorporated following change:

	Check PCOUNT and GCOUNT   W. Landsman    December 1994

 Version     :	Version 2, 9 January 1995

(See .//headfits.pro)


HPRINT

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	HPRINT
 Purpose     : 
	Prints FITS headers on terminal screen.
 Explanation : 
	Print a FITS header (or any other string array) at the the terminal
	by printing 1 line at a time.
	Needed because IDL Version 2 will add an extra space to the 80
	character FITS lines, causing a space to appear betweeen lines.
 Use         : 
	HPRINT, H
 Inputs      : 
	H - FITS header (or any other string array).
 Opt. Inputs : 
	None.
 Outputs     : 
	None.
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
	HPRINT has the following differences from the intrinsic PRINT procedure

   (1) Arrays are printed one line at a time to avoid a space between 80
       character lines
   (2) Lines are trimmed with STRTRIM before being printed to speed up display
   (3) The /more option is used for output. 
   (4) This version only works in Version 2.1.* or later.

 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	Written W. Landsman             July, 1990
	Added test for user quit       July, 1991
	Added optional FIRSTLINE arguement      November, 1992
	Modifed for Mac IDL, I  Freedman HSTX April 1994        
 Written     : 
	Wayne Landsman, GSFC/UIT, July 1990.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 26 October 1994
		Brought up-to-date with idlastro version.
 Version     : 
	Version 2, 26 October 1994

(See .//hprint.pro)


STRNUMBER

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	STRNUMBER()
 Purpose     : 
	Function to determine if a string is a valid numeric value.
 Explanation : 
	Function to determine if a string is a valid numeric value.
 Use         : 
	result = strnumber( st, [val] )
 Inputs      : 
	st - string
 Opt. Inputs : 
	None.
 Outputs     : 
	1 is returned as the function value if the string st has a
	valid numeric value, otherwise, 0 is returned.
 Opt. Outputs: 
	val - (optional) value of the string.  real*8
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
    (1)   Note that a blank string (e.g. " ") is not a valid numeric value, 
          although an empty string ("") is (=0.0).
    (2)   In V2.2.2 there was a bug in the IDL ON_IOERROR procedure that
          will cause the following statement to hang up IDL

		IDL> print,'' + string( strnumber('xxx') )

          This bug was fixed in V2.3.0
     (3)  As of V2.3.2, an IDL bug is seen in the following statements 

		IDL> st = 'E'
		IDL> q = strnumber(st)  & print,st

         The variable 'st' gets modified to an empty string.   This problem
         is related to the ambiguity of whether 'E' is a number or not 
         (could be = 0.0E).    A fix is expected a new IDL version.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	version 1  By D. Lindler Aug. 1987
 Written     : 
	Don Lindler, GSFC/HRS August 1987.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//strnumber.pro)


SXADDPAR

[Previous Routine] [Next Routine] [List of Routines]
 PROJECT     : SOHO - CDS

 NAME:
	SXADDPAR
 PURPOSE:
	Add or modify a parameter in a FITS or STSDAS header array.

 CALLING SEQUENCE:
	sxaddpar, Header, Name, Value, [ Comment,  Location,
				BEFORE =, AFTER = , FORMAT= ]

 INPUTS:
	Header = String array containing FITS or STSDAS header.    The
		length of each element must be 80 characters.    If not 
		defined, then SXADDPAR will create an empty FITS header array.

	Name = Name of parameter. If Name is already in the header the value 
		and possibly comment fields are modified.  Otherwise a new 
		record is added to the header.  If name = 'HISTORY' then the 
		value will be added to the record without replacement.  In 
		this case the comment parameter is ignored.

	Value = Value for parameter.  The value expression must be of the 
		correct type, e.g. integer, floating or string.  String values
		 of 'T' or 'F' are considered logical values.

 OPTIONAL INPUT PARAMETERS:
	Comment = String field.  The '/' is added by this routine.  Added 
		starting in position 31.    If not supplied, or set equal to 
		'', then the previous comment field is retained (when found) 

	Location = Keyword string name.  The parameter will be placed before the
		location of this keyword.    This parameter is identical to
		the BEFORE keyword and is kept only for consistency with
		earlier versions of SXADDPAR.

 OPTIONAL INPUT KEYWORD PARAMETERS:
	BEFORE	= Keyword string name.  The parameter will be placed before the
		location of this keyword.  For example, if BEFORE='HISTORY'
		then the parameter will be placed before the first history
		location.  This applies only when adding a new keyword;
		keywords already in the header are kept in the same position.

	AFTER	= Same as BEFORE, but the parameter will be placed after the
		location of this keyword.  This keyword takes precedence over
		BEFORE.

	FORMAT	= Specifies FORTRAN-like format for parameter, e.g. "F7.3".  A
		scalar string should be used.  For complex numbers the format
		should be defined so that it can be applied separately to the
		real and imaginary parts.

 OUTPUTS:
	Header = updated FITS header array.

 RESTRICTIONS:
	Warning -- Parameters and names are not checked
		against valid FITS parameter names, values and types.

 MODIFICATION HISTORY:
	DMS, RSI, July, 1983.
	D. Lindler Oct. 86  Added longer string value capability
	Converted to NEWIDL  D. Lindler April 90
	Added Format keyword, J. Isensee, July, 1990
	Added keywords BEFORE and AFTER. K. Venkatakrishna, May '92
	Pad string values to at least 8 characters   W. Landsman  April 94

       Version 1, Liyun Wang, GSFC/ARC, September 19, 1994
          Incoporated into CDS library.

 Version     :
       Version 1, September 19, 1994

(See .//sxaddpar.pro)


SXDELPAR

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	SXDELPAR()
 Purpose     : 
	Procedure to delete keyword parameter(s) from FITS header.
 Explanation : 
	Procedure to delete a keyword parameter(s) from a FITS header
 Use         : 
	sxdelpar,h,parname

	Delete the old-style astrometry keywords CDn_n from a FITS header, h

		sxdelpar,h,['CD1_1','CD1_2','CD2_1','CD2_2']

 Inputs      : 
	h - FITS header, string array
	parname - string or string array of keyword name(s) to delete
 Opt. Inputs : 
	None.
 Outputs     : 
	h -updated header
 Opt. Outputs: 
	None.
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
   (1)  Nothing happens if the keyword to be deleted is not found (no message)
   (2)  All appearances of a keyword in the header will be deleted
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	version 1  D. Lindler Feb. 1987
	Converted to new IDL  April 1990 by D. Lindler
 Written     : 
	Don Lindler, GSFC/HRS, Feb. 1987.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//sxdelpar.pro)


SXPAR

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	SXPAR()
 Purpose     : 
	Obtain the value of a parameter in a FITS header
 Explanation : 
	The first 8 chacters of each element of Hdr are searched for a 
	match to Name.  The value from the last 20 characters is returned.  
	An error occurs if there is no parameter with the given name.

	If a numeric value has no decimal point it is returned as type
	LONG.   If it contains more than 8 numerals, or contains the 
	character 'D', then it is returned as type DOUBLE.  Otherwise
	it is returned as type FLOAT
 Use         : 
	Result = SXPAR( hdr, name,[ abort, COUNT= ])   

	Given a FITS header, h, return the values of all the NAXISi values into
	a vector.  Then place the history records into a string vector.

	IDL> naxisi = sxpar( h ,'NAXIS*')         ; Extract NAXISi value
	IDL> history = sxpar( h, 'HISTORY' )      ; Extract HISTORY records

 Inputs      : 
	Hdr	= FITS header array, (e.g. as returned by SXOPEN or READFITS)
		  string array, each element should have a length of 80
		  characters
	Name	= String name of the parameter to return.  If Name is of the
		  form 'keyword*' then an array is returned containing values
		  of keywordN where N is an integer.  The value of keywordN
		  will be placed in RESULT(N-1).  The data type of RESULT will
		  be the type of the first valid match of keywordN found.
 Opt. Inputs : 
	ABORT	= string specifying that SXPAR should do a RETALL if a
		  parameter is not found.  ABORT should contain a string to be
		  printed if the keyword parameter is not found.  If not
		  supplied SXPAR will return with a negative !err if a keyword
		  is not found.
 Outputs     : 
	Function value = value of parameter in header.

	If parameter is double precision, floating, long or string, the result
	is of that type.  Apostrophes are stripped from strings.  If the
	parameter is logical, 1 is returned for T, and 0 is returned for F.  If
	Name was of form 'keyword*' then a vector of values are returned.

 Opt. Outputs: 
	None.
 Keywords    : 
	COUNT	= Optional keyword to return a value equal to the number of 
		  parameters found by sxpar, integer scalar
 Calls       : 
	STRNUMBER
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
	Keyword COUNT returns the number of parameters found.  !err is set to
	-1 if parameter not found, 0 for a scalar value returned.  If a vector
	is returned it is set to the number of keyword matches found.

	If a keyword occurs more than once in a header, a warning is given,
	and the first occurence is used.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	DMS, May, 1983, Written.
	D. Lindler Jan 90 added ABORT input parameter
	J. Isensee Jul,90 added COUNT keyword
	W. Thompson, Feb. 1992, added support for FITS complex values.
	W. Thompson, May 1992, corrected problem with HISTORY/COMMENT/blank
		keywords, and complex value error correction.
 Written     : 
	David M. Stern, RSI, May 1983.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See .//sxpar.pro)


WRITEFITS

[Previous Routine] [List of Routines]
 PROJECT     : SOHO - CDS

 NAME:
	WRITEFITS
 PURPOSE:
	Write an an IDL array into a disk FITS file.    Works with all types
	of FITS files except random groups

 CALLING SEQUENCE:
	writefits, filename, data [, header, NaNvalue = , /APPEND] 

 INPUTS:
	FILENAME = String containing the name of the file to be written.

	DATA = Image array to be written to FITS file.    If DATA is 
              undefined or a scalar, then only the FITS header (which
              must have NAXIS = 0) will be written to disk

 OPTIONAL INPUT:
	HEADER = String array containing the header for the FITS file.
		 If variable HEADER is not given, the program will generate
		 a minimal FITS header.

 OPTIONAL INPUT KEYWORD:
       NaNvalue - Value in the data array to be set to the IEEE NaN
                 condition.   This is the FITS representation of undefined
                 values 
       APPEND - If this keyword is set then the supplied header and data
                array are assumed to be an extension and are appended onto
                the end of an existing FITS file.    Note that the primary
                header in the existing file must already have an EXTEND
                keyword to indicate the presence of an FITS extension.

 OUTPUTS:
	None

 CALLS:
       SXADDPAR, SXDELPAR, CHECK_FITS, HOST_TO_IEEE, HEADFITS

 RESTRICTIONS:
       (1) It recommended that BSCALE and BZERO not be used (or set equal
           to 1. and 0) with REAL*4 or REAL*8 data.
       (2) WRITEFITS will remove any group parameters from the FITS header

 EXAMPLE:
       Write a randomn 50 x 50 array as a FITS file creating a minimal header.

       IDL> im = randomn(seed, 50, 50)        ;Create array
       IDL> writefits, 'test', im             ;Write to a FITS file "test"

 PROCEDURES USED:
       CHECK_FITS, HOST_TO_IEEE, SXDELPAR, SXADDPAR, SXPAR

 MODIFICATION HISTORY:
	WRITTEN, Jim Wofford, January, 29 1989
       MODIFIED, Wayne Landsman, added BITPIX = -32,-64 support for UNIX
       Use new BYTEODER keywords 22-Feb-92
       Modify OPENW for V3.0.0   W. Landsman       Dec 92
       Work for "windows"   R. Isaacman            Jan 93
	More checks for null data                   Mar 94
      Version 1, Liyun Wang, GSFC/ARC, September 19, 1994
         Incoporated into CDS library
 Version:
      Version 1, September 19, 1994

(See .//writefits.pro)